Index: .gitignore
===================================================================
--- .gitignore	(revision 667c3fcabb18fdbfeb86c021b882093c9fe139bc)
+++ .gitignore	(revision 56440a5727e948c740e9ce3665218dfeb5e62fb3)
@@ -1,3 +1,4 @@
 /build
+/build_all
 /doxygen/html
 /doxygen/latex
Index: build_all.sh
===================================================================
--- build_all.sh	(revision 56440a5727e948c740e9ce3665218dfeb5e62fb3)
+++ build_all.sh	(revision 56440a5727e948c740e9ce3665218dfeb5e62fb3)
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+# Find out the path to the script.
+SOURCE_DIR=`which -- "$0" 2>/dev/null`
+# Maybe we are running bash.
+[ -z "$SOURCE_DIR" ] && SOURCE_DIR=`which -- "$BASH_SOURCE"`
+[ -z "$SOURCE_DIR" ] && exit 1
+SOURCE_DIR=`dirname -- "$SOURCE_DIR"`
+SOURCE_DIR=`cd $SOURCE_DIR && echo $PWD`
+
+# Make sure we don't make a mess in the source root.
+if [ "$PWD" = "$SOURCE_DIR" ]; then
+	mkdir -p build_all
+	cd build_all
+fi
+
+CONFIG_RULES="${SOURCE_DIR}/HelenOS.config"
+CONFIG_DEFAULTS="${SOURCE_DIR}/defaults"
+
+# Find all the leaf subdirectories in the defaults directory.
+PROFILES=`find ${CONFIG_DEFAULTS} -type d -links 2 -printf "%P\n" | sort`
+
+
+echo "Configuring all profiles."
+
+for profile in $PROFILES; do
+	if [ -f ${profile}/build.ninja ]; then
+		echo "Profile ${profile} already configured."
+		continue
+	fi
+
+	echo "Configuring profile ${profile}"
+
+	# Let HelenOS config tool write out Makefile.config and config.h.
+	mkdir -p ${profile} || exit 1
+	cd ${profile} || exit 1
+	${SOURCE_DIR}/tools/config.py ${CONFIG_RULES} ${CONFIG_DEFAULTS} hands-off ${profile} || exit 1
+	cd -
+
+
+	if [ "$profile" = 'special/abs32le' ]; then
+		cross_target='ia32'
+	else
+		cross_target=`dirname $profile`
+		if [ "$cross_target" = '.' ]; then
+			cross_target=$profile
+		fi
+	fi
+
+	meson ${SOURCE_DIR} ${profile} --cross-file ${SOURCE_DIR}/meson/cross/${cross_target} || exit 1
+done
+
+
+echo "Building all profiles."
+
+for profile in $PROFILES; do
+	ninja -C ${profile}
+done
Index: meson.build
===================================================================
--- meson.build	(revision 667c3fcabb18fdbfeb86c021b882093c9fe139bc)
+++ meson.build	(revision 56440a5727e948c740e9ce3665218dfeb5e62fb3)
@@ -11,4 +11,7 @@
 )
 
+debug_options = false
+debug_shell_scripts = false
+
 if not meson.is_cross_build()
 	subdir('doxygen')
@@ -18,18 +21,22 @@
 cc = meson.get_compiler('c')
 basename = find_program('basename')
+cp = find_program('cp')
 dirname = find_program('dirname')
 find = find_program('find')
 grep = find_program('grep')
 mkarray = find_program('tools/mkarray_for_meson.sh')
+mkext4 = find_program('tools/mkext4.py')
+mkfat = find_program('tools/mkfat.py')
+mkuimage = find_program('tools/mkuimage.py')
+objcopy = find_program('objcopy')
 objdump = find_program('objdump')
-objcopy = find_program('objcopy')
 sed = find_program('sed')
 unzip = find_program('unzip')
 which = find_program('which')
-sh = [ find_program('sh'), '-x', '-u', '-e' ]
-mkext4 = find_program('tools/mkext4.py')
-mkfat = find_program('tools/mkfat.py')
-mkuimage = find_program('tools/mkuimage.py')
-cp = find_program('cp')
+
+sh = [ find_program('sh'), '-u', '-e' ]
+if debug_shell_scripts
+	sh += '-x'
+endif
 
 genisoimage = find_program('genisoimage', required: false)
@@ -82,6 +89,4 @@
 	'@INPUT@',
 ]
-
-debug_options = false
 
 # Output compiler flags for use by third-party builds.
