update busybox-power against BusyBox 1.21 release
[busybox-power] / debian / rules
index 70a983f..fb33451 100755 (executable)
@@ -14,7 +14,18 @@ ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
        CONFIG_DEBUG = y
 endif
 ifneq (,$(findstring thumb,$(DEB_BUILD_OPTIONS)))
-THUMB := -mthumb
+       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
@@ -38,6 +49,8 @@ $(STAMPS_DIR)/setup_%: $(STAMPS_DIR)/source
        rm -rf '$(DIR)'
        cp -al '$(SOURCE_DIR)' '$(DIR)'
        cp debian/config/config.$* '$(DIR)'/.config
+       grep -qv Diablo /etc/maemo_version \
+               || cp debian/config/config.$*.diablo '$(DIR)'/.config
        make -C '$(DIR)' oldconfig
        touch $@
 
@@ -46,7 +59,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 $@
 
@@ -71,9 +84,8 @@ binary-arch_busybox: $(STAMPS_DIR)/build_busybox
        dh_testdir
        dh_testroot
        dh_clean -k -d
+       install -D -m644 debian/scripts/applets debian/busybox-power/opt/busybox-power/applets
        install -D -m644 debian/scripts/functions debian/busybox-power/opt/busybox-power/functions
-       install -D -m755 debian/scripts/install-binary.sh debian/busybox-power/opt/busybox-power/install-binary.sh
-       install -D -m755 debian/scripts/uninstall-binary.sh debian/busybox-power/opt/busybox-power/uninstall-binary.sh
        install -D -m755 $(DIR)/busybox_unstripped debian/busybox-power/opt/busybox-power/busybox.power
 
 binary-arch_all: