build: introduce extra targets that contain only proper dependencies
authorFelix Fietkau <nbd@nbd.name>
Wed, 18 Jan 2017 13:27:04 +0000 (14:27 +0100)
committerFelix Fietkau <nbd@nbd.name>
Wed, 18 Jan 2017 22:57:08 +0000 (23:57 +0100)
This can be used to check if targets like prepare or compile are up to date

Signed-off-by: Felix Fietkau <nbd@nbd.name>
include/depends.mk
include/host-build.mk
include/package-ipkg.mk
include/package.mk
rules.mk

index 293409d8b75074468f244ebe939a3b9ee5df73e0..c26c8e547e0223fe995e573a8ca6f13f61bb457d 100644 (file)
@@ -20,6 +20,7 @@ define rdep
   .SILENT: $(2)_check
 
   $(2): $(2)_check
+  check-depends: $(2)_check
 
 ifneq ($(wildcard $(2)),)
   $(2)_check::
@@ -46,3 +47,8 @@ endif
 
 endef
 
+ifeq ($(filter .%,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),$(MAKECMDGOALS),x))
+  define rdep
+    $(2): $(2)_check
+  endef
+endif
index 0bd386781dfbd6d9144c59a12a7708d1e389ab42..c38f8cfeb7eb95d2ff6957566ebfb87c5eeda236 100644 (file)
@@ -175,10 +175,10 @@ ifndef DUMP
     )
   endif
 
-  host-prepare: $(HOST_STAMP_PREPARED)
-  host-configure: $(HOST_STAMP_CONFIGURED)
-  host-compile: $(HOST_STAMP_BUILT) $(if $(STAMP_BUILT),$(HOST_STAMP_INSTALLED))
-  host-install: $(HOST_STAMP_INSTALLED)
+  .host-prepare: $(HOST_STAMP_PREPARED)
+  .host-configure: $(HOST_STAMP_CONFIGURED)
+  .host-compile: $(HOST_STAMP_BUILT) $(if $(STAMP_BUILT),$(HOST_STAMP_INSTALLED))
+  .host-install: $(HOST_STAMP_INSTALLED)
   host-clean: FORCE
        $(call Host/Clean)
        $(call Host/Uninstall)
index e168eb390f31290c68ecb406b09339d69fc9495b..8727b4ec30213141fb8875d2850679b43373e266 100644 (file)
@@ -106,9 +106,9 @@ ifeq ($(DUMP),)
     ifdef do_install
       ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),)
         IPKGS += $(1)
-        compile: $$(IPKG_$(1)) $(PKG_INFO_DIR)/$(1).provides $(STAGING_DIR_ROOT)/stamp/.$(1)_installed
+        .compile: $$(IPKG_$(1)) $(PKG_INFO_DIR)/$(1).provides $(STAGING_DIR_ROOT)/stamp/.$(1)_installed
         ifneq ($(ABI_VERSION),)
-        compile: $(PKG_INFO_DIR)/$(1).version
+        .compile: $(PKG_INFO_DIR)/$(1).version
         endif
       else
         $(if $(CONFIG_PACKAGE_$(1)),$$(info WARNING: skipping $(1) -- package not selected))
index 62e538c5945fdb9af02d12ce94cca8f57159d8a7..37cea1448df8339f9eb2d325bbac70b04dc537ad 100644 (file)
@@ -204,13 +204,13 @@ define Build/CoreTargets
        touch $$@
 
   ifdef Build/InstallDev
-    compile: $(STAMP_INSTALLED)
+    .compile: $(STAMP_INSTALLED)
   endif
 
-  prepare: $(STAMP_PREPARED)
-  configure: $(STAMP_CONFIGURED)
-  dist: $(STAMP_CONFIGURED)
-  distcheck: $(STAMP_CONFIGURED)
+  .prepare: $(STAMP_PREPARED)
+  .configure: $(STAMP_CONFIGURED)
+  .dist: $(STAMP_CONFIGURED)
+  .distcheck: $(STAMP_CONFIGURED)
 endef
 
 define Build/DefaultTargets
@@ -289,6 +289,7 @@ $(PACKAGE_DIR):
        mkdir -p $@
 
 compile: prepare-package-install
+.install: .compile
 install: compile
 
 clean: FORCE
index e54acc9858287d3e0fba17c8c6ad4bb6c3914387..b42e19e21899bd3717e0a1f12d2d2ec27fe5ffd9 100644 (file)
--- a/rules.mk
+++ b/rules.mk
@@ -101,12 +101,13 @@ ifdef CONFIG_MIPS64_ABI
   endif
 endif
 
-DEFAULT_SUBDIR_TARGETS:=clean download prepare compile install update refresh prereq dist distcheck configure check
+DEFAULT_SUBDIR_TARGETS:=clean download prepare compile install update refresh prereq dist distcheck configure check check-depends
 
 define DefaultTargets
-$(foreach t,$(DEFAULT_SUBDIR_TARGETS),
-  $(t):
-  .PHONY: $(t)
+$(foreach t,$(DEFAULT_SUBDIR_TARGETS) $(1),
+  .$(t):
+  $(t): .$(t)
+  .PHONY: $(t) .$(t)
 )
 endef