Commit e8e6993178344eb348f60f05b16d9dc30db3b9cf
Committed by
Linus Torvalds
1 parent
b3d9ae4b98
Exists in
master
and in
7 other branches
[PATCH] kbuild: Set NOSTDINC_FLAGS late to speed up compile (a little)
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>
Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff
Makefile
... | ... | @@ -332,9 +332,7 @@ |
332 | 332 | PERL = perl |
333 | 333 | CHECK = sparse |
334 | 334 | |
335 | -NOSTDINC_FLAGS = -nostdinc -isystem $(shell $(CC) -print-file-name=include) | |
336 | 335 | CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ |
337 | -CHECKFLAGS += $(NOSTDINC_FLAGS) | |
338 | 336 | MODFLAGS = -DMODULE |
339 | 337 | CFLAGS_MODULE = $(MODFLAGS) |
340 | 338 | AFLAGS_MODULE = $(MODFLAGS) |
... | ... | @@ -530,6 +528,10 @@ |
530 | 528 | endif |
531 | 529 | |
532 | 530 | include $(srctree)/arch/$(ARCH)/Makefile |
531 | + | |
532 | +# arch Makefile may override CC so keep this after arch Makefile is included | |
533 | +NOSTDINC_FLAGS := -nostdinc -isystem $(shell $(CC) -print-file-name=include) | |
534 | +CHECKFLAGS += $(NOSTDINC_FLAGS) | |
533 | 535 | |
534 | 536 | # warn about C99 declaration after statement |
535 | 537 | CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) |