build: define common subdir targets in rules.mk

Reduce build system clutter and enable further rework

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2017-01-18 14:00:48 +01:00
parent c99f881568
commit 6cf067d084
4 changed files with 15 additions and 18 deletions

View file

@ -168,13 +168,11 @@ ifndef DUMP
touch $(HOST_STAMP_BUILT) touch $(HOST_STAMP_BUILT)
touch $$@ touch $$@
$(call DefaultTargets,$(patsubst %,host-%,$(DEFAULT_SUBDIR_TARGETS)))
ifndef STAMP_BUILT ifndef STAMP_BUILT
prepare: host-prepare $(foreach t,$(DEFAULT_SUBDIR_TARGETS),
compile: host-compile $(t): host-$(t)
install: host-install )
clean: host-clean
update: host-update
refresh: host-refresh
endif endif
host-prepare: $(HOST_STAMP_PREPARED) host-prepare: $(HOST_STAMP_PREPARED)
@ -187,13 +185,6 @@ ifndef DUMP
rm -rf $(HOST_BUILD_DIR) $(HOST_STAMP_INSTALLED) $(HOST_STAMP_BUILT) rm -rf $(HOST_BUILD_DIR) $(HOST_STAMP_INSTALLED) $(HOST_STAMP_BUILT)
endef endef
download:
prepare:
compile:
install:
clean:
endif endif
define HostBuild define HostBuild

View file

@ -143,6 +143,7 @@ Build/Exports=$(Build/Exports/Default)
define Build/CoreTargets define Build/CoreTargets
$(if $(QUILT),$(Build/Quilt)) $(if $(QUILT),$(Build/Quilt))
$(call Build/Autoclean) $(call Build/Autoclean)
$(call DefaultTargets)
download: download:
$(foreach hook,$(Hooks/Download), $(foreach hook,$(Hooks/Download),
@ -287,10 +288,6 @@ prepare-package-install:
$(PACKAGE_DIR): $(PACKAGE_DIR):
mkdir -p $@ mkdir -p $@
dumpinfo:
download:
prepare:
configure:
compile: prepare-package-install compile: prepare-package-install
install: compile install: compile

View file

@ -9,7 +9,7 @@ ifeq ($(MAKECMDGOALS),prereq)
SUBTARGETS:=prereq SUBTARGETS:=prereq
PREREQ_ONLY:=1 PREREQ_ONLY:=1
else else
SUBTARGETS:=clean download prepare compile install update refresh prereq dist distcheck configure check SUBTARGETS:=$(DEFAULT_SUBDIR_TARGETS)
endif endif
subtarget-default = $(filter-out ., \ subtarget-default = $(filter-out ., \

View file

@ -101,6 +101,15 @@ ifdef CONFIG_MIPS64_ABI
endif endif
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) 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) OUTPUT_DIR:=$(if $(call qstrip,$(CONFIG_BINARY_FOLDER)),$(call qstrip,$(CONFIG_BINARY_FOLDER)),$(TOPDIR)/bin)
BIN_DIR:=$(OUTPUT_DIR)/targets/$(BOARD)/$(SUBTARGET) BIN_DIR:=$(OUTPUT_DIR)/targets/$(BOARD)/$(SUBTARGET)