diff options
| author | Andres Salomon <dilinger@queued.net> | 2020-05-04 18:07:01 -0400 |
|---|---|---|
| committer | Andres Salomon <dilinger@queued.net> | 2020-05-04 18:21:22 -0400 |
| commit | 5507be93ef065f5b68aeef60af8dd67a38f42b63 (patch) | |
| tree | 73fe96279587be1e53e3f4b0a7f5dc6dc996c1a4 /Makefile | |
| parent | dab07510cf2f3e6942060b9801f24531ecdaf6cd (diff) | |
Makefile: use variables for platforms instead of repeating platform numbers
Create a variable called BUILD_PLATFORMS that lists the various pi images
to build. This keeps the platform list in one place in the makefile, rather
than sprinkled and repeated throughout multiple dependency and build lines.
When a platform is added (ie, the pi4) or removed, it won't touch multiple
rules and obscure other changes. This uses gmake-specific addprefix and
addsuffix.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 25 |
1 files changed, 15 insertions, 10 deletions
@@ -1,9 +1,14 @@ all: shasums -shasums: raspi_0w.sha256 raspi_2.sha256 raspi_3.sha256 raspi_0w.xz.sha256 raspi_2.xz.sha256 raspi_3.xz.sha256 -xzimages: raspi_0w.img.xz raspi_2.img.xz raspi_3.img.xz -images: raspi_0w.img raspi_2.img raspi_3.img -yaml: raspi_0w.yaml raspi_2.yaml raspi_3.yaml +# List all the supported and built Pi platforms here. They get expanded +# to names like 'raspi_2.yaml' and 'raspi_0w.img.xz'. +BUILD_PLATFORMS := 0w 2 3 + +platforms := $(addprefix raspi_,$(BUILD_PLATFORMS)) +shasums: $(addsuffix .sha256,$(platforms)) $(addsuffix .xz.sha256,$(platforms)) +xzimages: $(addsuffix .img.xz,$(platforms)) +images: $(addsuffix .img,$(platforms)) +yaml: $(addsuffix .yaml,$(platforms)) raspi_0w.yaml: raspi_master.yaml cat raspi_master.yaml | sed "s/__ARCH__/armel/" | \ @@ -49,17 +54,17 @@ _ck_root: [ `whoami` = 'root' ] # Only root can summon vmdb2 ☹ _clean_yaml: - rm -f raspi_0w.yaml raspi_2.yaml raspi_3.yaml + rm -f $(addsuffix .yaml,$(platforms)) _clean_images: - rm -f raspi_0w.img raspi_2.img raspi_3.img + rm -f $(addsuffix .img,$(platforms)) _clean_xzimages: - rm -f raspi_0w.img.xz raspi_2.img.xz raspi_3.img.xz + rm -f $(addsuffix .img.xz,$(platforms)) _clean_shasums: - rm -f raspi_0w.sha256 raspi_2.sha256 raspi_3.sha256 raspi_0w.xz.sha256 raspi_2.xz.sha256 raspi_3.xz.sha256 + rm -f $(addsuffix .sha256,$(platforms)) $(addsuffix .xz.sha256,$(platforms)) _clean_logs: - rm -f raspi_0w.log raspi_2.log raspi_3.log + rm -f $(addsuffix .log,$(platforms)) _clean_tarballs: - rm -f raspi_0w.tar.gz raspi_2.tar.gz raspi_3.tar.gz + rm -f $(addsuffix .tar.gz,$(platforms)) clean: _clean_xzimages _clean_images _clean_shasums _clean_yaml _clean_tarballs _clean_logs .PHONY: _ck_root _build_img clean _clean_images _clean_yaml _clean_tarballs _clean_logs |
