Better model make dependencies on build files
This commit is contained in:
parent
a36d0616bf
commit
1241cb5aaf
41
Makefile
41
Makefile
|
@ -1,8 +1,9 @@
|
||||||
# vim: ts=8 noet:
|
# vim: ts=8 noet:
|
||||||
|
|
||||||
ALL_SCRIPTS := $(wildcard scripts/*)
|
NVME_SCRIPTS := $(subst scripts/,build/,$(wildcard scripts/nvme/*))
|
||||||
CORE_PROFILES := $(wildcard profiles/*/*)
|
CORE_PROFILES := $(wildcard profiles/*/*)
|
||||||
TARGET_PROFILES := $(wildcard profiles/*.conf)
|
TARGET_PROFILES := $(wildcard profiles/*.conf)
|
||||||
|
|
||||||
PROFILE :=
|
PROFILE :=
|
||||||
BUILD :=
|
BUILD :=
|
||||||
BUILDS := $(BUILD)
|
BUILDS := $(BUILD)
|
||||||
|
@ -24,36 +25,36 @@ __check_defined = \
|
||||||
|
|
||||||
.PHONY: amis prune release-readme clean
|
.PHONY: amis prune release-readme clean
|
||||||
|
|
||||||
amis: build build/packer.json build/profile/$(PROFILE) build/update-release.py build/make-amis.py
|
amis: build/packer.json build/profile/$(PROFILE) build build/setup-ami $(NVME_SCRIPTS)
|
||||||
@:$(call check_defined, PROFILE, target profile name)
|
@:$(call check_defined, PROFILE, target profile name)
|
||||||
build/make-amis.py $(PROFILE) $(BUILDS)
|
build/builder make-amis $(PROFILE) $(BUILDS)
|
||||||
|
|
||||||
prune: build build/prune-amis.py
|
prune: build
|
||||||
@:$(call check_defined, LEVEL, pruning level)
|
@:$(call check_defined, LEVEL, pruning level)
|
||||||
@:$(call check_defined, PROFILE, target profile name)
|
@:$(call check_defined, PROFILE, target profile name)
|
||||||
build/prune-amis.py $(LEVEL) $(PROFILE) $(BUILD)
|
build/builder prune-amis $(LEVEL) $(PROFILE) $(BUILD)
|
||||||
|
|
||||||
release-readme: build build/gen-release-readme.py
|
release-readme: releases/README.md
|
||||||
|
releases/README.md: build
|
||||||
@:$(call check_defined, PROFILE, target profile name)
|
@:$(call check_defined, PROFILE, target profile name)
|
||||||
@:$(call require_var, PROFILE)
|
@:$(call require_var, PROFILE)
|
||||||
build/gen-release-readme.py $(PROFILE)
|
build/builder gen-release-readme $(PROFILE)
|
||||||
|
|
||||||
build: $(ALL_SCRIPTS)
|
build:
|
||||||
|
python3 -m venv build
|
||||||
[ -d build/profile ] || mkdir -p build/profile
|
[ -d build/profile ] || mkdir -p build/profile
|
||||||
python3 -m venv build/.py3
|
build/bin/pip install -U pip pyhocon pyyaml boto3
|
||||||
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
|
echo -e "#!/bin/sh\n$$(pwd)/build/bin/python scripts/builder.py \$$@" > $@
|
||||||
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 check_defined, PROFILE, target profile name)
|
|
||||||
build/resolve-profile.py $(PROFILE)
|
|
||||||
|
|
||||||
%.py: %.py.in build
|
|
||||||
sed "s|@PYTHON@|#!`pwd`/build/.py3/bin/python|" $< > $@
|
|
||||||
chmod +x $@
|
chmod +x $@
|
||||||
|
|
||||||
|
build/packer.json: packer.conf build
|
||||||
|
build/builder convert-packer-config
|
||||||
|
|
||||||
|
.PHONY: build/profile/$(PROFILE)
|
||||||
|
build/profile/$(PROFILE): build $(CORE_PROFILES) $(TARGET_PROFILES)
|
||||||
|
@:$(call check_defined, PROFILE, target profile name)
|
||||||
|
build/builder resolve-profile $(PROFILE)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf build
|
rm -rf build
|
||||||
|
|
Loading…
Reference in New Issue
Block a user