From 0e9ccdb10a34550ba7bb971ca8d7bbb90f80f020 Mon Sep 17 00:00:00 2001 From: Dennis Groenen Date: Sun, 5 Feb 2012 14:29:37 +0100 Subject: [PATCH] fix multithreaded building --- debian/rules | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 6a83a53..e0a7f6a 100755 --- a/debian/rules +++ b/debian/rules @@ -17,6 +17,17 @@ ifneq (,$(findstring thumb,$(DEB_BUILD_OPTIONS))) THUMB := -mthumb endif +ifneq (,$(findstring parallel,$(DEB_BUILD_OPTIONS))) + PARALLEL_JOBS := $(shell echo $(DEB_BUILD_OPTIONS) | \ + sed -e 's/.*parallel=\([0-9]\+\).*/\1/') + ifeq ($(DEB_BUILD_OPTIONS),$(PARALLEL_JOBS)) + PARALLEL_JOBS := $(shell if [ -f /proc/cpuinfo ]; \ + then echo `cat /proc/cpuinfo | grep 'processor' | wc -l`; \ + else echo 1; fi) + endif + NJOBS := -j$(PARALLEL_JOBS) +endif + source: $(STAMPS_DIR)/source $(STAMPS_DIR)/source: SOURCE_FILES = $(filter-out debian, $(wildcard * .[^.]*)) @@ -46,7 +57,7 @@ build: $(STAMPS_DIR)/build_busybox $(STAMPS_DIR)/build_%: DIR=$(BUILD_DIR)/build_$* $(STAMPS_DIR)/build_%: $(STAMPS_DIR)/setup_% dh_testdir - make -C '$(DIR)' THUMB=$(THUMB) busybox docs/busybox.1 BB_EXTRA_VERSION="$(shell lsb_release -is) $(VERSION_DEBIAN)" + make -C '$(DIR)' $(NJOBS) THUMB=$(THUMB) busybox docs/busybox.1 BB_EXTRA_VERSION="$(shell lsb_release -is) $(VERSION_DEBIAN)" make -C '$(DIR)' busybox.links touch $@ -- 1.7.9.5