public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: David Miller <davem@davemloft.net>
Cc: mingo@elte.hu, bunk@kernel.org, thomas@archlinux.org,
	tglx@linutronix.de, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: 2.6.24-rc1-82798a1 compile failure (x86_64)
Date: Sun, 4 Nov 2007 12:16:40 +0100	[thread overview]
Message-ID: <20071104111640.GA17565@uranus.ravnborg.org> (raw)
In-Reply-To: <20071104.023133.241080055.davem@davemloft.net>

> I totally disagree.
> 
> People can't have it both ways.  CFLAGS has global meaning in every
> Makefile based build tree, it's not an "autoconf" thing.  This is well
> established practice, and I think it's a good thing the kernel does it
> now too.
> 
> If people set something like CFLAGS in their environment, they must
> understand what that means, and it means that universally it will
> influence your Makefile based builds.  Yes, this means all of them and
> even potentially the kernel build.
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)%,%,\

  reply	other threads:[~2007-11-04 11:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-29 21:46 2.6.24-rc1-82798a1 compile failure (x86_64) Thomas Bächler
2007-10-29 22:12 ` Thomas Gleixner
     [not found]   ` <47266BF6.6070206@archlinux.org>
     [not found]     ` <alpine.LFD.0.9999.0710300033470.3186@localhost.localdomain>
2007-10-30  9:10       ` Thomas Bächler
2007-11-03 10:04         ` Thomas Bächler
2007-11-03 12:11           ` Sam Ravnborg
2007-11-04  2:02             ` Adrian Bunk
2007-11-04 10:04               ` Ingo Molnar
2007-11-04 10:19                 ` Sam Ravnborg
2007-11-04 10:31                 ` David Miller
2007-11-04 11:16                   ` Sam Ravnborg [this message]
2007-11-04 12:27                     ` Thomas Bächler
2007-11-04 15:29                   ` Adrian Bunk
2007-11-04 15:55                     ` Oleg Verych
2007-11-04 16:19                     ` Giacomo Catenazzi
2007-11-04 16:34                       ` Adrian Bunk
2007-11-04 18:33                         ` Giacomo Catenazzi
2007-11-05  4:03                         ` David Miller
2007-11-04 18:10                     ` Sam Ravnborg
2007-11-05  4:01                     ` David Miller
2007-11-06 17:32               ` Arjan van de Ven
2007-11-07  0:12                 ` Adrian Bunk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071104111640.GA17565@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=akpm@linux-foundation.org \
    --cc=bunk@kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=thomas@archlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox