-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
45 lines (34 loc) · 1.29 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
##########################################
# Dynamic targets #
##########################################
# Exclude current, distributions and hidden directories
FIND_PATH = . -mindepth 2 -not -path '*/\.*' -not -path '*/distributions/*'
# Define the list of subdirectories that contain a Makefile
SUBDIRS := $(patsubst ./%/Makefile,%,$(shell find $(FIND_PATH) -name Makefile))
TARGETS := $(SUBDIRS)
.PHONY: all $(TARGETS) clean $(addsuffix -clean,$(TARGETS)) help
$(TARGETS):
$(MAKE) -C $@
clean: $(addsuffix -clean,$(SUBDIRS))
$(addsuffix -clean,$(TARGETS)):
$(MAKE) -C $(patsubst %-clean,%,$@) clean
##########################################
# Static targets #
##########################################
FIND_MOD_ARGS=-type f -name "manifest.yaml"
TO_DIR=dirname {} \; | sort | grep -E '^./'
ALL_DISTRIBUTIONS := $(shell find ./distributions/* $(FIND_MOD_ARGS) -exec $(TO_DIR) )
# Define a delegation target for each distribution
.PHONY: $(ALL_DISTRIBUTIONS)
$(ALL_DISTRIBUTIONS):
$(MAKE) -C $@ $(TARGET)
# trigger target for each module's delegation target
.PHONY: for-all-target
for-all-target: $(ALL_DISTRIBUTIONS)
include build.mk
include check.mk
help:
@echo "## Available targets:"
@echo $(TARGETS)
@echo "## Available clean targets:"
@echo $(addsuffix -clean,$(TARGETS))