Commit cb6e7b0db9eb602c0cd8a704957619909bdfdb1b

Authored by Masahiro Yamada
Committed by Tom Rini
1 parent 87e90729ea

kbuild: improve multi-objs dependency and cleanups

Since Linux 3.18-rc1, Kbuild is able to handle multi-objs
dependency correctly, which also allows us futher cleanups
of some makefiles.

This commit imports those commits:

[1] commit c8589d1e9e01 by Masahiro Yamada
kbuild: handle multi-objs dependency appropriately

[2] commit 97e3226e6e98 by Masahiro Yamada
kbuild: handle the dependency of multi-objs hostprogs appropriately

[3] commit 022af62d0190 by Masahiro Yamada
kbuild: refactor script/kconfig/Makefile

[4] commit 221ecca6cafe by Masahiro Yamada
kbuild: remove redundant clean-files from scripts/kconfig/Makefile

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Showing 4 changed files with 20 additions and 40 deletions Side-by-side Diff

scripts/Makefile.build
... ... @@ -400,16 +400,14 @@
400 400 quiet_cmd_link_multi-m = LD [M] $@
401 401 cmd_link_multi-m = $(cmd_link_multi-y)
402 402  
403   -# We would rather have a list of rules like
404   -# foo.o: $(foo-objs)
405   -# but that's not so easy, so we rather make all composite objects depend
406   -# on the set of all their parts
407   -$(multi-used-y) : %.o: $(multi-objs-y) FORCE
  403 +$(multi-used-y): FORCE
408 404 $(call if_changed,link_multi-y)
  405 +$(call multi_depend, $(multi-used-y), .o, -objs -y)
409 406  
410   -$(multi-used-m) : %.o: $(multi-objs-m) FORCE
  407 +$(multi-used-m): FORCE
411 408 $(call if_changed,link_multi-m)
412 409 @{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod)
  410 +$(call multi_depend, $(multi-used-m), .o, -objs -y)
413 411  
414 412 targets += $(multi-used-y) $(multi-used-m)
415 413  
scripts/Makefile.host
... ... @@ -96,8 +96,9 @@
96 96 cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \
97 97 $(addprefix $(obj)/,$($(@F)-objs)) \
98 98 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
99   -$(host-cmulti): $(obj)/%: $(host-cobjs) FORCE
  99 +$(host-cmulti): FORCE
100 100 $(call if_changed,host-cmulti)
  101 +$(call multi_depend, $(host-cmulti), , -objs)
101 102  
102 103 # Create .o file from a single .c file
103 104 # host-cobjs -> .o
104 105  
... ... @@ -113,8 +114,9 @@
113 114 $(foreach o,objs cxxobjs,\
114 115 $(addprefix $(obj)/,$($(@F)-$(o)))) \
115 116 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
116   -$(host-cxxmulti): $(obj)/%: $(host-cobjs) $(host-cxxobjs) FORCE
  117 +$(host-cxxmulti): FORCE
117 118 $(call if_changed,host-cxxmulti)
  119 +$(call multi_depend, $(host-cxxmulti), , -objs -cxxobjs)
118 120  
119 121 # Create .o file from a single .cc (C++) file
120 122 quiet_cmd_host-cxxobjs = HOSTCXX $@
scripts/Makefile.lib
... ... @@ -160,6 +160,15 @@
160 160 modname-multi = $(sort $(foreach m,$(multi-used),\
161 161 $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))
162 162  
  163 +# Useful for describing the dependency of composite objects
  164 +# Usage:
  165 +# $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add)
  166 +define multi_depend
  167 +$(foreach m, $(notdir $1), \
  168 + $(eval $(obj)/$m: \
  169 + $(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s)))))))
  170 +endef
  171 +
163 172 ifdef REGENERATE_PARSERS
164 173  
165 174 # GPERF
scripts/kconfig/Makefile
... ... @@ -157,39 +157,10 @@
157 157 qconf-objs := zconf.tab.o
158 158 gconf-objs := gconf.o zconf.tab.o
159 159  
160   -hostprogs-y := conf
  160 +hostprogs-y := conf nconf mconf kxgettext qconf gconf
161 161  
162   -ifeq ($(MAKECMDGOALS),nconfig)
163   - hostprogs-y += nconf
164   -endif
165   -
166   -ifeq ($(MAKECMDGOALS),menuconfig)
167   - hostprogs-y += mconf
168   -endif
169   -
170   -ifeq ($(MAKECMDGOALS),update-po-config)
171   - hostprogs-y += kxgettext
172   -endif
173   -
174   -ifeq ($(MAKECMDGOALS),xconfig)
175   - qconf-target := 1
176   -endif
177   -ifeq ($(MAKECMDGOALS),gconfig)
178   - gconf-target := 1
179   -endif
180   -
181   -
182   -ifeq ($(qconf-target),1)
183   - hostprogs-y += qconf
184   -endif
185   -
186   -ifeq ($(gconf-target),1)
187   - hostprogs-y += gconf
188   -endif
189   -
190 162 clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck
191 163 clean-files += zconf.tab.c zconf.lex.c zconf.hash.c gconf.glade.h
192   -clean-files += mconf qconf gconf nconf
193 164 clean-files += config.pot linux.pot
194 165  
195 166 # Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
... ... @@ -224,7 +195,7 @@
224 195 || echo "-lmenu -lpanel -lncurses" )
225 196 $(obj)/qconf.o: $(obj)/.tmp_qtcheck
226 197  
227   -ifeq ($(qconf-target),1)
  198 +ifeq ($(MAKECMDGOALS),xconfig)
228 199 $(obj)/.tmp_qtcheck: $(src)/Makefile
229 200 -include $(obj)/.tmp_qtcheck
230 201  
... ... @@ -281,7 +252,7 @@
281 252  
282 253 $(obj)/gconf.o: $(obj)/.tmp_gtkcheck
283 254  
284   -ifeq ($(gconf-target),1)
  255 +ifeq ($(MAKECMDGOALS),gconfig)
285 256 -include $(obj)/.tmp_gtkcheck
286 257  
287 258 # GTK needs some extra effort, too...