diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-14 13:12:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-14 13:12:46 -0400 |
commit | 3b7b3e6ec5f56118046594d3c62469e7d1d0aadd (patch) | |
tree | 3a6eb410ee27b660b7c085c81619f9e69fb5f0fa /scripts | |
parent | e3b1fd56f175526db42ae94c457f29c2fa810aca (diff) | |
parent | 164f0d2efaaef835473e74b162eae750341d6a8c (diff) |
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild updates from Michal Marek:
- make clean also considers $(extra-m) and $(extra-) to be consistent
- cleanup and fixes in scripts/Makefile.host
- allow to override the name of the Python 2 executable with make
PYTHON=... (only needed for ia64 in practice)
- option to split debugingo into *.dwo files to save disk space if the
compiler supports it (CONFIG_DEBUG_INFO_SPLIT)
- option to use dwarf4 debuginfo if the compiler supports it
(CONFIG_DEBUG_INFO_DWARF4)
- fix for disabling certain warnings with clang
- fix for unneeded rebuild with dash when a command contains
backslashes
* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
kbuild: Fix handling of backslashes in *.cmd files
kbuild, LLVMLinux: Supress warnings unless W=1-3
Kbuild: Add a option to enable dwarf4 v2
kbuild: Support split debug info v4
kbuild: allow to override Python command name
kbuild: clean-up and bug fix of scripts/Makefile.host
kbuild: clean up scripts/Makefile.host
kbuild: drop shared library support from Makefile.host
kbuild: fix a bug of C++ host program handling
kbuild: fix a typo in scripts/Makefile.host
scripts/Makefile.clean: clean also $(extra-m) and $(extra-)
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Kbuild.include | 14 | ||||
-rw-r--r-- | scripts/Makefile.clean | 4 | ||||
-rw-r--r-- | scripts/Makefile.extrawarn | 21 | ||||
-rw-r--r-- | scripts/Makefile.host | 61 |
4 files changed, 30 insertions, 70 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 122f95c95869..8a9a4e1c7eab 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -215,11 +215,13 @@ else | |||
215 | arg-check = $(if $(strip $(cmd_$@)),,1) | 215 | arg-check = $(if $(strip $(cmd_$@)),,1) |
216 | endif | 216 | endif |
217 | 217 | ||
218 | # >'< substitution is for echo to work, | 218 | # Replace >$< with >$$< to preserve $ when reloading the .cmd file |
219 | # >$< substitution to preserve $ when reloading .cmd file | 219 | # (needed for make) |
220 | # note: when using inline perl scripts [perl -e '...$$t=1;...'] | 220 | # Replace >#< with >\#< to avoid starting a comment in the .cmd file |
221 | # in $(cmd_xxx) double $$ your perl vars | 221 | # (needed for make) |
222 | make-cmd = $(subst \\,\\\\,$(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1)))))) | 222 | # Replace >'< with >'\''< to be able to enclose the whole string in '...' |
223 | # (needed for the shell) | ||
224 | make-cmd = $(call escsq,$(subst \#,\\\#,$(subst $$,$$$$,$(cmd_$(1))))) | ||
223 | 225 | ||
224 | # Find any prerequisites that is newer than target or that does not exist. | 226 | # Find any prerequisites that is newer than target or that does not exist. |
225 | # PHONY targets skipped in both cases. | 227 | # PHONY targets skipped in both cases. |
@@ -230,7 +232,7 @@ any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^) | |||
230 | if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ | 232 | if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ |
231 | @set -e; \ | 233 | @set -e; \ |
232 | $(echo-cmd) $(cmd_$(1)); \ | 234 | $(echo-cmd) $(cmd_$(1)); \ |
233 | echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd) | 235 | printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd) |
234 | 236 | ||
235 | # Execute the command and also postprocess generated .d dependencies file. | 237 | # Execute the command and also postprocess generated .d dependencies file. |
236 | if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ | 238 | if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ |
diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 686cb0d31c7c..a651cee84f2a 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean | |||
@@ -40,8 +40,8 @@ subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) | |||
40 | # build a list of files to remove, usually relative to the current | 40 | # build a list of files to remove, usually relative to the current |
41 | # directory | 41 | # directory |
42 | 42 | ||
43 | __clean-files := $(extra-y) $(always) \ | 43 | __clean-files := $(extra-y) $(extra-m) $(extra-) \ |
44 | $(targets) $(clean-files) \ | 44 | $(always) $(targets) $(clean-files) \ |
45 | $(host-progs) \ | 45 | $(host-progs) \ |
46 | $(hostprogs-y) $(hostprogs-m) $(hostprogs-) | 46 | $(hostprogs-y) $(hostprogs-m) $(hostprogs-) |
47 | 47 | ||
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 65643506c71c..f734033af219 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn | |||
@@ -26,16 +26,6 @@ warning-1 += $(call cc-option, -Wmissing-include-dirs) | |||
26 | warning-1 += $(call cc-option, -Wunused-but-set-variable) | 26 | warning-1 += $(call cc-option, -Wunused-but-set-variable) |
27 | warning-1 += $(call cc-disable-warning, missing-field-initializers) | 27 | warning-1 += $(call cc-disable-warning, missing-field-initializers) |
28 | 28 | ||
29 | # Clang | ||
30 | warning-1 += $(call cc-disable-warning, initializer-overrides) | ||
31 | warning-1 += $(call cc-disable-warning, unused-value) | ||
32 | warning-1 += $(call cc-disable-warning, format) | ||
33 | warning-1 += $(call cc-disable-warning, unknown-warning-option) | ||
34 | warning-1 += $(call cc-disable-warning, sign-compare) | ||
35 | warning-1 += $(call cc-disable-warning, format-zero-length) | ||
36 | warning-1 += $(call cc-disable-warning, uninitialized) | ||
37 | warning-1 += $(call cc-option, -fcatch-undefined-behavior) | ||
38 | |||
39 | warning-2 := -Waggregate-return | 29 | warning-2 := -Waggregate-return |
40 | warning-2 += -Wcast-align | 30 | warning-2 += -Wcast-align |
41 | warning-2 += -Wdisabled-optimization | 31 | warning-2 += -Wdisabled-optimization |
@@ -64,4 +54,15 @@ ifeq ("$(strip $(warning))","") | |||
64 | endif | 54 | endif |
65 | 55 | ||
66 | KBUILD_CFLAGS += $(warning) | 56 | KBUILD_CFLAGS += $(warning) |
57 | else | ||
58 | |||
59 | ifeq ($(COMPILER),clang) | ||
60 | KBUILD_CFLAGS += $(call cc-disable-warning, initializer-overrides) | ||
61 | KBUILD_CFLAGS += $(call cc-disable-warning, unused-value) | ||
62 | KBUILD_CFLAGS += $(call cc-disable-warning, format) | ||
63 | KBUILD_CFLAGS += $(call cc-disable-warning, unknown-warning-option) | ||
64 | KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare) | ||
65 | KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length) | ||
66 | KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized) | ||
67 | endif | ||
67 | endif | 68 | endif |
diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 66893643fd7d..ab5980f91714 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host | |||
@@ -20,21 +20,12 @@ | |||
20 | # Will compile qconf as a C++ program, and menu as a C program. | 20 | # Will compile qconf as a C++ program, and menu as a C program. |
21 | # They are linked as C++ code to the executable qconf | 21 | # They are linked as C++ code to the executable qconf |
22 | 22 | ||
23 | # hostprogs-y := conf | ||
24 | # conf-objs := conf.o libkconfig.so | ||
25 | # libkconfig-objs := expr.o type.o | ||
26 | # Will create a shared library named libkconfig.so that consists of | ||
27 | # expr.o and type.o (they are both compiled as C code and the object files | ||
28 | # are made as position independent code). | ||
29 | # conf.c is compiled as a C program, and conf.o is linked together with | ||
30 | # libkconfig.so as the executable conf. | ||
31 | # Note: Shared libraries consisting of C++ files are not supported | ||
32 | |||
33 | __hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) | 23 | __hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) |
34 | 24 | ||
35 | # C code | 25 | # C code |
36 | # Executables compiled from a single .c file | 26 | # Executables compiled from a single .c file |
37 | host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m))) | 27 | host-csingle := $(foreach m,$(__hostprogs), \ |
28 | $(if $($(m)-objs)$($(m)-cxxobjs),,$(m))) | ||
38 | 29 | ||
39 | # C executables linked based on several .o files | 30 | # C executables linked based on several .o files |
40 | host-cmulti := $(foreach m,$(__hostprogs),\ | 31 | host-cmulti := $(foreach m,$(__hostprogs),\ |
@@ -44,33 +35,17 @@ host-cmulti := $(foreach m,$(__hostprogs),\ | |||
44 | host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs))) | 35 | host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs))) |
45 | 36 | ||
46 | # C++ code | 37 | # C++ code |
47 | # C++ executables compiled from at least on .cc file | 38 | # C++ executables compiled from at least one .cc file |
48 | # and zero or more .c files | 39 | # and zero or more .c files |
49 | host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m))) | 40 | host-cxxmulti := $(foreach m,$(__hostprogs),$(if $($(m)-cxxobjs),$(m))) |
50 | 41 | ||
51 | # C++ Object (.o) files compiled from .cc files | 42 | # C++ Object (.o) files compiled from .cc files |
52 | host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) | 43 | host-cxxobjs := $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs))) |
53 | 44 | ||
54 | # Shared libaries (only .c supported) | ||
55 | # Shared libraries (.so) - all .so files referenced in "xxx-objs" | ||
56 | host-cshlib := $(sort $(filter %.so, $(host-cobjs))) | ||
57 | # Remove .so files from "xxx-objs" | ||
58 | host-cobjs := $(filter-out %.so,$(host-cobjs)) | ||
59 | |||
60 | #Object (.o) files used by the shared libaries | ||
61 | host-cshobjs := $(sort $(foreach m,$(host-cshlib),$($(m:.so=-objs)))) | ||
62 | |||
63 | # output directory for programs/.o files | 45 | # output directory for programs/.o files |
64 | # hostprogs-y := tools/build may have been specified. Retrieve directory | 46 | # hostprogs-y := tools/build may have been specified. |
65 | host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) | 47 | # Retrieve also directory of .o files from prog-objs or prog-cxxobjs notation |
66 | # directory of .o files from prog-objs notation | 48 | host-objdirs := $(dir $(__hostprogs) $(host-cobjs) $(host-cxxobjs)) |
67 | host-objdirs += $(foreach f,$(host-cmulti), \ | ||
68 | $(foreach m,$($(f)-objs), \ | ||
69 | $(if $(dir $(m)),$(dir $(m))))) | ||
70 | # directory of .o files from prog-cxxobjs notation | ||
71 | host-objdirs += $(foreach f,$(host-cxxmulti), \ | ||
72 | $(foreach m,$($(f)-cxxobjs), \ | ||
73 | $(if $(dir $(m)),$(dir $(m))))) | ||
74 | 49 | ||
75 | host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs)))) | 50 | host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs)))) |
76 | 51 | ||
@@ -81,8 +56,6 @@ host-cmulti := $(addprefix $(obj)/,$(host-cmulti)) | |||
81 | host-cobjs := $(addprefix $(obj)/,$(host-cobjs)) | 56 | host-cobjs := $(addprefix $(obj)/,$(host-cobjs)) |
82 | host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti)) | 57 | host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti)) |
83 | host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs)) | 58 | host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs)) |
84 | host-cshlib := $(addprefix $(obj)/,$(host-cshlib)) | ||
85 | host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs)) | ||
86 | host-objdirs := $(addprefix $(obj)/,$(host-objdirs)) | 59 | host-objdirs := $(addprefix $(obj)/,$(host-objdirs)) |
87 | 60 | ||
88 | obj-dirs += $(host-objdirs) | 61 | obj-dirs += $(host-objdirs) |
@@ -123,7 +96,7 @@ quiet_cmd_host-cmulti = HOSTLD $@ | |||
123 | cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \ | 96 | cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \ |
124 | $(addprefix $(obj)/,$($(@F)-objs)) \ | 97 | $(addprefix $(obj)/,$($(@F)-objs)) \ |
125 | $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) | 98 | $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) |
126 | $(host-cmulti): $(obj)/%: $(host-cobjs) $(host-cshlib) FORCE | 99 | $(host-cmulti): $(obj)/%: $(host-cobjs) FORCE |
127 | $(call if_changed,host-cmulti) | 100 | $(call if_changed,host-cmulti) |
128 | 101 | ||
129 | # Create .o file from a single .c file | 102 | # Create .o file from a single .c file |
@@ -140,7 +113,7 @@ quiet_cmd_host-cxxmulti = HOSTLD $@ | |||
140 | $(foreach o,objs cxxobjs,\ | 113 | $(foreach o,objs cxxobjs,\ |
141 | $(addprefix $(obj)/,$($(@F)-$(o)))) \ | 114 | $(addprefix $(obj)/,$($(@F)-$(o)))) \ |
142 | $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) | 115 | $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) |
143 | $(host-cxxmulti): $(obj)/%: $(host-cobjs) $(host-cxxobjs) $(host-cshlib) FORCE | 116 | $(host-cxxmulti): $(obj)/%: $(host-cobjs) $(host-cxxobjs) FORCE |
144 | $(call if_changed,host-cxxmulti) | 117 | $(call if_changed,host-cxxmulti) |
145 | 118 | ||
146 | # Create .o file from a single .cc (C++) file | 119 | # Create .o file from a single .cc (C++) file |
@@ -149,21 +122,5 @@ quiet_cmd_host-cxxobjs = HOSTCXX $@ | |||
149 | $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE | 122 | $(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE |
150 | $(call if_changed_dep,host-cxxobjs) | 123 | $(call if_changed_dep,host-cxxobjs) |
151 | 124 | ||
152 | # Compile .c file, create position independent .o file | ||
153 | # host-cshobjs -> .o | ||
154 | quiet_cmd_host-cshobjs = HOSTCC -fPIC $@ | ||
155 | cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $< | ||
156 | $(host-cshobjs): $(obj)/%.o: $(src)/%.c FORCE | ||
157 | $(call if_changed_dep,host-cshobjs) | ||
158 | |||
159 | # Link a shared library, based on position independent .o files | ||
160 | # *.o -> .so shared library (host-cshlib) | ||
161 | quiet_cmd_host-cshlib = HOSTLLD -shared $@ | ||
162 | cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \ | ||
163 | $(addprefix $(obj)/,$($(@F:.so=-objs))) \ | ||
164 | $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) | ||
165 | $(host-cshlib): $(obj)/%: $(host-cshobjs) FORCE | ||
166 | $(call if_changed,host-cshlib) | ||
167 | |||
168 | targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\ | 125 | targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\ |
169 | $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs) | 126 | $(host-cxxmulti) $(host-cxxobjs) |