d28214fc50
* .gitignore - don't ignore whole dirs and then opt-in specific files * Makefile - fail if required vars aren't set - SCRIPTS --> ALL_SCRIPTS * profiles/README.md - variables.yaml --> vars.json - drop 'not possible to add/modify/remove arbitrary files' comment * make-amis - use -eq for integer comparison - make shellcheck happier with printf's - remove old bad-idea TODO
51 lines
1.3 KiB
Makefile
51 lines
1.3 KiB
Makefile
# vim: ts=8 noet:
|
|
|
|
ALL_SCRIPTS := $(wildcard scripts/*)
|
|
CORE_PROFILES := $(wildcard profiles/*/*)
|
|
TARGET_PROFILES := $(wildcard profiles/*.conf)
|
|
PROFILE :=
|
|
BUILD :=
|
|
BUILDS := $(BUILD)
|
|
LEVEL :=
|
|
|
|
# by default, use the 'packer' in the path
|
|
PACKER := packer
|
|
export PACKER
|
|
|
|
require_var = $(if $(value $1),,$(error $1=... required))
|
|
|
|
.PHONY: amis prune release-readme clean
|
|
|
|
amis: build build/packer.json build/profile/$(PROFILE) build/update-release.py
|
|
@:$(call require_var, PROFILE)
|
|
build/make-amis $(PROFILE) $(BUILDS)
|
|
|
|
prune: build build/prune-amis.py
|
|
@:$(call require_var, LEVEL)
|
|
@:$(call require_var, PROFILE)
|
|
build/prune-amis.py $(LEVEL) $(PROFILE) $(BUILD)
|
|
|
|
release-readme: build build/gen-release-readme.py
|
|
@:$(call require_var, PROFILE)
|
|
build/gen-release-readme.py $(PROFILE)
|
|
|
|
build: $(ALL_SCRIPTS)
|
|
[ -d build/profile ] || mkdir -p build/profile
|
|
python3 -m venv build/.py3
|
|
build/.py3/bin/pip install pyhocon pyyaml boto3
|
|
(cd build; for i in $(ALL_SCRIPTS); do ln -sf ../$$i .; done)
|
|
|
|
build/packer.json: build packer.conf
|
|
build/.py3/bin/pyhocon -i packer.conf -f json > build/packer.json
|
|
|
|
build/profile/$(PROFILE): build build/resolve-profile.py $(CORE_PROFILES) $(TARGET_PROFILES)
|
|
@:$(call require_var, PROFILE)
|
|
build/resolve-profile.py $(PROFILE)
|
|
|
|
%.py: %.py.in build
|
|
sed "s|@PYTHON@|#!`pwd`/build/.py3/bin/python|" $< > $@
|
|
chmod +x $@
|
|
|
|
clean:
|
|
rm -rf build
|