From: Bodo Eggert <7eggert@gmx.de> If you build using O=builddir ARCH=bar, you'll currently need to supply ARCH= on builds from the builddir, too. With this patch, the generated Makefile will do that instead. make ARCH= will still override the Makefile default, allowing existing scripts to work correctly. Signed-off-by: Bodo Eggert <7eggert@gmx.de> Cc: Tony Breeds Cc: Sam Ravnborg Signed-off-by: Andrew Morton --- Makefile | 2 +- scripts/mkmakefile | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff -puN Makefile~mkmakefile-include-arch-on-o=-builds Makefile --- a/Makefile~mkmakefile-include-arch-on-o=-builds +++ a/Makefile @@ -358,7 +358,7 @@ PHONY += outputmakefile outputmakefile: ifneq ($(KBUILD_SRC),) $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ - $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) + $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) $(ARCH) endif # To make sure we do not include .config for any of the *config targets diff -puN scripts/mkmakefile~mkmakefile-include-arch-on-o=-builds scripts/mkmakefile --- a/scripts/mkmakefile~mkmakefile-include-arch-on-o=-builds +++ a/scripts/mkmakefile @@ -8,6 +8,7 @@ # $2 - Output directory # $3 - version # $4 - patchlevel +# $5 - arch test ! -r $2/Makefile -o -O $2/Makefile || exit 0 @@ -21,16 +22,17 @@ PATCHLEVEL = $4 KERNELSRC := $1 KERNELOUTPUT := $2 +ARCH := $5 MAKEFLAGS += --no-print-directory .PHONY: all \$(MAKECMDGOALS) all: - \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) + \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) ARCH=\$(ARCH) Makefile:; \$(filter-out all Makefile,\$(MAKECMDGOALS)) %/: - \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$@ + \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) ARCH=\$(ARCH) \$@ EOF _