Skip to content

Commit 175b952

Browse files
[slave.mk]: Add list target (#856)
Add new target to list all available packages, files, docker images and installers. Signed-off-by: marian-pritsak <[email protected]>
1 parent 382d528 commit 175b952

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

README.buildsystem.md

+5
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,9 @@ sonic-slave environment is built only once, but if sonic-slave/Dockerfile was up
201201
$ make sonic-slave-build
202202
```
203203
204+
One can print out all available targets by executing the following command:
205+
```
206+
$ make list
207+
```
208+
204209
All target groups are used by one or another recipe, so use those recipes as a reference when adding new ones.

slave.mk

+29
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ configure :
5252
distclean : .platform clean
5353
@rm -f .platform
5454

55+
list :
56+
@$(foreach target,$(SONIC_TARGET_LIST),echo $(target);)
57+
5558
###############################################################################
5659
## Include other rules
5760
###############################################################################
@@ -118,6 +121,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_COPY_DEBS)) : $(DEBS_PATH)/% : .platform
118121
{ cp $($(deb)_PATH)/$(deb) $(DEBS_PATH)/ $(LOG) || exit 1 ; } ; )
119122
$(FOOTER)
120123

124+
SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_COPY_DEBS))
125+
121126
# Copy regular files from local directory
122127
# Add new package for copy:
123128
# SOME_NEW_FILE = some_new_file
@@ -128,6 +133,8 @@ $(addprefix $(FILES_PATH)/, $(SONIC_COPY_FILES)) : $(FILES_PATH)/% : .platform
128133
cp $($*_PATH)/$* $(FILES_PATH)/ $(LOG) || exit 1
129134
$(FOOTER)
130135

136+
SONIC_TARGET_LIST += $(addprefix $(FILES_PATH)/, $(SONIC_COPY_FILES))
137+
131138
###############################################################################
132139
## Online targets
133140
###############################################################################
@@ -143,6 +150,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_DEBS)) : $(DEBS_PATH)/% : .platform
143150
{ wget --no-use-server-timestamps -O $(DEBS_PATH)/$(deb) $($(deb)_URL) $(LOG) || exit 1 ; } ; )
144151
$(FOOTER)
145152

153+
SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_ONLINE_DEBS))
154+
146155
# Download regular files from online location
147156
# Files are stored in deb packages directory for convenience
148157
# Add new file for download:
@@ -154,6 +163,8 @@ $(addprefix $(FILES_PATH)/, $(SONIC_ONLINE_FILES)) : $(FILES_PATH)/% : .platform
154163
wget --no-use-server-timestamps -O $@ $($*_URL) $(LOG)
155164
$(FOOTER)
156165

166+
SONIC_TARGET_LIST += $(addprefix $(FILES_PATH)/, $(SONIC_ONLINE_FILES))
167+
157168
###############################################################################
158169
## Debian package related targets
159170
###############################################################################
@@ -178,6 +189,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS)) : $(DEBS_PATH)/% : .platform $$(a
178189
if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi
179190
$(FOOTER)
180191

192+
SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_MAKE_DEBS))
193+
181194
# Build project with dpkg-buildpackage
182195
# Add new package for build:
183196
# SOME_NEW_DEB = some_new_deb.deb
@@ -199,6 +212,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(a
199212
mv $(addprefix $($*_SRC_PATH)/../, $* $($*_DERIVED_DEBS) $($*_EXTRA_DEBS)) $(DEBS_PATH) $(LOG)
200213
$(FOOTER)
201214

215+
SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS))
216+
202217
# Build project with python setup.py --command-packages=stdeb.command
203218
# Add new package for build:
204219
# SOME_NEW_DEB = some_new_deb.deb
@@ -214,6 +229,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_PYTHON_STDEB_DEBS)) : $(DEBS_PATH)/% : .platf
214229
mv $(addprefix $($*_SRC_PATH)/deb_dist/, $* $($*_DERIVED_DEBS)) $(DEBS_PATH) $(LOG)
215230
$(FOOTER)
216231

232+
SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_PYTHON_STDEB_DEBS))
233+
217234
# Rules for derived debian packages (dev, dbg, etc.)
218235
# All noise takes place in main deb recipe, so we are just telling that
219236
# we depend on it and move our deb to other targets
@@ -227,6 +244,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DERIVED_DEBS)) : $(DEBS_PATH)/% : .platform $
227244
[ -f $@ ] && touch $@
228245
$(FOOTER)
229246

247+
SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_DERIVED_DEBS))
248+
230249
# Rules for extra debian packages
231250
# All noise takes place in main deb recipe, so we are just telling that
232251
# we need to build the main deb and move our deb to other targets
@@ -240,6 +259,8 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_EXTRA_DEBS)) : $(DEBS_PATH)/% : .platform $$(
240259
[ -f $@ ] && touch $@
241260
$(FOOTER)
242261

262+
SONIC_TARGET_LIST += $(addprefix $(DEBS_PATH)/, $(SONIC_EXTRA_DEBS))
263+
243264
# Targets for installing debian packages prior to build one that depends on them
244265
SONIC_INSTALL_TARGETS = $(addsuffix -install,$(addprefix $(DEBS_PATH)/, \
245266
$(SONIC_ONLINE_DEBS) \
@@ -285,6 +306,8 @@ $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)) : $(PYTHON_WHEELS_PA
285306
mv $($*_SRC_PATH)/dist/$* $(PYTHON_WHEELS_PATH) $(LOG)
286307
$(FOOTER)
287308

309+
SONIC_TARGET_LIST += $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS))
310+
288311
# Targets for installing python wheels.
289312
# Autogenerated
290313
SONIC_INSTALL_WHEELS = $(addsuffix -install, $(addprefix $(PYTHON_WHEELS_PATH)/, $(SONIC_PYTHON_WHEELS)))
@@ -314,6 +337,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g
314337
docker save $* | gzip -c > $@
315338
$(FOOTER)
316339

340+
SONIC_TARGET_LIST += $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES))
341+
317342
# Targets for building docker images
318343
$(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addprefix $(DEBS_PATH)/,$$($$*.gz_DEPENDS)) $$(addprefix $(FILES_PATH)/,$$($$*.gz_FILES)) $$(addprefix $(PYTHON_WHEELS_PATH)/,$$($$*.gz_PYTHON_WHEELS)) $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS))) $$($$*.gz_PATH)/Dockerfile.j2
319344
$(HEADER)
@@ -332,6 +357,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl
332357
docker save $* | gzip -c > $@
333358
$(FOOTER)
334359

360+
SONIC_TARGET_LIST += $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES))
361+
335362
DOCKER_LOAD_TARGETS = $(addsuffix -load,$(addprefix $(TARGET_PATH)/, \
336363
$(SONIC_SIMPLE_DOCKER_IMAGES) \
337364
$(SONIC_DOCKER_IMAGES)))
@@ -401,6 +428,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform
401428
chmod a+x $@
402429
$(FOOTER)
403430

431+
SONIC_TARGET_LIST += $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS))
432+
404433
###############################################################################
405434
## Clean targets
406435
###############################################################################

0 commit comments

Comments
 (0)