Some Makefile cleanup; build shasums from the images as well

This commit is contained in:
Gunnar Wolf 2020-04-14 13:38:14 -05:00
parent 4ceaa89eb8
commit 5da5be7a5c
2 changed files with 14 additions and 15 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
raspi*.img
raspi*.log
raspi*.tar.gz
raspi*.sha256
raspi_0w.yaml
raspi_2.yaml
raspi_3.yaml

View File

@ -1,5 +1,8 @@
yaml: raspi_0w.yaml raspi_2.yaml raspi_3.yaml
all: shasums
shasums: raspi_0w.sha256 raspi_2.sha256 raspi_3.sha256
images: raspi_0w.img raspi_2.img raspi_3.img
yaml: raspi_0w.yaml raspi_2.yaml raspi_3.yaml
raspi_0w.yaml: raspi_master.yaml
cat raspi_master.yaml | sed "s/__ARCH__/armel/" | \
@ -25,20 +28,13 @@ raspi_3.yaml: raspi_master.yaml
sed "s/__SPU_ENABLE__//" |\
sed "s/__HOST__/rpi3/" > $@
raspi_0w.img : IMAGE=raspi_0w
raspi_0w.img: raspi_0w.yaml _ck_root _build_img
%.sha256: %.img
sha256sum $(@:sha256=img) $@ > $@
raspi_2.img : IMAGE=raspi_2
raspi_2.img: raspi_2.yaml _ck_root _build_img
raspi_3.img : IMAGE=raspi_3
raspi_3.img: raspi_3.yaml _ck_root _build_img
_build_img:
[ ! -z "$(IMAGE)" ] # This target is not to be called directly
touch $(IMAGE).log
chmod 0644 $(IMAGE).log # Allow for non-root users to follow the build log
time nice vmdb2 --verbose --rootfs-tarball=$(IMAGE).tar.gz --output=$(IMAGE).img $(IMAGE).yaml --log $(IMAGE).log
%.img: %.yaml
touch $(@:.img=.log)
time nice vmdb2 --verbose --rootfs-tarball=$(subst .img,.tar.gz,$@) --output=$@ $(subst .img,.yaml,$@) --log $(subst .img,.log,$@)
chmod 0644 $@ $(@,.img=.log)
_ck_root:
[ `whoami` = 'root' ] # Only root can summon vmdb2 ☹
@ -47,10 +43,12 @@ _clean_yaml:
rm -f raspi_0w.yaml raspi_2.yaml raspi_3.yaml
_clean_images:
rm -f raspi_0w.img raspi_2.img raspi_3.img
_clean_shasums:
rm -f raspi_0w.sha256 raspi_2.sha256 raspi_3.sha256
_clean_logs:
rm -f raspi_0w.log raspi_2.log raspi_3.log
_clean_tarballs:
rm -f raspi_0w.tar.gz raspi_2.tar.gz raspi_3.tar.gz
clean: _clean_images _clean_yaml _clean_tarballs _clean_logs
clean: _clean_images _clean_shasums _clean_yaml _clean_tarballs _clean_logs
.PHONY: _ck_root _build_img clean _clean_images _clean_yaml _clean_tarballs _clean_logs