-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
makefile
66 lines (50 loc) · 1.41 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
.SECONDEXPANSION:
export TF_CLI_CONFIG_FILE := $(CURDIR)/.terraformrc
export TFLINTRC := $(CURDIR)/.tflint.hcl
export TFDOCSRC := $(CURDIR)/.terraform-docs.yml
SUBMODULES := $(filter-out \
%.md,\
$(wildcard \
platform/modules/* \
platform \
aws/*/modules/*\
aws/* \
)\
)
SUBMODULEMAKEFILES := $(foreach module,$(SUBMODULES),$(module)/makefile)
MAKESUBMODULES := $(foreach module,$(SUBMODULES),$(module)/make)
SUBMODULESCOMMAND ?= default
CHART_PARAMS := $(wildcard */*/*/chart.json */*/*/*/chart.json)
.PHONY: default
default: chartparams submodules
include makefiles/tests.mk
.PHONY: chartparams
chartparams: $(CHART_PARAMS)
$(CHART_PARAMS): charts.json
jq \
--arg target "$@" \
'. as $$charts | $$target | split("/") as $$path | $$charts[$$path[-2]]' \
< charts.json > "$@"
.PHONY: submodules
submodules: $(SUBMODULEMAKEFILES) $(MAKESUBMODULES)
.PHONY: makefiles
makefiles: $(SUBMODULEMAKEFILES)
$(SUBMODULEMAKEFILES): %/makefile: makefiles/terraform.mk
cp "$<" "$@"
$(MAKESUBMODULES): %/make: .terraformrc
$(MAKE) -C "$*" "$(SUBMODULESCOMMAND)"
.PHONY: fmt
fmt: all/fmt
.PHONY: clean
clean: all/clean
rm -rf tmp
$(CLEANMODULES): %/clean:
$(MAKE) -C "$*" clean
.PHONY: updatecharts
updatecharts:
bin/update-charts
.terraformrc:
mkdir -p .terraform-plugins
echo 'plugin_cache_dir = "$(CURDIR)/.terraform-plugins"' > .terraformrc
all/%:
$(MAKE) submodules SUBMODULESCOMMAND=$(*)