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 source: $(STAMPS_DIR)/source
22 $(STAMPS_DIR)/source: SOURCE_FILES = $(filter-out debian, $(wildcard * .[^.]*))
23 $(STAMPS_DIR)/source: DIR = $(BUILD_DIR)/source
27 mkdir -p $(STAMPS_DIR) '$(DIR)'
28 cp -al $(SOURCE_FILES) '$(DIR)'
29 cd $(DIR); QUILT_PATCHES=$(CURDIR)/debian/patches quilt --quiltrc /dev/null push -a || test $$? = 2
32 #setup: $(STAMPS_DIR)/setup_deb $(STAMPS_DIR)/setup_udeb
33 setup: $(STAMPS_DIR)/setup_maemo
35 $(STAMPS_DIR)/setup_%: SOURCE_DIR=$(BUILD_DIR)/source
36 $(STAMPS_DIR)/setup_%: DIR=$(BUILD_DIR)/build_$*
37 $(STAMPS_DIR)/setup_%: $(STAMPS_DIR)/source
40 cp -al '$(SOURCE_DIR)' '$(DIR)'
41 cp debian/config/config.$* '$(DIR)'/.config
42 make -C '$(DIR)' oldconfig
45 #build: $(STAMPS_DIR)/build_deb $(STAMPS_DIR)/build_static $(STAMPS_DIR)/build_udeb
46 build: $(STAMPS_DIR)/build_maemo
48 $(STAMPS_DIR)/build_maemo : debian/sfdisk/sfdisk
49 $(STAMPS_DIR)/build_%: DIR=$(BUILD_DIR)/build_$*
50 $(STAMPS_DIR)/build_%: $(STAMPS_DIR)/setup_%
52 make -C '$(DIR)' THUMB=$(THUMB) busybox docs/busybox.1 BB_EXTRA_VERSION="$(shell lsb_release -is) $(VERSION_DEBIAN)"
53 make -C '$(DIR)' busybox.links
57 $(MAKE) -C debian/sfdisk
59 $(BUILD_DIR) $(STAMPS_DIR):
60 @[ -d $@ ] || mkdir $@
63 rm -rf $(filter-out .svn debian, $(wildcard * .[^.]*))
67 rm -rf $(BUILD_DIR) $(STAMPS_DIR)
68 $(MAKE) -C debian/sfdisk clean
73 #binary-arch: binary-arch_deb binary-arch_static binary-arch_udeb
74 binary-arch: binary-arch_maemo
76 binary-arch_maemo: DIR = $(BUILD_DIR)/build_maemo
77 binary-arch_maemo: DH_OPTIONS = -pbusybox
78 binary-arch_maemo: $(STAMPS_DIR)/build_maemo
82 install -D -m755 debian/sfdisk/sfdisk debian/busybox/sbin/sfdisk
83 install -D -m755 debian/local/tempfile debian/busybox/bin/tempfile
84 install -D -m755 $(DIR)/busybox_unstripped debian/busybox/bin/busybox
85 sed -e 's,^/,bin/busybox ,' $(DIR)/busybox.links | grep -v linuxrc > debian/busybox.links
87 $(MAKE) -f debian/rules binary-arch_all
89 binary-arch_deb: DIR = $(BUILD_DIR)/build_deb
90 binary-arch_deb: export DH_OPTIONS = -pbusybox
91 binary-arch_deb: $(STAMPS_DIR)/build_deb
95 dh_install --sourcedir=$(DIR)
96 $(MAKE) -f debian/rules binary-arch_all
98 binary-arch_static: PACKAGE = busybox-static
99 binary-arch_static: DIR = $(BUILD_DIR)/build_static
100 binary-arch_static: export DH_OPTIONS = -p$(PACKAGE)
101 binary-arch_static: $(STAMPS_DIR)/build_static
105 dh_install --sourcedir=$(DIR)
106 install -D -m644 debian/$(PACKAGE).override \
107 debian/$(PACKAGE)/usr/share/lintian/overrides/$(PACKAGE)
108 $(MAKE) -f debian/rules binary-arch_all
110 binary-arch_udeb: PACKAGE = busybox-udeb
111 binary-arch_udeb: DIR = $(BUILD_DIR)/build_udeb
112 binary-arch_udeb: OUT_DIR = $(CURDIR)/debian/$(PACKAGE)
113 binary-arch_udeb: export DH_OPTIONS = -p$(PACKAGE)
114 binary-arch_udeb: $(STAMPS_DIR)/build_udeb
118 make -C $(DIR) install CONFIG_PREFIX=$(OUT_DIR)
119 # Remove init link, but init support is still compiled in to be
121 rm -f $(OUT_DIR)/sbin/init
122 $(MAKE) -f debian/rules binary-arch_all
128 dh_strip --dbg-package=busybox-dbg
138 binary: binary-indep binary-arch
140 DIR_ORIG = ../orig/$(SOURCE)-$(VERSION)
141 TAR_ORIG_NAME = $(SOURCE)_$(VERSION).orig.tar.gz
142 TAR_ORIG = $(firstword $(wildcard ../$(TAR_ORIG_NAME)) $(wildcard ../orig/$(TAR_ORIG_NAME)))
145 rsync --delete --exclude debian --exclude .svk --exclude .svn --link-dest=$(DIR_ORIG)/ -a $(DIR_ORIG)/ .
149 $(error Cannot find orig tarball $(TAR_ORIG_NAME))
152 tar -C ../orig -xzf $(TAR_ORIG)