Re: 2.6.24-rc1-82798a1 compile failure (x86_64)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Sam Ravnborg
Date: Sunday, November 4, 2007 - 4:16 am

> I totally disagree.
I'm afraid some people do not realize a whit about what they do.
So at least we could let kbuild warn about it.
Something like this:

$ export CFLAGS=-O3
$ make AFLAGS=-fisk
Makefile:540: "Appending $AFLAGS (-fisk) from command line to kernel defined $AFLAGS"
Makefile:544: "Appending $CFLAGS (-O3) from environment to kernel defined $CFLAGS"
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CC      arch/x86/kernel/asm-offsets.s
  GEN     include/asm-x86/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CC      scripts/mod/empty.o


This patch is needed to do so.

If one does a make O=... build then they will see the warning(s) twice.

	Sam

diff --git a/Makefile b/Makefile
index 188c3b6..1ae8779 100644
--- a/Makefile
+++ b/Makefile
@@ -528,9 +528,22 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
 KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
 
 # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
-KBUILD_CPPFLAGS += $(CPPFLAGS)
-KBUILD_AFLAGS   += $(AFLAGS)
-KBUILD_CFLAGS   += $(CFLAGS)
+# But warn user when we do so
+warn-assign = \
+$(warning "Appending $$$(1) ($($(1))) from $(origin $(1)) to kernel defined $$$(1)")
+
+ifneq ($(CPPFLAGS),)
+        $(call warn-assign,CPPFLAGS)
+        KBUILD_CPPFLAGS += $(CPPFLAGS)
+endif
+ifneq ($(AFLAGS),)
+        $(call warn-assign,AFLAGS)
+        KBUILD_AFLAGS += $(AFLAGS)
+endif
+ifneq ($(CFLAGS),)
+        $(call warn-assign,CFLAGS)
+        KBUILD_CFLAGS += $(CFLAGS)
+endif
 
 # Use --build-id when available.
 LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Thomas Bächler, (Tue Oct 30, 2:10 am)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Thomas Bächler, (Sat Nov 3, 3:04 am)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Sam Ravnborg, (Sat Nov 3, 5:11 am)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Adrian Bunk, (Sat Nov 3, 7:02 pm)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Ingo Molnar, (Sun Nov 4, 3:04 am)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Sam Ravnborg, (Sun Nov 4, 3:19 am)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), David Miller, (Sun Nov 4, 3:31 am)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Sam Ravnborg, (Sun Nov 4, 4:16 am)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Thomas Bächler, (Sun Nov 4, 5:27 am)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Adrian Bunk, (Sun Nov 4, 8:29 am)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Oleg Verych, (Sun Nov 4, 8:55 am)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Giacomo Catenazzi, (Sun Nov 4, 9:19 am)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Adrian Bunk, (Sun Nov 4, 9:34 am)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Sam Ravnborg, (Sun Nov 4, 11:10 am)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Giacomo Catenazzi, (Sun Nov 4, 11:33 am)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), David Miller, (Sun Nov 4, 9:01 pm)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), David Miller, (Sun Nov 4, 9:03 pm)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Arjan van de Ven, (Tue Nov 6, 10:32 am)
Re: 2.6.24-rc1-82798a1 compile failure (x86_64), Adrian Bunk, (Tue Nov 6, 5:12 pm)