-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathMakefile
124 lines (103 loc) · 3.52 KB
/
Makefile
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# The make file for the build and test environments for the ICU library.
#
# The targets are named with a suffix `.stamp` so that we can avoid making
# unnecessary build steps, and so that the .stamp files can be easily removed
# together.
#
# Main targets:
#
# - all (use as `make all`): makes all the docker images
# - latest: makes only the most recent released docker image.
# - clean: clean up
# Uses version tag of the form buildenv-0.0.0.
RAW_VERSION := $(shell git describe --dirty --tags --match="buildenv-*")
VERSION ?= $(RAW_VERSION:buildenv-%=%)
# The docker repo should be a more official one.
DOCKER_REPO ?= filipfilmar
.DEFAULT_GOAL: all
all: \
push-buildenv.stamp \
latest.stamp \
v74.stamp \
v73.stamp \
v72.stamp \
v71.stamp \
v63.stamp \
push-testenv.stamp \
push-current.stamp \
push-hermetic.stamp
echo "buildenv-version: ${VERSION}"
.PHONY: all
latest: latest.stamp
.PHONY: latest
clean:
rm -fr *.stamp
.PHONY: clean
build-%.stamp: Dockerfile.%
docker build \
--build-arg DOCKER_REPO=${DOCKER_REPO} \
--build-arg VERSION=${VERSION} \
-f $< -t rust_icu_$*:${VERSION} .
touch $@
build-maint-%.stamp: Dockerfile.maint Dockerfile.buildenv
docker build \
--build-arg DOCKER_REPO=${DOCKER_REPO} \
--build-arg VERSION=${VERSION} \
--build-arg ICU_VERSION_TAG=maint/maint-$* \
-f $< -t rust_icu_maint-$*:${VERSION} .
touch $@
push-current.stamp: tag-current.stamp
docker push ${DOCKER_REPO}/rust_icu_testenv-current:${VERSION}
touch $@
tag-current.stamp: Makefile build-current.stamp
docker tag rust_icu_testenv-current:${VERSION} ${DOCKER_REPO}/rust_icu_testenv-current:${VERSION}
touch $@
build-current.stamp: Dockerfile.testenv.current \
Dockerfile.buildenv Makefile \
entrypoint.sh entrypoint-test-current.sh
docker build \
--build-arg DOCKER_REPO=${DOCKER_REPO} \
--build-arg VERSION=${VERSION} \
--build-arg ICU_VERSION_TAG=maint-74 \
-f $< -t rust_icu_testenv-current:${VERSION} .
touch $@
build-testenv-%.stamp: Dockerfile.testenv Dockerfile.buildenv \
entrypoint.sh entrypoint-test-current.sh
docker build \
--build-arg DOCKER_REPO=${DOCKER_REPO} \
--build-arg VERSION=${VERSION} \
--build-arg ICU_VERSION_TAG=maint-$* \
-f $< -t rust_icu_testenv-$*:${VERSION} .
touch $@
tag-%.stamp: build-%.stamp
docker tag rust_icu_$*:${VERSION} ${DOCKER_REPO}/rust_icu_$*:${VERSION}
touch $@
push-%.stamp: tag-%.stamp
docker push ${DOCKER_REPO}/rust_icu_$*:${VERSION}
touch $@
latest.stamp: push-buildenv.stamp v74.stamp
touch $@
# These intermediate files will not be removed. Ideally we'd want all *.stamp
# files to be preserved, but it seems that only explicitly named files can be
# preserved. I.e. %.stamp doesn't work.
.PRECIOUS: \
push-maint-74.stamp push-testenv-74.stamp \
build-testenv-74.stamp tag-testenv-74.stamp \
push-maint-73.stamp push-testenv-73.stamp \
build-testenv-73.stamp tag-testenv-73.stamp \
push-maint-72.stamp push-testenv-72.stamp \
build-testenv-72.stamp tag-testenv-72.stamp \
push-maint-71.stamp push-testenv-71.stamp \
build-testenv-71.stamp tag-testenv-71.stamp \
push-maint-63.stamp push-testenv-63.stamp \
build-testenv-63.stamp tag-testenv-63.stamp \
build-current.stamp push-current.stamp
v%.stamp: push-maint-%.stamp push-testenv-%.stamp
touch $@
# Use `make test` to test building various environments with local
# changes, and an unofficial tag. This target should not push.
test: Makefile \
build-buildenv.stamp tag-buildenv.stamp \
build-maint-74.stamp tag-maint-74.stamp \
build-current.stamp tag-current.stamp
.PHONY: test