1
1
# Base Makefile for building all images and tagging them
2
2
3
+ # List of external Make targets:
4
+ #
5
+ # FIXME: Are there any missing from this list? Are there any here which can/should be removed (e.g., the last two)??
6
+ #
7
+ # These act on all default platforms' containers:
8
+ #
9
+ # all (default): make all images for all default platforms
10
+ # tds: make Tool Data Sink images for all default platforms
11
+ # tm: make Tool Meister images for all default platforms
12
+ # tag-<TYPE> (e.g., "tag-latest"): apply specified tag to all images for all default platforms
13
+ # push: push images for all default platforms with "<git commit hash>" and "v<full RPM version>" tags
14
+ # push-<TYPE> (e.g., "push-latest"): push images for all default platforms with specified tag
15
+ #
16
+ # These act on the indicated distribution's containers:
17
+ #
18
+ # <DISTRO> (e.g., "fedora-34"): make all images for the requested platform
19
+ # <DISTRO>-tds (e.g., "fedora-34-tds"): make the TDS image for the requested platform
20
+ # <DISTRO>-tm (e.g., "fedora-34-tds"): make the TDS image for the requested platform
21
+ # <DISTRO>-tag-<TYPE> (e.g., "fedora-34-tag-alpha"): apply the specified tag to the distro containers
22
+ #
23
+ # Utility targets:
24
+ #
25
+ # clean: remove build artifacts
26
+ # pkgmgr-clean: clear the local package manager cache
27
+ # all-tags: build all default distro "-tags.lis" files and verify that they are consistent.
28
+ # all-dockerfiles: build all default distro ".repo" and ".Dockerfile" files
29
+ #
30
+
3
31
# By default we only build images for x86_64 architectures.
4
32
_ARCH = x86_64
5
33
@@ -80,7 +108,7 @@ _WORKLOAD_RPMS = fio uperf
80
108
# Not intended to be overridden with an environment variable.
81
109
_ALL_RPMS = ${_TOOL_RPMS} ${_WORKLOAD_RPMS}
82
110
83
- # Compose a lists of all conceivable distro-version strings (e.g.,
111
+ # Compose lists of all conceivable distro-version strings (e.g.,
84
112
# `_ALL_centos_VERSIONS` including "centos-7", "centos-8", "centos-9",
85
113
# `_ALL_fedora_VERSIONS` including "fedora-32", "fedora-33", and "fedora-34",
86
114
# and `_DISTROS` containing the contents of all the lists) which will be used
@@ -89,18 +117,18 @@ _DIGITS := 0 1 2 3 4 5 6 7 8 9
89
117
_NUMBERS := $(patsubst 0% ,% ,$(foreach t,${_DIGITS},$(foreach o,${_DIGITS},${t}${o}) ) )
90
118
_ALL_DISTRO_NAMES := centos fedora
91
119
_ADV_TMPL = _ALL_${d}_VERSIONS := $(foreach v,${_NUMBERS},${d}-${v}) # template for setting version lists
92
- $(foreach d,${_ALL_DISTRO_NAMES},$(eval $(call _ADV_TMPL, $d ) ) ) # set _ALL_centos_VERSIONS, etc.
120
+ $(foreach d,${_ALL_DISTRO_NAMES},$(eval $(call _ADV_TMPL, ${d} ) ) ) # set _ALL_centos_VERSIONS, etc.
93
121
_DISTROS := $(foreach d,${_ALL_DISTRO_NAMES},${_ALL_${d}_VERSIONS})
94
122
95
123
# By default we only build images for the following distributions:
96
124
_DEFAULT_DISTROS = centos-8 fedora-33 fedora-34
97
125
98
126
# By default we won't build the Tool Data Sink and Tool Meister images
99
- all : pkgmgr-clean all-tags $(foreach distro, ${ _DEFAULT_DISTROS}, ${distro} -all-tagged)
127
+ all : pkgmgr-clean all-tags $(_DEFAULT_DISTROS:%=% -all-tagged )
100
128
101
- tds : pkgmgr-clean all-tags $(foreach distro, ${ _DEFAULT_DISTROS}, ${distro} -tool-data-sink-tagged)
129
+ tds : pkgmgr-clean all-tags $(_DEFAULT_DISTROS:%=% -tool-data-sink-tagged )
102
130
103
- tm : pkgmgr-clean all-tags $(foreach distro, ${ _DEFAULT_DISTROS}, ${distro} -tool-meister-tagged)
131
+ tm : pkgmgr-clean all-tags $(_DEFAULT_DISTROS:%=% -tool-meister-tagged )
104
132
105
133
# +
106
134
# For the following rule patterns, the "%" represents the "distribution" name,
@@ -112,15 +140,18 @@ tm: pkgmgr-clean all-tags $(foreach distro, ${_DEFAULT_DISTROS}, ${distro}-tool-
112
140
# See https://www.gnu.org/software/make/manual/make.html#Automatic-Variables
113
141
# -
114
142
115
- % : DIST_NAME = $(wordlist 1, 1, $(subst -, ,$* ) )
116
- % : DIST_VERSION = $(wordlist 2, 2, $(subst -, ,$* ) )
117
-
118
143
# We also offer targets per distribution target
119
144
${_DISTROS} : % : pkgmgr-clean % -all-tagged
120
145
121
- % -tds : pkgmgr-clean % -tool-data-sink-tagged
146
+ $(_DISTROS:% =%-tds): %-tds: pkgmgr-clean %-tool-data-sink-tagged
122
147
123
- % -tm : pkgmgr-clean % -tool-meister-tagged
148
+ $(_DISTROS:% =%-tm): %-tm: pkgmgr-clean %-tool-meister-tagged
149
+
150
+ # For any given target, extract the distribution name and version from the
151
+ # first two fields, e.g., fedora-35-tds would yield values "fedora" and "35"
152
+ # for DIST_NAME and DIST_VERSION, respectively.
153
+ % : DIST_NAME = $(wordlist 1, 1, $(subst -, ,$* ) )
154
+ % : DIST_VERSION = $(wordlist 2, 2, $(subst -, ,$* ) )
124
155
125
156
126
157
# Tagging targets
@@ -131,18 +162,18 @@ ${_DISTROS}: %: pkgmgr-clean %-all-tagged
131
162
#
132
163
# See the `tagit` script for details.
133
164
_TAG_TYPES = latest alpha beta major major-minor
134
- tag-% : $( foreach distro, ${ _DEFAULT_DISTROS}, ${distro} -tag-% )
165
+ $(_TAG_TYPES:% = tag-%): tag-%: $( _DEFAULT_DISTROS:%=% -tag-% )
135
166
136
167
137
168
# +
138
169
# Push targets
139
170
# -
140
171
141
172
# Push images with "<git commit hash>" and "v<full RPM version>" tags.
142
- push : $(foreach distro, ${ _DEFAULT_DISTROS}, ${distro} -push)
173
+ push : $(_DEFAULT_DISTROS:%=% -push )
143
174
144
175
# Push images with a specific tag (see the `tag-%` target).
145
- push-% : $( foreach distro, ${ _DEFAULT_DISTROS}, ${distro} -push-% )
176
+ $(_TAG_TYPES:% = push-%): push-%: $( _DEFAULT_DISTROS:%=% -push-% )
146
177
147
178
148
179
# +
@@ -182,7 +213,7 @@ push-%: $(foreach distro, ${_DEFAULT_DISTROS}, ${distro}-push-%)
182
213
183
214
# Add an additional dependency for centos-%-tools targets (this .repo file is
184
215
# not required on Fedora).
185
- $(foreach d,${ _ALL_centos_VERSIONS},${d} -tools) : centos-% -tools: centos-% -prometheus.repo
216
+ $(_ALL_centos_VERSIONS:% =% -tools): centos-%-tools: centos-%-prometheus.repo
186
217
187
218
% -tools : % -base-tagged % -tools.Dockerfile % -pcp.repo % -tags.lis
188
219
./build-image tools $* $* -tags.lis
@@ -216,7 +247,7 @@ define _PUSH_RULE
216
247
./push ${IMAGE_REPO} $$* $(1 )
217
248
endef
218
249
219
- $(foreach tagtype,${_TAG_TYPES},$(eval $(call _PUSH_RULE,$tagtype))) # Define rules
250
+ $(foreach tagtype,${_TAG_TYPES},$(eval $(call _PUSH_RULE,${ tagtype} ))) # Define rules
220
251
221
252
% -push : % -tags.lis
222
253
./push ${IMAGE_REPO} $*
@@ -228,12 +259,14 @@ $(foreach tagtype,${_TAG_TYPES},$(eval $(call _PUSH_RULE,$tagtype))) # Define r
228
259
# of "v<Major>.<Minor>-latest".
229
260
# -
230
261
262
+ # $(_DISTROS:%=%-tag-$(1)):
263
+
231
264
define _TAG_RULE
232
265
%-tag-$(1 ) : %-tags.lis
233
266
./tagit $$* $(1 )$(if $(findstring major,$(1 ) ) ,-latest)
234
267
endef
235
268
236
- $(foreach tagtype,${_TAG_TYPES},$(eval $(call _TAG_RULE,$tagtype))) # Define rules
269
+ $(foreach tagtype,${_TAG_TYPES},$(eval $(call _TAG_RULE,${ tagtype} ))) # Define rules
237
270
238
271
# Build the tags file for the given distribution.
239
272
% -tags.lis :
@@ -272,14 +305,12 @@ fedora-%-base.Dockerfile: Dockerfile.base.j2
272
305
273
306
# Helper target to build each distro's ".repo" and ".Dockerfile"
274
307
all-dockerfiles : \
275
- $(foreach distro, \
276
- ${_DEFAULT_DISTROS}, \
277
- ${distro}-base.Dockerfile ${distro}-tools.Dockerfile \
278
- ${distro}-workloads.Dockerfile ${distro}-all.Dockerfile)
308
+ $(_DEFAULT_DISTROS:% =%-base.Dockerfile) $(_DEFAULT_DISTROS:%=%-tools.Dockerfile ) \
309
+ $(_DEFAULT_DISTROS:%=%-workloads.Dockerfile ) $(_DEFAULT_DISTROS:%=%-all.Dockerfile )
279
310
280
311
# Helper target to build each distro's "-tags.lis" file and verify they
281
312
# are consistent.
282
- all-tags : pkgmgr-clean $(foreach distro, ${ _DEFAULT_DISTROS}, ${distro} -tags.lis)
313
+ all-tags : pkgmgr-clean $(_DEFAULT_DISTROS:%=% -tags.lis )
283
314
./verify-tags * -tags.lis
284
315
285
316
% -pbench.repo : % -pbench.yml ${_PBENCH_REPO_TEMPLATE}
0 commit comments