aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-02-03 00:33:25 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-02-03 00:33:25 +0300
commit1e6f14ca80b0df171d79a0d8ebaf03017fd0e54c (patch)
treed266e5e32399d79ad3cb41d1ec67f70c7fad71b3
parentTravis: only build multi-arch images on master (diff)
downloadfr24feed-1e6f14ca80b0df171d79a0d8ebaf03017fd0e54c.tar.gz
fr24feed-1e6f14ca80b0df171d79a0d8ebaf03017fd0e54c.zip
Makefile: best practices
-rw-r--r--Makefile16
1 files changed, 12 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 9e1838d..b357492 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,12 @@
# Various one-liners which I'm too lazy to remember.
# Basically a collection of really small shell scripts.
+MAKEFLAGS += --warn-undefined-variables
+SHELL := bash
+.SHELLFLAGS := -eu -o pipefail -c
+.DEFAULT_GOAL := all
+.SUFFIXES:
+
PROJECT = fr24feed
# Use BuildKit, which is required:
export DOCKER_BUILDKIT = 1
@@ -17,6 +23,8 @@ DOCKER_USERNAME = egortensin
all: build
+DO:
+
login:
ifndef DOCKER_PASSWORD
$(error Please define DOCKER_PASSWORD)
@@ -54,7 +62,7 @@ endif
# `docker build` has week support for multiarch repos (you need to use multiple
# Dockerfile's, create a manifest manually, etc.), so it's only here for
# testing purposes, and native builds.
-docker/build/%: check-build
+docker/build/%: DO check-build
docker build -t "$(DOCKER_USERNAME)/$*" "$*/"
docker/build: docker/build/dump1090 docker/build/fr24feed
@@ -62,7 +70,7 @@ docker/build: docker/build/dump1090 docker/build/fr24feed
# `docker push` would replace the multiarch repo with a single image by default
# (you'd have to create a manifest and push it instead), so it's only here for
# testing purposes.
-docker/push/%: check-push docker/build/%
+docker/push/%: DO check-push docker/build/%
docker push "$(DOCKER_USERNAME)/$*"
docker/push: check-push docker/push/dump1090 docker/push/fr24feed
@@ -92,12 +100,12 @@ buildx/create: fix-binfmt
buildx/rm:
docker buildx rm "$(PROJECT)_builder"
-buildx/build/%:
+buildx/build/%: DO
docker buildx build -t "$(DOCKER_USERNAME)/$*" --platform "$(platforms)" "$*/"
buildx/build: buildx/build/dump1090 buildx/build/fr24feed
-buildx/push/%:
+buildx/push/%: DO
docker buildx build -t "$(DOCKER_USERNAME)/$*" --platform "$(platforms)" --push "$*/"
buildx/push: buildx/push/dump1090 buildx/push/fr24feed