Index: Makefile
===================================================================
--- Makefile	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ Makefile	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -63,6 +63,8 @@
 CROSS_PATH = $(shell dirname "$(CC)")
 
+CROSS_TARGET ?= $(UARCH)
+
 ifeq ($(MACHINE),bmalta)
-	UARCH = mips32eb
+	CROSS_TARGET = mips32eb
 endif
 
@@ -73,5 +75,5 @@
 
 $(BUILD_DIR)/build.ninja: Makefile.config version
-	PATH="$(CROSS_PATH):$$PATH" meson . $(BUILD_DIR) --cross-file meson/cross/$(UARCH) $(MESON_ARGS)
+	PATH="$(CROSS_PATH):$$PATH" meson . $(BUILD_DIR) --cross-file meson/cross/$(CROSS_TARGET) $(MESON_ARGS)
 
 common: $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(ERRNO_HEADER) $(BUILD_DIR)/build.ninja
Index: kernel/meson.build
===================================================================
--- kernel/meson.build	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ kernel/meson.build	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -3,5 +3,5 @@
 
 # Fills arch_src.
-subdir('arch' / h_arch)
+subdir('arch' / KARCH)
 
 # Defines genarch_src.
@@ -21,6 +21,6 @@
 	'generic/include',
 	'genarch/include',
-	'arch' / h_arch / 'include',
-	'..' / 'abi' / 'arch' / h_arch / 'include',
+	'arch' / KARCH / 'include',
+	'..' / 'abi' / 'arch' / KARCH / 'include',
 	'..' / 'abi' / 'include',
 	'test',
@@ -39,5 +39,5 @@
 # Preprocess linker script using C preprocessor.
 kernel_ldscript = custom_target('_link.ld',
-	input: 'arch' / h_arch / '_link.ld.in',
+	input: 'arch' / KARCH / '_link.ld.in',
 	output: '_link.ld',
 	command: [
@@ -45,5 +45,5 @@
 		arch_kernel_c_args,
 		kernel_defs,
-		'-I' + meson.current_source_dir() / 'arch' / h_arch / 'include',
+		'-I' + meson.current_source_dir() / 'arch' / KARCH / 'include',
 		'-D__ASSEMBLER__',
 		'-D__LINKER__',
Index: kernel/test/meson.build
===================================================================
--- kernel/test/meson.build	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ kernel/test/meson.build	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -24,5 +24,5 @@
 	)
 
-	if h_arch == 'mips32'
+	if KARCH == 'mips32'
 		test_src += files('debug/mips1.c')
 	else
@@ -30,5 +30,5 @@
 	endif
 
-	if h_arch == 'ia64'
+	if KARCH == 'ia64'
 		test_src += files('mm/purge1.c')
 	else
Index: meson.build
===================================================================
--- meson.build	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ meson.build	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -111,4 +111,7 @@
 	'MACHINE',
 	'MEMORY_MODEL',
+
+	'UARCH',
+	'KARCH',
 ]
 
@@ -155,5 +158,4 @@
 HELENOS_RELEASE = HELENOS_VERSION + '.' + HELENOS_PATCHLEVEL + '.' + HELENOS_SUBLEVEL
 
-h_arch = meson.get_cross_property('h_arch')
 
 meson.add_install_script('install.sh', CONFIG_DEVEL_FILES.to_string())
@@ -205,5 +207,5 @@
 ]
 
-if h_arch != 'ia64'
+if UARCH != 'ia64'
 	extra_common_flags += [ '-fvar-tracking-assignments' ]
 endif
@@ -307,5 +309,5 @@
 uspace_as_prolog = ''
 
-subdir('meson' / 'arch' / h_arch)
+subdir('meson' / 'arch' / UARCH)
 
 subdir('kernel')
Index: meson/cross/amd64
===================================================================
--- meson/cross/amd64	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ meson/cross/amd64	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -17,5 +17,4 @@
 
 cc_arch = 'amd64'
-h_arch = 'amd64'
 bits = 64
 
Index: meson/cross/amd64_clang
===================================================================
--- meson/cross/amd64_clang	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ meson/cross/amd64_clang	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -17,5 +17,4 @@
 
 cc_arch = 'amd64'
-h_arch = 'amd64'
 bits = 64
 
Index: meson/cross/arm32
===================================================================
--- meson/cross/arm32	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ meson/cross/arm32	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -17,5 +17,4 @@
 
 cc_arch = 'arm'
-h_arch = 'arm32'
 bits = 32
 
Index: meson/cross/arm64
===================================================================
--- meson/cross/arm64	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ meson/cross/arm64	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -17,5 +17,4 @@
 
 cc_arch = 'aarch64'
