[source] build: define common subdir targets in rules.mk
LEDE Commits
lede-commits at lists.infradead.org
Wed Jan 18 14:57:22 PST 2017
nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/6cf067d084cc551c721e98b6d6c6403a63e521d5
commit 6cf067d084cc551c721e98b6d6c6403a63e521d5
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Wed Jan 18 14:00:48 2017 +0100
build: define common subdir targets in rules.mk
Reduce build system clutter and enable further rework
Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
include/host-build.mk | 17 ++++-------------
include/package.mk | 5 +----
include/subdir.mk | 2 +-
rules.mk | 9 +++++++++
4 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/include/host-build.mk b/include/host-build.mk
index 6c2f915..0bd3867 100644
--- a/include/host-build.mk
+++ b/include/host-build.mk
@@ -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
diff --git a/include/package.mk b/include/package.mk
index ea80128..62e538c 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -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
diff --git a/include/subdir.mk b/include/subdir.mk
index 10476d3..7e0c474 100644
--- a/include/subdir.mk
+++ b/include/subdir.mk
@@ -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 ., \
diff --git a/rules.mk b/rules.mk
index 95b18f9..e54acc9 100644
--- 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)
More information about the lede-commits
mailing list