fix compile errors with make 3.80
[openwrt/openwrt.git] / include / subdir.mk
index 81a6f2a428bac257bd0f87a156bb66f533b83ac5..16e4f4b6c4b908711c558662d468dc8c81b4a8ca 100644 (file)
@@ -5,7 +5,7 @@
 # l: show legacy targets
 
 ifeq ($(DEBUG),all)
-  build_debug:=dt
+  build_debug:=dlt
 else
   build_debug:=$(DEBUG)
 endif
@@ -23,26 +23,27 @@ $(call warn,$(1),$(2),$(3)  $(4))
 $(4)
 endef
 
-dep/compile=$(1)/prepare
-dep/install=$(1)/compile
 SUBTARGETS:=clean download prepare compile install update refresh prereq
 
+define subtarget
+  $(call warn_eval,$(1),t,T,$(1)/$(2): $($(1)/) $(foreach bd,$(if $($(1)/builddirs-$(2)),$($(1)/builddirs-$(2)),$($(1)/builddirs)),$(1)/$(bd)/$(2)))
+
+endef
+
 # Parameters: <subdir>
 define subdir
   $(call warn,$(1),d,D $(1))
   $(foreach bd,$($(1)/builddirs),
     $(call warn,$(1),d,BD $(1)/$(bd))
     $(foreach target,$(SUBTARGETS),
-      $(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(call dep/$(target),$(1)/$(bd)) $($(1)/$(bd)/$(target)) $($(1)//$(target)))
-               @$$(MAKE) -j1 -C $(1)/$(bd) $(target)
+      $(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd)))
+               @+$$(MAKE) -j1 -C $(1)/$(bd) $(target)
 
       # legacy targets
       $(call warn_eval,$(1)/$(bd),l,T,$(1)/$(bd)-$(target): $(1)/$(bd)/$(target))
        )
   )
-  $(foreach target,$(SUBTARGETS),
-    $(call warn_eval,$(1),t,T,$(1)/$(target): $($(1)/) $(foreach bd,$($(1)/builddirs),$(1)/$(bd)/$(target)))
-  )
+  $(foreach target,$(SUBTARGETS),$(call subtarget,$(1),$(target)))
 endef
 
 # Parameters: <subdir> <name>
@@ -51,7 +52,7 @@ define stampfile
   $(call rdep,$(1),$$($(1)/stamp))
 
   $$($(1)/stamp):
-       @$(MAKE) $(1)/install
+       @+$(MAKE) $(1)/install
        @mkdir -p $$$$(dirname $$($(1)/stamp))
        @touch $$($(1)/stamp)
   .PRECIOUS: $$($(1)/stamp) # work around a make bug