Skip to content

Commit

Permalink
build: improve jobcontrol by adding "+" to called make
Browse files Browse the repository at this point in the history
This fixes errors "warning: jobserver unavailable: using -j1.  Add '+' to parent make rule"
(Issue #596). This all seems to be caused by our make not passing the relavant "jobserver"
flags down to the sub-make we call. As of the missing flags the sub-makes fall back to -j1.
Some reading on jobserver can be found: http://make.mad-scientist.net/papers/jobserver-implementation/
  • Loading branch information
SvenRoederer committed Jul 18, 2021
1 parent 1e57aec commit 30caf85
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ update-patches: .stamp-pre-patch .FORCE
# clean up openwrt working copy
openwrt-clean: stamp-clean-openwrt-cleaned .stamp-openwrt-cleaned
.stamp-openwrt-cleaned: config.mk | $(OPENWRT_DIR) openwrt-clean-bin
+
cd $(OPENWRT_DIR); \
./scripts/feeds clean && \
git clean -dff && git fetch && git reset --hard HEAD && \
Expand All @@ -81,7 +82,7 @@ openwrt-clean-bin:
# update feeds
feeds-update: stamp-clean-feeds-updated .stamp-feeds-updated
.stamp-feeds-updated: .stamp-patched
@
@+
$(UMASK); GLUON_SITEDIR='$(GLUON_SITEDIR)' scripts/feeds.sh
touch $@

Expand Down Expand Up @@ -122,6 +123,7 @@ $(OPENWRT_DIR)/files: $(FW_DIR)/embedded-files

# openwrt config
$(OPENWRT_DIR)/.config: .stamp-feeds-updated $(TARGET_CONFIG) .stamp-build_rev $(OPENWRT_DIR)/dl
+
cat $(TARGET_CONFIG) >$(OPENWRT_DIR)/.config
# always replace CONFIG_VERSION_CODE by FW_REVISION
sed -i "/^CONFIG_VERSION_CODE=/c\CONFIG_VERSION_CODE=\"$(FW_REVISION)\"" $(OPENWRT_DIR)/.config
Expand All @@ -136,6 +138,7 @@ prepare: stamp-clean-prepared .stamp-prepared
# compile
compile: stamp-clean-compiled .stamp-compiled
.stamp-compiled: .stamp-prepared openwrt-clean-bin
+
$(UMASK); \
$(MAKE) -C $(OPENWRT_DIR) $(MAKE_ARGS)
touch $@
Expand Down Expand Up @@ -200,9 +203,11 @@ images: .stamp-images
# prerequirement is a build OpenWRT
ifeq ($(origin IB_FILE),command line)
.stamp-images: $(FW_DIR)/embedded-files .FORCE
+
$(info IB_FILE explicitly defined; using it for building firmware-images)
else
.stamp-images: .stamp-compiled
+
$(info IB_FILE not defined; assuming called from inside regular build)
$(eval IB_FILE := $(shell ls -tr $(OPENWRT_DIR)/bin/targets/$(MAINTARGET)/$(SUBTARGET)/*-imagebuilder-*.tar.xz | tail -n1))
endif
Expand All @@ -219,6 +224,7 @@ endif
touch $@

setup-sdk: .stamp-patched
+
@if [ -z "$(SDK_FILE)" ]; then
echo Error: Please provide SDK-FILE by using "make SDK_FILE=<filename>"
exit 1
Expand Down
30 changes: 15 additions & 15 deletions Makefile.autobuild
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,49 @@ endif

download: info .autobuild_stamp-download .FORCE
.autobuild_stamp-download: $(OPENWRT_DIR)/.config
$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs download
+$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs download
touch $@

tools: .autobuild_stamp-download
$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs tools/install
+$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs tools/install
touch .autobuild_stamp-$@

toolchain:
$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs toolchain/install
+$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs toolchain/install
touch .autobuild_stamp-$@

kmods:
$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs target/compile
+$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs target/compile
touch .autobuild_stamp-$@

packages: .autobuild_stamp-packages .FORCE
.autobuild_stamp-packages:
$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs package/compile
$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs package/install
+$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs package/compile
+$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs package/install
touch $@

images: .autobuild_stamp-packages
$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs target/install
+$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs target/install
touch .autobuild_stamp-$@

linux:
$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs target/linux/install
+$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs target/linux/install
touch .autobuild_stamp-$@

imagebuilder:
$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs target/imagebuilder/install
+$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs target/imagebuilder/install
touch .autobuild_stamp-$@

sdk:
$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs target/sdk/install
+$(MAKE) -C $(OPENWRT_DIR) BUILD_LOG_DIR=$(FW_DIR)/logs target/sdk/install
touch .autobuild_stamp-$@

travis: $(OPENWRT_DIR)/.config
travis_wait $(MAKE) -C $(OPENWRT_DIR) toolchain/install
+travis_wait $(MAKE) -C $(OPENWRT_DIR) toolchain/install

buildbot: $(OPENWRT_DIR)/.config
$(MAKE) compile
$(MAKE) version-file
+$(MAKE) compile
+$(MAKE) version-file
# copy imagebuilder, sdk and toolchain (if existing)
# remove old versions
rm -rf $(FW_TARGET_DIR)
Expand All @@ -81,13 +81,13 @@ buildbot: $(OPENWRT_DIR)/.config
cp -a $(OPENWRT_DIR)/bin/packages $$PACKAGES_DIR/
rm -rf $(OPENWRT_DIR)
rm -rf $(FW_DIR)/dl
$(MAKE) IB_FILE=$(FW_TARGET_DIR)/*-imagebuilder-*.tar.xz images
+$(MAKE) IB_FILE=$(FW_TARGET_DIR)/*-imagebuilder-*.tar.xz images

config: info $(OPENWRT_DIR)/.config
$(OPENWRT_DIR)/.config: $(FW_DIR)/configs/common-autobuild.config
TARGET_CONFIG_AUTOBUILD=$(FW_DIR)/configs/common-autobuild.config
cat $(FW_DIR)/configs/common-autobuild.config >>$(FW_DIR)/configs/common.config
$(MAKE) prepare
+$(MAKE) prepare

next-buildstep-for-%:
# @echo this step: $*
Expand Down

0 comments on commit 30caf85

Please sign in to comment.