Index: meson/part/read_config/meson.build
===================================================================
--- meson/part/read_config/meson.build	(revision c21d4d64870698b91707f203def6398db79bff84)
+++ meson/part/read_config/meson.build	(revision e9ff39b80435c39ebacaa3bf4cfc3a48211d6580)
@@ -49,5 +49,7 @@
 	'CONFIG_USE_SHARED_LIBS',
 	'CROSS_TARGET',
+	'MACHINE',
 	'OPTIMIZATION',
+	'PLATFORM',
 	'PROCESSOR',
 	'QUADFLOAT',
@@ -94,5 +96,4 @@
 	'CONFIG_UDEBUG',
 	'CONFIG_VIA_CUDA',
-	'MACHINE',
 	'MEMORY_MODEL',
 
@@ -143,2 +144,19 @@
 	endif
 endforeach
+
+# Check whether PLATFORM/MACHINE is unchanged
+
+_profile = '@0@/@1@'.format(PLATFORM, MACHINE)
+_profile_file = meson.build_root() / 'prev_profile'
+
+_cmd = run_command('cat', _profile_file)
+if _cmd.returncode() == 0
+	_prev_profile = _cmd.stdout().strip()
+
+	if _prev_profile != _profile
+		error('This build directory was initially configured for ' + _prev_profile +
+			', but now is configured for ' + _profile + '. This is not supported.')
+	endif
+else
+	run_command('sh', '-c', 'echo "' + _profile + '" > ' + _profile_file, check: true)
+endif
