build: define common subdir targets in rules.mk
authorFelix Fietkau <nbd@nbd.name>
Wed, 18 Jan 2017 13:00:48 +0000 (14:00 +0100)
committerFelix Fietkau <nbd@nbd.name>
Wed, 18 Jan 2017 22:57:07 +0000 (23:57 +0100)
Reduce build system clutter and enable further rework

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

index 6c2f91581b895bda1ee9f2ee94afc2e5c06de380..0bd386781dfbd6d9144c59a12a7708d1e389ab42 100644 (file)
@@ -168,13 +168,11 @@ ifndef DUMP
                touch $(HOST_STAMP_BUILT)
                touch $$@
 
+  $(call DefaultTargets,$(patsubst %,host-%,$(DEFAULT_SUBDIR_TARGETS)))
   ifndef STAMP_BUILT
-    prepare: host-prepare
-    compile: host-compile
-    install: host-install
-    clean: host-clean
-    update: host-update
-    refresh: host-refresh
+    $(foreach t,$(DEFAULT_SUBDIR_TARGETS),
+      $(t): host-$(t)
+    )
   endif
 
   host-prepare: $(HOST_STAMP_PREPARED)
@@ -187,13 +185,6 @@ ifndef DUMP
        rm -rf $(HOST_BUILD_DIR) $(HOST_STAMP_INSTALLED) $(HOST_STAMP_BUILT)
 
   endef
-
-  download:
-  prepare:
-  compile:
-  install:
-  clean:
-
 endif
 
 define HostBuild
index ea801288eadb139cc0dd2412b4c927c6bd7330e0..62e538c5945fdb9af02d12ce94cca8f57159d8a7 100644 (file)
@@ -143,6 +143,7 @@ Build/Exports=$(Build/Exports/Default)
 define Build/CoreTargets
   $(if $(QUILT),$(Build/Quilt))
   $(call Build/Autoclean)
+  $(call DefaultTargets)
 
   download:
        $(foreach hook,$(Hooks/Download),
@@ -287,10 +288,6 @@ prepare-package-install:
 $(PACKAGE_DIR):
        mkdir -p $@
 
-dumpinfo:
-download:
-prepare:
-configure:
 compile: prepare-package-install
 install: compile
 
index 10476d3476546fbc408c14793c0a7362721d076f..7e0c474035cb9416b72d5797cc162c87c49cf6a9 100644 (file)
@@ -9,7 +9,7 @@ ifeq ($(MAKECMDGOALS),prereq)
   SUBTARGETS:=prereq
   PREREQ_ONLY:=1
 else
-  SUBTARGETS:=clean download prepare compile install update refresh prereq dist distcheck configure check
+  SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS)
 endif
 
 subtarget-default = $(filter-out ., \
index 95b18f9e5c69de479db54c5bdb740103140dcf74..e54acc9858287d3e0fba17c8c6ad4bb6c3914387 100644 (file)
--- a/rules.mk
+++ b/rules.mk
@@ -101,6 +101,15 @@ ifdef CONFIG_MIPS64_ABI
   endif
 endif
 
+DEFAULT_SUBDIR_TARGETS:=clean download prepare compile install update refresh prereq dist distcheck configure check
+
+define DefaultTargets
+$(foreach t,$(DEFAULT_SUBDIR_TARGETS),
+  $(t):
+  .PHONY: $(t)
+)
+endef
+
 DL_DIR:=$(if $(call qstrip,$(CONFIG_DOWNLOAD_FOLDER)),$(call qstrip,$(CONFIG_DOWNLOAD_FOLDER)),$(TOPDIR)/dl)
 OUTPUT_DIR:=$(if $(call qstrip,$(CONFIG_BINARY_FOLDER)),$(call qstrip,$(CONFIG_BINARY_FOLDER)),$(TOPDIR)/bin)
 BIN_DIR:=$(OUTPUT_DIR)/targets/$(BOARD)/$(SUBTARGET)