]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
kbuild: improve multi-objs dependency and cleanups
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Thu, 30 Oct 2014 02:06:10 +0000 (11:06 +0900)
committerTom Rini <trini@ti.com>
Fri, 7 Nov 2014 21:27:06 +0000 (16:27 -0500)
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>
scripts/Makefile.build
scripts/Makefile.host
scripts/Makefile.lib
scripts/kconfig/Makefile

index 6742ddd0b80fd8bd5f418a148b848fd2199427b0..3e12b5730647b831b13e5545d33f2e1ee93eb277 100644 (file)
@@ -400,16 +400,14 @@ cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalys
 quiet_cmd_link_multi-m = LD [M]  $@
 cmd_link_multi-m = $(cmd_link_multi-y)
 
-# We would rather have a list of rules like
-#      foo.o: $(foo-objs)
-# but that's not so easy, so we rather make all composite objects depend
-# on the set of all their parts
-$(multi-used-y) : %.o: $(multi-objs-y) FORCE
+$(multi-used-y): FORCE
        $(call if_changed,link_multi-y)
+$(call multi_depend, $(multi-used-y), .o, -objs -y)
 
-$(multi-used-m) : %.o: $(multi-objs-m) FORCE
+$(multi-used-m): FORCE
        $(call if_changed,link_multi-m)
        @{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod)
+$(call multi_depend, $(multi-used-m), .o, -objs -y)
 
 targets += $(multi-used-y) $(multi-used-m)
 
index ab5980f917141e9f90f52a9ae49e71901104196f..133edfae5b8a8d7a66f59b9c1ef3130cb63eb928 100644 (file)
@@ -96,8 +96,9 @@ quiet_cmd_host-cmulti = HOSTLD  $@
       cmd_host-cmulti  = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \
                          $(addprefix $(obj)/,$($(@F)-objs)) \
                          $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
-$(host-cmulti): $(obj)/%: $(host-cobjs) FORCE
+$(host-cmulti): FORCE
        $(call if_changed,host-cmulti)
+$(call multi_depend, $(host-cmulti), , -objs)
 
 # Create .o file from a single .c file
 # host-cobjs -> .o
@@ -113,8 +114,9 @@ quiet_cmd_host-cxxmulti     = HOSTLD  $@
                          $(foreach o,objs cxxobjs,\
                          $(addprefix $(obj)/,$($(@F)-$(o)))) \
                          $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
-$(host-cxxmulti): $(obj)/%: $(host-cobjs) $(host-cxxobjs) FORCE
+$(host-cxxmulti): FORCE
        $(call if_changed,host-cxxmulti)
+$(call multi_depend, $(host-cxxmulti), , -objs -cxxobjs)
 
 # Create .o file from a single .cc (C++) file
 quiet_cmd_host-cxxobjs = HOSTCXX $@
index 072abaafb189b9f512a677e67ca2a571af2ce2c4..9d1383a38f727982a52fa2b6e87a8d72f8b63591 100644 (file)
@@ -160,6 +160,15 @@ dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
 modname-multi = $(sort $(foreach m,$(multi-used),\
                $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))
 
+# Useful for describing the dependency of composite objects
+# Usage:
+#   $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add)
+define multi_depend
+$(foreach m, $(notdir $1), \
+       $(eval $(obj)/$m: \
+       $(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s)))))))
+endef
+
 ifdef REGENERATE_PARSERS
 
 # GPERF
index 9c4d2412fb724e8b8d93cd02b70488ba3f779cb9..e7bf38e920070b45cc5bd03c6034af02ef36a60e 100644 (file)
@@ -157,39 +157,10 @@ qconf-cxxobjs     := qconf.o
 qconf-objs     := zconf.tab.o
 gconf-objs     := gconf.o zconf.tab.o
 
-hostprogs-y := conf
-
-ifeq ($(MAKECMDGOALS),nconfig)
-       hostprogs-y += nconf
-endif
-
-ifeq ($(MAKECMDGOALS),menuconfig)
-       hostprogs-y += mconf
-endif
-
-ifeq ($(MAKECMDGOALS),update-po-config)
-       hostprogs-y += kxgettext
-endif
-
-ifeq ($(MAKECMDGOALS),xconfig)
-       qconf-target := 1
-endif
-ifeq ($(MAKECMDGOALS),gconfig)
-       gconf-target := 1
-endif
-
-
-ifeq ($(qconf-target),1)
-       hostprogs-y += qconf
-endif
-
-ifeq ($(gconf-target),1)
-       hostprogs-y += gconf
-endif
+hostprogs-y := conf nconf mconf kxgettext qconf gconf
 
 clean-files    := qconf.moc .tmp_qtcheck .tmp_gtkcheck
 clean-files    += zconf.tab.c zconf.lex.c zconf.hash.c gconf.glade.h
-clean-files     += mconf qconf gconf nconf
 clean-files     += config.pot linux.pot
 
 # Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
@@ -224,7 +195,7 @@ HOSTLOADLIBES_nconf = $(shell \
                                || echo "-lmenu -lpanel -lncurses"  )
 $(obj)/qconf.o: $(obj)/.tmp_qtcheck
 
-ifeq ($(qconf-target),1)
+ifeq ($(MAKECMDGOALS),xconfig)
 $(obj)/.tmp_qtcheck: $(src)/Makefile
 -include $(obj)/.tmp_qtcheck
 
@@ -281,7 +252,7 @@ endif
 
 $(obj)/gconf.o: $(obj)/.tmp_gtkcheck
 
-ifeq ($(gconf-target),1)
+ifeq ($(MAKECMDGOALS),gconfig)
 -include $(obj)/.tmp_gtkcheck
 
 # GTK needs some extra effort, too...