-h_arch = 'arm64'
 bits = 64
 
Index: meson/cross/ia32
===================================================================
--- meson/cross/ia32	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ meson/cross/ia32	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -17,5 +17,4 @@
 
 cc_arch = 'i686'
-h_arch = 'ia32'
 bits = 32
 
Index: meson/cross/ia64
===================================================================
--- meson/cross/ia64	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ meson/cross/ia64	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -17,5 +17,4 @@
 
 cc_arch = 'ia64'
-h_arch = 'ia64'
 bits = 64
 
Index: meson/cross/mips32
===================================================================
--- meson/cross/mips32	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ meson/cross/mips32	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -17,5 +17,4 @@
 
 cc_arch = 'mipsel'
-h_arch = 'mips32'
 bits = 32
 
Index: meson/cross/mips32eb
===================================================================
--- meson/cross/mips32eb	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ meson/cross/mips32eb	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -17,5 +17,4 @@
 
 cc_arch = 'mips'
-h_arch = 'mips32'
 bits = 32
 
Index: meson/cross/ppc32
===================================================================
--- meson/cross/ppc32	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ meson/cross/ppc32	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -17,5 +17,4 @@
 
 cc_arch = 'ppc'
-h_arch = 'ppc32'
 bits = 32
 
Index: meson/cross/riscv64
===================================================================
--- meson/cross/riscv64	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ meson/cross/riscv64	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -17,5 +17,4 @@
 
 cc_arch = 'riscv64'
-h_arch = 'riscv64'
 bits = 64
 
Index: meson/cross/sparc64
===================================================================
--- meson/cross/sparc64	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ meson/cross/sparc64	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -17,5 +17,4 @@
 
 cc_arch = 'sparc64'
-h_arch = 'sparc64'
 bits = 64
 
Index: uspace/drv/meson.build
===================================================================
--- uspace/drv/meson.build	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ uspace/drv/meson.build	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -64,5 +64,5 @@
 
 # sun4u driver won't compile on 32-bit targets
-if h_arch == 'sparc64'
+if UARCH == 'sparc64'
 	drvs += 'platform/sun4u'
 endif
Index: pace/lib/c/arch/riscv64/Makefile.inc
===================================================================
--- uspace/lib/c/arch/riscv64/Makefile.inc	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#
-# Copyright (c) 2016 Martin Decky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-ARCH_SOURCES = \
-	arch/$(UARCH)/src/entryjmp.c \
-	arch/$(UARCH)/src/thread_entry.c \
-	arch/$(UARCH)/src/fibril.c \
-	arch/$(UARCH)/src/tls.c \
-	arch/$(UARCH)/src/syscall.c \
-	arch/$(UARCH)/src/stacktrace.c
-
-ARCH_AUTOCHECK_HEADERS = \
-	arch/$(UARCH)/include/libarch/fibril_context.h
Index: uspace/lib/c/arch/riscv64/meson.build
===================================================================
--- uspace/lib/c/arch/riscv64/meson.build	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ uspace/lib/c/arch/riscv64/meson.build	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -1,2 +1,30 @@
+#
+# Copyright (c) 2016 Martin Decky
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
 arch_src += [ autocheck.process('include/libarch/fibril_context.h') ]
 
Index: uspace/lib/c/meson.build
===================================================================
--- uspace/lib/c/meson.build	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ uspace/lib/c/meson.build	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -1,5 +1,5 @@
 # libarch
 arch_src = []
-subdir(join_paths('arch', h_arch))
+subdir('arch' / UARCH)
 
 c_args = [ '-fno-builtin', '-D_LIBC_SOURCE' ]
@@ -9,6 +9,6 @@
 incdirs = [
 	'include',
-	'arch' / h_arch / 'include',
-	root_path / 'abi' / 'arch' / h_arch / 'include',
+	'arch' / UARCH / 'include',
+	root_path / 'abi' / 'arch' / UARCH / 'include',
 	root_path / 'abi' / 'include',
 ]
Index: uspace/srv/loader/meson.build
===================================================================
--- uspace/srv/loader/meson.build	(revision 41408d9416b973ae77a095adf3dc309772bd1c56)
+++ uspace/srv/loader/meson.build	(revision 5f176da24d28494c81340ae9aed9fb8d6d7a36fa)
@@ -1,4 +1,4 @@
 
-if h_arch == 'ia64'
+if UARCH == 'ia64'
 	link_args += [ '-T', meson.current_source_dir() / 'elf64_ia64_loader.x' ]
 else
