[PATCH] kbuild: Set NOSTDINC_FLAGS late to speed up compile (a little)
authorSam Ravnborg <sam@ravnborg.org>
Sat, 30 Apr 2005 23:51:42 +0000 (16:51 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 30 Apr 2005 23:51:42 +0000 (16:51 -0700)
Move definition of NOSTDINC_FLAGS below inclusion of arch Makefile, so
any arch specific settings to $(CC) takes effect before looking up the
compiler include directory.

The previous solution that replaced ':=' with '=' caused gcc to be
invoked one additional time for each directory visited.

This decreases kernel compile time with 0.1 second (3.6 -> 3.5 seconds) when
running make on a fully built kernel

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Makefile

index 8da3a306d0c0c070d87048d14a033df02f40a154..48990899db0d9a9506e72fe2fa79570c3b5a306b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -332,9 +332,7 @@ KALLSYMS    = scripts/kallsyms
 PERL           = perl
 CHECK          = sparse
 
-NOSTDINC_FLAGS  = -nostdinc -isystem $(shell $(CC) -print-file-name=include)
 CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__
-CHECKFLAGS     += $(NOSTDINC_FLAGS)
 MODFLAGS       = -DMODULE
 CFLAGS_MODULE   = $(MODFLAGS)
 AFLAGS_MODULE   = $(MODFLAGS)
@@ -531,6 +529,10 @@ endif
 
 include $(srctree)/arch/$(ARCH)/Makefile
 
+# arch Makefile may override CC so keep this after arch Makefile is included
+NOSTDINC_FLAGS := -nostdinc -isystem $(shell $(CC) -print-file-name=include)
+CHECKFLAGS     += $(NOSTDINC_FLAGS)
+
 # warn about C99 declaration after statement
 CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)