3 # Uncomment this to turn on verbose mode.
6 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
7 DEB_HOST_GNU_CPU ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
8 DEB_HOST_GNU_SYSTEM ?= $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
10 VERSION = $(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
12 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
15 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
18 PACKAGE_PREFIX = busybox-cvs
20 ARCH_FLOPPY_UDEB = $(shell sh debian/control-extract Architecture $(PACKAGE_PREFIX)-floppy-udeb)
22 PACKAGES_DEB = $(PACKAGE_PREFIX) $(PACKAGE_PREFIX)-static
23 PACKAGES_UDEB = $(PACKAGE_PREFIX)-udeb
24 ifneq ($(filter $(DEB_HOST_ARCH),$(ARCH_FLOPPY_UDEB)),)
25 PACKAGES_UDEB += $(PACKAGE_PREFIX)-floppy-udeb
27 PACKAGES = $(PACKAGES_DEB) $(PACKAGES_UDEB)
29 DEBHELPER_PACKAGES_DEB = $(patsubst %,-p%,$(PACKAGES_DEB))
30 DEBHELPER_PACKAGES_UDEB = $(patsubst %,-p%,$(PACKAGES_UDEB))
32 CONFIG = $(firstword $(wildcard ./debian/config-$(1)-$(DEB_HOST_GNU_SYSTEM)-$(DEB_HOST_GNU_CPU) ./debian/config-$(1)-$(DEB_HOST_GNU_SYSTEM) ./debian/config-$(1)))
33 CONFIG_DEB = $(call CONFIG,deb)
34 CONFIG_STATIC = $(call CONFIG,static)
35 CONFIG_UDEB = $(call CONFIG,udeb)
36 CONFIG_FLOPPY_UDEB = $(call CONFIG,floppy-udeb)
38 configure: configure-stamp
44 build-arch: build-arch-deb-all build-arch-udeb-all
45 build-arch-deb-all: build-arch-deb build-arch-static build-arch-doc
46 build-arch-udeb-all: build-arch-udeb build-arch-floppy-udeb
48 build-arch-deb: build-arch-deb-stamp
49 build-arch-deb-stamp: configure-stamp
52 cp $(CONFIG_DEB) .config
55 $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
57 install -d install-$(PACKAGE_PREFIX)/bin
58 install busybox install-$(PACKAGE_PREFIX)/bin/busybox
62 build-arch-static: build-arch-static-stamp
63 build-arch-static-stamp: configure-stamp
66 cp $(CONFIG_STATIC) .config
69 $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
71 install -d install-$(PACKAGE_PREFIX)-static/bin
72 install busybox install-$(PACKAGE_PREFIX)-static/bin/busybox
76 build-arch-udeb: build-arch-udeb-stamp
77 build-arch-udeb-stamp: configure-stamp
80 cp $(CONFIG_UDEB) .config
83 $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
85 $(MAKE) PREFIX=$(CURDIR)/install-$(PACKAGE_PREFIX)-udeb install
86 # Remove init link, but init support is still compiled in to be
88 rm -f $(CURDIR)/install-$(PACKAGE_PREFIX)-udeb/sbin/init
92 build-arch-floppy-udeb: build-arch-floppy-udeb-stamp
93 build-arch-floppy-udeb-stamp: configure-stamp
94 ifneq ($(filter $(DEB_HOST_ARCH),$(ARCH_FLOPPY_UDEB)),)
97 cp $(CONFIG_FLOPPY_UDEB) .config
100 $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
102 $(MAKE) PREFIX=$(CURDIR)/install-$(PACKAGE_PREFIX)-floppy-udeb install
107 build-arch-doc: build-arch-doc-stamp
108 build-arch-doc-stamp: configure-stamp
109 $(MAKE) docs/BusyBox.1
111 cp docs/BusyBox.1 busybox.1
120 rm -f build-*-stamp configure-stamp debian/files~
123 -rm -rf busybox-deb busybox-static install* busybox.1
127 install-deb: build-arch-deb-all
130 dh_clean -k $(DEBHELPER_PACKAGES_DEB)
131 dh_installdirs $(DEBHELPER_PACKAGES_DEB)
133 for i in $(PACKAGES_DEB); do \
136 find -type d -exec install -d $(CURDIR)/debian/$$i/{} \;; \
137 find \( -type f -o -type l \) -exec cp -a {} $(CURDIR)/debian/$$i/{} \;; \
141 install -m644 debian/$(PACKAGE_PREFIX)-static.override \
142 debian/$(PACKAGE_PREFIX)-static/usr/share/lintian/overrides/$(PACKAGE_PREFIX)-static
144 install-udeb: build-arch-udeb-all
147 dh_clean -k $(DEBHELPER_PACKAGES_UDEB)
148 dh_installdirs $(DEBHELPER_PACKAGES_UDEB)
150 for i in $(PACKAGES_UDEB); do \
153 find -type d -exec install -d $(CURDIR)/debian/$$i/{} \;; \
154 find \( -type f -o -type l \) -exec cp -a {} $(CURDIR)/debian/$$i/{} \;; \
158 binary-arch: binary-arch-deb binary-arch-udeb
160 # Build architecture-dependent files here.
161 binary-arch-deb: build-arch-deb-all install-deb
164 dh_installdocs $(DEBHELPER_PACKAGES_DEB)
165 dh_installman $(DEBHELPER_PACKAGES_DEB)
166 dh_installchangelogs Changelog $(DEBHELPER_PACKAGES_DEB)
167 dh_strip $(DEBHELPER_PACKAGES_DEB)
168 dh_link $(DEBHELPER_PACKAGES_DEB)
169 dh_compress $(DEBHELPER_PACKAGES_DEB)
170 dh_fixperms $(DEBHELPER_PACKAGES_DEB)
171 dh_installdeb $(DEBHELPER_PACKAGES_DEB)
172 dh_shlibdeps $(DEBHELPER_PACKAGES_DEB)
173 dh_gencontrol $(DEBHELPER_PACKAGES_DEB)
174 dh_md5sums $(DEBHELPER_PACKAGES_DEB)
175 dh_builddeb $(DEBHELPER_PACKAGES_DEB)
177 # Build architecture-dependent files here.
178 binary-arch-udeb: build-arch-udeb-all install-udeb
181 dh_strip $(DEBHELPER_PACKAGES_UDEB)
182 dh_link $(DEBHELPER_PACKAGES_UDEB)
183 dh_compress $(DEBHELPER_PACKAGES_UDEB)
184 dh_fixperms $(DEBHELPER_PACKAGES_UDEB)
185 dh_installdeb $(DEBHELPER_PACKAGES_UDEB)
186 dh_shlibdeps $(DEBHELPER_PACKAGES_UDEB)
187 dh_gencontrol $(DEBHELPER_PACKAGES_DEB)
189 $(foreach PACKAGE, $(PACKAGES_UDEB), \
190 dh_gencontrol -p$(PACKAGE) -- -fdebian/files~; \
191 dpkg-distaddfile $(PACKAGE)_$(VERSION)_$(DEB_HOST_ARCH).udeb debian-installer extra; \
192 dh_builddeb -p$(PACKAGE) --filename=$(PACKAGE)_$(VERSION)_$(DEB_HOST_ARCH).udeb; \
196 .PHONY: build clean binary-indep binary-arch binary install