public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: kbuild <linux-kbuild@vger.kernel.org>,
	lkml <linux-kernel@vger.kernel.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Subject: [PATCH 02/26] kbuild: expand -I in KBUILD_CPPFLAGS
Date: Sat, 20 Dec 2008 15:31:13 +0100	[thread overview]
Message-ID: <1229783497-19550-2-git-send-email-sam@ravnborg.org> (raw)
In-Reply-To: <20081220142518.GA19390@uranus.ravnborg.org>

kbuild failed to expand include flags in KBUILD_CPPFLAGS
resulting in code like this in arch Makefiles:

ifeq ($(KBUILD_SRC),)
KBUILD_CPPFLAGS += -Iinclude/foo
else
KBUILD_CPPFLAGS += -I$(srctree)/include/foo
endif

Move use of LINUXINCLUDE into Makefile.lib to allow
us to expand -I directives of KBUILD_CPPFLAGS so
we can avoid the above code.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 Makefile             |    4 ++--
 scripts/Makefile.lib |   15 +++++++++------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 9a49960..3075586 100644
--- a/Makefile
+++ b/Makefile
@@ -336,7 +336,7 @@ LINUXINCLUDE    := -Iinclude \
                    -I$(srctree)/arch/$(hdr-arch)/include               \
                    -include include/linux/autoconf.h
 
-KBUILD_CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
+KBUILD_CPPFLAGS := -D__KERNEL__
 
 KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
 		   -fno-strict-aliasing -fno-common \
@@ -1638,7 +1638,7 @@ cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \
                   $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*)
 
 a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \
-	  $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \
+	  $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(KBUILD_CPPFLAGS) \
 	  $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o)
 
 quiet_cmd_as_o_S = AS      $@
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index b4ca38a..e063657 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -104,9 +104,11 @@ else
 debug_flags =
 endif
 
-orig_c_flags   = $(KBUILD_CFLAGS) $(ccflags-y) $(CFLAGS_$(basetarget).o)
+orig_c_flags   = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)                     \
+                 $(ccflags-y) $(CFLAGS_$(basetarget).o)
 _c_flags       = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(orig_c_flags))
-_a_flags       = $(KBUILD_AFLAGS) $(asflags-y) $(AFLAGS_$(basetarget).o)
+_a_flags       = $(KBUILD_CPPFLAGS) $(KBUILD_AFLAGS)                     \
+                 $(asflags-y) $(AFLAGS_$(basetarget).o)
 _cpp_flags     = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(@F))
 
 # If building the kernel in a separate objtree expand all occurrences
@@ -127,15 +129,16 @@ __a_flags	=                          $(call flags,_a_flags)
 __cpp_flags     =                          $(call flags,_cpp_flags)
 endif
 
-c_flags        = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \
-		 $(__c_flags) $(modkern_cflags) \
+c_flags        = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \
+		 $(__c_flags) $(modkern_cflags)                           \
 		 -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) \
 		  $(debug_flags)
 
-a_flags        = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \
+a_flags        = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \
 		 $(__a_flags) $(modkern_aflags)
 
-cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(__cpp_flags)
+cpp_flags      = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \
+		 $(__cpp_flags)
 
 ld_flags       = $(LDFLAGS) $(ldflags-y)
 
-- 
1.6.0.2.GIT


  parent reply	other threads:[~2008-12-20 14:30 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-20 14:25 kbuild-next content Sam Ravnborg
2008-12-20 14:31 ` [PATCH 01/26] kbuild: fix -I option expansion with O=... builds Sam Ravnborg
2008-12-20 14:31 ` Sam Ravnborg [this message]
2008-12-20 14:31 ` [PATCH 03/26] kbuild: kill output in silent mode of mkcompile_h Sam Ravnborg
2008-12-20 14:31 ` [PATCH 04/26] kbuild: introduce $(kecho) convenience echo Sam Ravnborg
2008-12-20 15:13   ` Vegard Nossum
2008-12-20 19:25     ` Sam Ravnborg
2008-12-20 22:35       ` Vegard Nossum
2008-12-21 21:01   ` Mike Frysinger
2008-12-22 18:49   ` Randy Dunlap
2008-12-20 14:31 ` [PATCH 05/26] kbuild: use KECHO " Sam Ravnborg
2008-12-20 14:31 ` [PATCH 06/26] kbuild: teach mkmakfile to be silent Sam Ravnborg
2008-12-20 14:31 ` [PATCH 07/26] remove bashisms from scripts/extract-ikconfig Sam Ravnborg
2008-12-20 14:31 ` [PATCH 08/26] kbuild: gen_init_cpio expands shell variables in file names Sam Ravnborg
2008-12-20 14:31 ` [PATCH 09/26] kconfig: fix options to check-lxdialog.sh Sam Ravnborg
2008-12-20 14:31 ` [PATCH 10/26] tags and cscope support really belongs in a shell script Sam Ravnborg
2008-12-20 14:31 ` [PATCH 11/26] genksyms: track symbol checksum changes Sam Ravnborg
2008-12-20 14:31 ` [PATCH 12/26] genksyms: allow to ignore " Sam Ravnborg
2008-12-20 14:31 ` [PATCH 13/26] scripts/package: allow custom options to rpm Sam Ravnborg
2008-12-20 14:31 ` [PATCH 14/26] scripts: improve the decodecode script Sam Ravnborg
2008-12-20 14:31 ` [PATCH 15/26] setlocalversion: print correct subversion revision Sam Ravnborg
2008-12-20 14:31 ` [PATCH 16/26] setlocalversion: add git-svn support Sam Ravnborg
2008-12-20 14:31 ` [PATCH 17/26] kbuild: remove TAR_IGNORE Sam Ravnborg
2008-12-20 14:31 ` [PATCH 18/26] kbuild: fix make incompatibility Sam Ravnborg
2008-12-20 14:31 ` [PATCH 19/26] kbuild: fix make tags/cscope Sam Ravnborg
2008-12-20 14:31 ` [PATCH 20/26] kbuild: fix string equality testing in tags.sh Sam Ravnborg
2008-12-20 14:31 ` [PATCH 21/26] kbuild: add headerdep used to detect inclusion cycles in header files Sam Ravnborg
2008-12-20 14:31 ` [PATCH 22/26] kernel-doc: check for extra kernel-doc notations Sam Ravnborg
2008-12-20 14:31 ` [PATCH 23/26] kbuild: simplify use of genksyms Sam Ravnborg
2008-12-20 14:31 ` [PATCH 24/26] kbuild: strip generated symbols from *.ko Sam Ravnborg
2008-12-20 14:31 ` [PATCH 25/26] allow stripping of generated symbols under CONFIG_KALLSYMS_ALL Sam Ravnborg
2008-12-20 14:31 ` [PATCH 26/26] kbuild: support switching source directories with O=.. builds Sam Ravnborg
2008-12-20 16:34   ` Andi Kleen
2008-12-20 22:31     ` Sam Ravnborg

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=1229783497-19550-2-git-send-email-sam@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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