Skip to content

Commit

Permalink
[config]: Add SONIC_CONFIG_MAKE_JOBS (#784)
Browse files Browse the repository at this point in the history
* [config]: Add SONIC_CONFIG_MAKE_JOBS

This config option allows user to specify -j value that will be passed
to each package build.

Signed-off-by: marian-pritsak <marianp@mellanox.com>
  • Loading branch information
marian-pritsak committed Jul 7, 2017
1 parent 96fe120 commit 51cab5d
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 11 deletions.
5 changes: 5 additions & 0 deletions rules/config
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
# container.
SONIC_CONFIG_BUILD_JOBS = 1

# SONIC_CONFIG_BUILD_JOBS - set number of jobs for number of jobs per package.
# Corresponding -j argument will be passed to make/dpkg commands that build separate packages
# container.
SONIC_CONFIG_MAKE_JOBS = $(shell nproc)

# SONIC_CONFIG_LOG_TO_FILES - print output from execution of rule for each
# target into separate log file under target/log/.
# Useful when executing parallel build
Expand Down
3 changes: 2 additions & 1 deletion slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ override PASSWORD := $(DEFAULT_PASSWORD)
endif

MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS)
export SONIC_CONFIG_MAKE_JOBS

###############################################################################
## Dumping key config attributes associated to current building exercise
Expand Down Expand Up @@ -178,7 +179,7 @@ $(addprefix $(DEBS_PATH)/, $(SONIC_DPKG_DEBS)) : $(DEBS_PATH)/% : .platform $$(a
if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && QUILT_PATCHES=../$(notdir $($*_SRC_PATH)).patch quilt push -a; popd; fi
pushd $($*_SRC_PATH) $(LOG)
[ ! -f ./autogen.sh ] || ./autogen.sh $(LOG)
dpkg-buildpackage -rfakeroot -b -us -uc $(LOG)
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) $(LOG)
popd $(LOG)
# clean up
if [ -f $($*_SRC_PATH).patch/series ]; then pushd $($*_SRC_PATH) && quilt pop -a -f; popd; fi
Expand Down
2 changes: 1 addition & 1 deletion src/hiredis/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :

dpkg-source -x hiredis_$(HIREDIS_VERSION_FULL).dsc
pushd hiredis-$(HIREDIS_VERSION)
fakeroot debian/rules binary
fakeroot debian/rules -j$(SONIC_CONFIG_MAKE_JOBS) binary
popd

mv $* $(DERIVED_TARGETS) $(DEST)/
Expand Down
2 changes: 1 addition & 1 deletion src/initramfs-tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :

# Build the package
rm -f debian/*.debhelper.log
dpkg-buildpackage -rfakeroot -b -us -uc
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS)
popd

mv $* $(DEST)/
2 changes: 1 addition & 1 deletion src/isc-dhcp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :

# Build source and Debian packages
pushd ./isc-dhcp
dpkg-buildpackage -rfakeroot -b -us -uc
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS)
popd

# Move the newly-built .deb packages to the destination directory
Expand Down
2 changes: 1 addition & 1 deletion src/libnl3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
quilt push
quilt push
quilt push
dpkg-buildpackage -rfakeroot -b -us -uc
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS)
popd

mv $(DERIVED_TARGETS) $* $(DEST)/
Expand Down
2 changes: 1 addition & 1 deletion src/libteam/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
mv tmp/debian libteam/
rm -rf tmp
pushd ./libteam
dpkg-buildpackage -rfakeroot -b -us -uc
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS)
popd

mv $(DERIVED_TARGETS) $* $(DEST)/
Expand Down
2 changes: 1 addition & 1 deletion src/mpdecimal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :

dpkg-source -x mpdecimal_$(MPDECIMAL_VERSION_FULL).dsc
pushd mpdecimal-$(MPDECIMAL_VERSION)
dpkg-buildpackage -us -uc -b
dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS)
popd

mv $* $(DERIVED_TARGETS) $(DEST)/
Expand Down
2 changes: 1 addition & 1 deletion src/python3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
fi
done

dpkg-buildpackage -rfakeroot -us -uc -b
dpkg-buildpackage -rfakeroot -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS)
popd

cp $(DERIVED_TARGETS) $* $(DEST)/
Expand Down
2 changes: 1 addition & 1 deletion src/redis/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
dpkg-source -x redis_$(REDIS_VERSION_FULL).dsc

pushd redis-$(REDIS_VERSION)
DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -us -uc -b
DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS)
popd

mv $(DERIVED_TARGETS) $* $(DEST)/
Expand Down
2 changes: 1 addition & 1 deletion src/snmpd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
dpkg-source -x net-snmp_$(SNMPD_VERSION_FULL).dsc

pushd net-snmp-$(SNMPD_VERSION)
fakeroot debian/rules binary
fakeroot debian/rules -j$(SONIC_CONFIG_MAKE_JOBS) binary
popd

mv $(DERIVED_TARGETS) $* $(DEST)/
Expand Down
2 changes: 1 addition & 1 deletion src/thrift/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
dpkg-source -x thrift_$(THRIFT_VERSION_FULL).dsc
pushd thrift-$(THRIFT_VERSION)
patch -p1 < ../patch/THRIFT-3577-assertion-failed.patch
DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -d -rfakeroot -b -us -uc
DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -d -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS)
popd

mv $(DERIVED_TARGETS) $* $(DEST)/
Expand Down

0 comments on commit 51cab5d

Please sign in to comment.