Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (38 loc) · 1.6 KB
/
Copy pathMakefile
File metadata and controls
46 lines (38 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# mod_dims
#
# make builder-local build the toolchain image for this machine
# make builder build it for both architectures and push it
# make test build the module and run the suite
#
# The build itself is CMake:
#
# cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
# cmake --build build
REGISTRY ?= ghcr.io/beetlebugorg/mod_dims
# Read the ImageMagick version straight from the builder, so the tag and the
# toolchain cannot disagree.
IMAGEMAGICK_VERSION := $(shell sed -n 's/^ARG IMAGEMAGICK_VERSION=//p' docker/Dockerfile.builder)
BUILDER_REVISION := $(shell sed -n 's/^ARG BUILDER_REVISION=//p' docker/Dockerfile.builder)
BUILDER_TAG := builder-im$(IMAGEMAGICK_VERSION)-r$(BUILDER_REVISION)
# Pull the toolchain, or build it when the registry does not have it yet.
# A fresh checkout, a pull request opened before the toolchain is published,
# and a machine with no registry access all work the same way.
toolchain:
@docker image inspect $(REGISTRY):$(BUILDER_TAG) >/dev/null 2>&1 && \
echo "toolchain $(BUILDER_TAG) already here" || \
docker pull -q $(REGISTRY):$(BUILDER_TAG) 2>/dev/null || \
$(MAKE) builder-local
builder-local:
docker buildx build --load -t $(REGISTRY):$(BUILDER_TAG) -f docker/Dockerfile.builder .
@echo "built $(REGISTRY):$(BUILDER_TAG)"
builder:
docker buildx build --push \
--platform linux/amd64,linux/arm64 \
-t $(REGISTRY):$(BUILDER_TAG) \
-t $(REGISTRY):builder \
-f docker/Dockerfile.builder .
builder-tag:
@echo $(REGISTRY):$(BUILDER_TAG)
test:
$(MAKE) -C test test
.PHONY: builder builder-local builder-tag toolchain test