kbuild Makefile: allow checking if ARCH and CROSS_COMPILE is set

From: David Vrabel
Date: Thu Mar 03 2005 - 10:49:35 EST


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.

Signed-off-by: David Vrabel <dvrabel@xxxxxxxxx>

Index: linux-2.6-working/Makefile
===================================================================
--- linux-2.6-working.orig/Makefile 2005-03-03 15:03:33.177767998 +0000
+++ linux-2.6-working/Makefile 2005-03-03 15:21:44.366657764 +0000
@@ -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 ?=

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/