Makefile: include per-arch Makefile before Makefile.flags
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Fri, 14 Jul 2017 21:08:38 +0000 (23:08 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sat, 15 Jul 2017 09:53:53 +0000 (11:53 +0200)
Makefile.flags contains:

ARCH_FPIC ?= -fpic
ARCH_FPIE ?= -fpie

However, arch/$(ARCH)/Makefile gets included *after* Makefile.flags,
and therefore doesn't get the chance to provide its own value.

Fix this by including arch/$(ARCH)/Makefile *before* Makefile.flags.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Makefile

index 9c316e9d018ce6802af03b7d5ef848f68228e44c..0a5f869299c84a28f3d6ee8da3493e605fe39042 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -508,6 +508,8 @@ ifeq ($(dot-config),1)
 # To avoid any implicit rule to kick in, define an empty command
 .config .kconfig.d: ;
 
+-include $(srctree)/arch/$(ARCH)/Makefile
+
 # Now we can define CFLAGS etc according to .config
 include $(srctree)/Makefile.flags
 
@@ -531,8 +533,6 @@ endif
 # Defaults busybox but it is usually overridden in the arch makefile
 all: busybox doc
 
--include $(srctree)/arch/$(ARCH)/Makefile
-
 # arch Makefile may override CC so keep this after arch Makefile is included
 #bbox# NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
 CHECKFLAGS += $(NOSTDINC_FLAGS)