kbuild: fix -I option expansion with O=... builds

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Sunday, December 28, 2008 - 5:59 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5b91c3...
Commit:     5b91c33cf295d9c235f587f29a8c0a7ae15a5320
Parent:     f6f7b52e2f6149d2ee365717afff315b05720162
Author:     Sam Ravnborg <sam@ravnborg.org>
AuthorDate: Wed Dec 3 21:22:21 2008 +0100
Committer:  Sam Ravnborg <sam@ravnborg.org>
CommitDate: Wed Dec 3 21:22:21 2008 +0100

    kbuild: fix -I option expansion with O=... builds
    
    When adding extra -I options with O=... we could
    end up in a situation where there were no parameters to -I.
    So we had a commandline that looked like this:
    
        ... -I -Wall ...
    
    This had the undesired side effect that gcc assumed "-Wall"
    was a path to look for include files so this options was
    effectively ignored.
    
    This happens only when we build the generated module.mod.c files
    as part of the final modules builds and is as such harmless
    with current kbuild.
    This bug was exposed when we rearranged the options to gcc.
    
    Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 scripts/Kbuild.include |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 982dcae..936940b 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -144,7 +144,9 @@ ld-option = $(call try-run,\
 build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
 
 # Prefix -I with $(srctree) if it is not an absolute path.
-addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)
+# skip if -I has no parameter
+addtree = $(if $(patsubst -I%,%,$(1)), \
+$(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1))
 
 # Find all -I options and call addtree
 flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
kbuild: fix -I option expansion with O=... builds, Linux Kernel Mailing ..., (Sun Dec 28, 5:59 pm)