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]>
Makefile +13 -0
@@ -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 ?=