2005-03-03 15:47:58

by David Vrabel

[permalink] [raw]
Subject: kbuild Makefile: allow checking if ARCH and CROSS_COMPILE is set

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 <[email protected]>

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 ?=