Skip to contentSkip to conversation

kbuild Makefile: allow checking if ARCH and CROSS_COMPILE is set

PATCH David Vrabel 1 participant 1 message Mar 3, 2005 Kbuild

lore
Share & tools
lore
#0 lore raw

Hi,

It can be useful for distributors for kernel source trees intended for cross-compilation only (e.g., for embedded targets) to ensure the user has set ARCH and CROSS_COMPILE.

This patch allows one to create the file .force-cross-compile containing the word "yes" to enable such a test.

Makefile +13 -0
Index: linux-2.6-working/Makefile
===================================================================
@@ -189,6 +189,19 @@
 # Default value for CROSS_COMPILE is not to prefix executables
 # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
 
+# Creating the file .force-cross-compile containing the word "yes"
+# will ensure the user specifies ARCH and CROSS_COMPILE.  This is
+# handy for distributers of kernel trees intended for
+# cross-compilation only.
+ifeq ($(shell cat .force-cross-compile),yes)
+  ifeq ($(ARCH),)
+    $(error ARCH is unset)
+  endif
+  ifeq ($(CROSS_COMPILE),)
+    $(error CROSS_COMPILE is unset)
+  endif
+endif
+
 ARCH		?= $(SUBARCH)
 CROSS_COMPILE	?=