2016-10-14 13:57:26 +03:00
|
|
|
.PHONY: check
|
|
|
|
check:
|
2016-10-20 16:55:05 +03:00
|
|
|
@./bin/setup
|
2016-10-17 19:56:01 +03:00
|
|
|
|
2016-10-24 17:52:46 +03:00
|
|
|
SUBDIRS := $(shell find -maxdepth 2 -mindepth 2 -name 'Makefile' -printf '%h/.\n')
|
|
|
|
TARGETS := clean install test # whatever else, but must not contain '/'
|
|
|
|
|
|
|
|
# foo/.all bar/.all foo/.clean bar/.clean
|
|
|
|
SUBDIRS_TARGETS := \
|
|
|
|
$(foreach t,$(TARGETS),$(addsuffix $t,$(SUBDIRS)))
|
|
|
|
|
|
|
|
.PHONY: $(TARGETS) $(SUBDIRS_TARGETS)
|
|
|
|
|
|
|
|
# static pattern rule, expands into:
|
|
|
|
# all clean: %: foo/.% bar/.%
|
|
|
|
$(TARGETS): %: $(addsuffix %,$(SUBDIRS))
|
|
|
|
@echo 'Done "$*" target'
|
|
|
|
|
|
|
|
# here, for foo/.all:
|
|
|
|
# $(@D) is foo
|
|
|
|
# $(@F) is .all, with leading period
|
|
|
|
# $(@F:.%=%) is just all
|
|
|
|
$(SUBDIRS_TARGETS):
|
|
|
|
$(MAKE) -C $(@D) $(@F:.%=%)
|