kbuild: do not pick up CFLAGS from the environment
Too many people have CFLAGS set to support building userspace. And now Kbuild picks up CFLAGS this caused troubles. Although people should realise that setting CFLAGS has a 'global' effect the impact on the kernel build is a suprise. So change kbuild to pick up value from KCFLAGS that is much less used. When kbuild pick up a value it will warn like this: Makefile:544: "WARNING: Appending $KCFLAGS (-O3) from environment to kernel $CFLAGS" Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Thomas Bächler <thomas@archlinux.org> Cc: David Miller <davem@davemloft.net> Cc: Ingo Molnar <mingo@redhat.com>
This commit is contained in:
parent
b4f555081f
commit
69ee0b3522
1 changed files with 16 additions and 3 deletions
19
Makefile
19
Makefile
|
@ -528,9 +528,22 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
|
||||||
KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
|
KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
|
||||||
|
|
||||||
# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
|
# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
|
||||||
KBUILD_CPPFLAGS += $(CPPFLAGS)
|
# But warn user when we do so
|
||||||
KBUILD_AFLAGS += $(AFLAGS)
|
warn-assign = \
|
||||||
KBUILD_CFLAGS += $(CFLAGS)
|
$(warning "WARNING: Appending $$K$(1) ($(K$(1))) from $(origin K$(1)) to kernel $$$(1)")
|
||||||
|
|
||||||
|
ifneq ($(KCPPFLAGS),)
|
||||||
|
$(call warn-assign,CPPFLAGS)
|
||||||
|
KBUILD_CPPFLAGS += $(KCPPFLAGS)
|
||||||
|
endif
|
||||||
|
ifneq ($(KAFLAGS),)
|
||||||
|
$(call warn-assign,AFLAGS)
|
||||||
|
KBUILD_AFLAGS += $(KAFLAGS)
|
||||||
|
endif
|
||||||
|
ifneq ($(KCFLAGS),)
|
||||||
|
$(call warn-assign,CFLAGS)
|
||||||
|
KBUILD_CFLAGS += $(KCFLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
# Use --build-id when available.
|
# Use --build-id when available.
|
||||||
LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
|
LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
|
||||||
|
|
Loading…
Reference in a new issue