aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: acfb9f27810c5815e382726ac7a16cd7522ceaa5 (plain)
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
ALL_SCRIPTS := $(wildcard scripts/*)
ALL_PROFILES := $(shell find profiles -name '*.yaml' -type f)
CORE_PROFILES := $(shell for i in base version arch; do ls profiles/$$i/*.yaml | sort -V; done)
PROFILE := default
BUILD :=

.PHONY: amis
amis: build build/profile build/packer.json
	build/make-amis $(BUILD)

build: $(SCRIPTS)
	[ -d build ] || mkdir build
	python3 -m venv build/.py3
	build/.py3/bin/pip install pyyaml boto3
	(cd build; for i in $(ALL_SCRIPTS); do ln -sf ../$$i .; done)

build/profile: build build/resolve-profile.py $(ALL_PROFILES)
	cat $(CORE_PROFILES) profiles/$(PROFILE).yaml | build/resolve-profile.py $(PROFILE)

build/packer.json: build build/yaml2json.py packer.yaml
	build/yaml2json.py packer.yaml > build/packer.json

%.py: %.py.in build
	sed "s|@PYTHON@|#!`pwd`/build/.py3/bin/python|" $< > $@
	chmod +x $@

clean:
	rm -rf build scrub-old-amis.py gen-readme.py