4 DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
5 DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
6 SOURCE := $(shell dpkg-parsechangelog | sed -ne 's,^Source: *\(.*\)$$,\1,p')
7 VERSION_DEBIAN := $(shell dpkg-parsechangelog | sed -ne 's,^Version: *\(.*\)$$,\1,p')
8 VERSION := $(shell echo "$(VERSION_DEBIAN)" | sed -e 's,^[^:]*:,,' -e 's,-[^-]*$$,,')
10 BUILD_DIR = debian/build
11 STAMPS_DIR = debian/stamps
13 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
16 ifneq (,$(findstring thumb,$(DEB_BUILD_OPTIONS)))
20 ifneq (,$(findstring parallel,$(DEB_BUILD_OPTIONS)))
21 PARALLEL_JOBS := $(shell echo $(DEB_BUILD_OPTIONS) | \
22 sed -e 's/.*parallel=\([0-9]\+\).*/\1/')
23 ifeq ($(DEB_BUILD_OPTIONS),$(PARALLEL_JOBS))
24 PARALLEL_JOBS := $(shell if [ -f /proc/cpuinfo ]; \
25 then echo `cat /proc/cpuinfo | grep 'processor' | wc -l`; \
28 NJOBS := -j$(PARALLEL_JOBS)
31 source: $(STAMPS_DIR)/source
33 $(STAMPS_DIR)/source: SOURCE_FILES = $(filter-out debian, $(wildcard * .[^.]*))
34 $(STAMPS_DIR)/source: DIR = $(BUILD_DIR)/source
38 mkdir -p $(STAMPS_DIR) '$(DIR)'
39 cp -al $(SOURCE_FILES) '$(DIR)'
40 cd $(DIR); QUILT_PATCHES=$(CURDIR)/debian/patches quilt --quiltrc /dev/null push -a || test $$? = 2
43 setup: $(STAMPS_DIR)/setup_busybox $(STAMPS_DIR)/setup_busybox-althist
45 $(STAMPS_DIR)/setup_%: SOURCE_DIR=$(BUILD_DIR)/source
46 $(STAMPS_DIR)/setup_%: DIR=$(BUILD_DIR)/build_$*
47 $(STAMPS_DIR)/setup_%: $(STAMPS_DIR)/source
50 cp -al '$(SOURCE_DIR)' '$(DIR)'
51 cp debian/config/config.busybox '$(DIR)'/.config
52 if test "$*" == "busybox-althist"; then \
53 sed -i "s/CONFIG_FEATURE_EDITING_SAVE_ON_EXIT=y/# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set/" '$(DIR)'/.config; fi
54 make -C '$(DIR)' oldconfig
57 build: $(STAMPS_DIR)/build_busybox $(STAMPS_DIR)/build_busybox-althist
59 $(STAMPS_DIR)/build_%: DIR=$(BUILD_DIR)/build_$*
60 $(STAMPS_DIR)/build_%: $(STAMPS_DIR)/setup_%
62 make -C '$(DIR)' $(NJOBS) THUMB=$(THUMB) busybox docs/busybox.1 BB_EXTRA_VERSION="$(shell lsb_release -is) $(VERSION_DEBIAN)"
63 make -C '$(DIR)' busybox.links
66 $(BUILD_DIR) $(STAMPS_DIR):
67 @[ -d $@ ] || mkdir $@
70 rm -rf $(filter-out .svn debian, $(wildcard * .[^.]*))
74 rm -rf $(BUILD_DIR) $(STAMPS_DIR)
76 rm -rf debian/busybox-power-althistory*
80 binary-arch: binary-arch_busybox binary-arch_busybox-althist binary-arch_all
82 binary-arch_busybox: DIR = $(BUILD_DIR)/build_busybox
83 binary-arch_busybox: DH_OPTIONS = -pbusybox-power
84 binary-arch_busybox: $(STAMPS_DIR)/build_busybox
87 install -D -m644 debian/scripts/applets debian/busybox-power/opt/busybox-power/applets
88 install -D -m644 debian/scripts/functions debian/busybox-power/opt/busybox-power/functions
89 install -D -m755 $(DIR)/busybox_unstripped debian/busybox-power/opt/busybox-power/busybox.power
91 binary-arch_busybox-althist: DIR = $(BUILD_DIR)/build_busybox-althist
92 binary-arch_busybox-althist: DH_OPTIONS = -pbusybox-power-althist
93 binary-arch_busybox-althist: $(STAMPS_DIR)/build_busybox-althist
96 # busybox-power-althist == busybox-power, only BusyBox' .config differs
97 # Duplicate the maintainer scripts etc. into busybox-power-althist
98 for f in debian/busybox-power.*; do cp -p "$$f" "$${f/busybox-power/busybox-power-althist}"; done
99 install -D -m644 debian/scripts/applets debian/busybox-power-althist/opt/busybox-power/applets
100 install -D -m644 debian/scripts/functions debian/busybox-power-althist/opt/busybox-power/functions
101 install -D -m755 $(DIR)/busybox_unstripped debian/busybox-power-althist/opt/busybox-power/busybox.power
119 binary: binary-indep binary-arch
121 DIR_ORIG = ../orig/$(SOURCE)-$(VERSION)
122 TAR_ORIG_NAME = $(SOURCE)_$(VERSION).orig.tar.gz
123 TAR_ORIG = $(firstword $(wildcard ../$(TAR_ORIG_NAME)) $(wildcard ../orig/$(TAR_ORIG_NAME)))
126 rsync --delete --exclude debian --exclude .svk --exclude .svn --link-dest=$(DIR_ORIG)/ -a $(DIR_ORIG)/ .
130 $(error Cannot find orig tarball $(TAR_ORIG_NAME))
133 tar -C ../orig -xzf $(TAR_ORIG)