Do not require that the signal number be specified
[oweals/busybox.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # Uncomment this to turn on verbose mode.
4 #export DH_VERBOSE=1
5
6 # This is the debhelper compatibility version to use.
7 export DH_COMPAT=3
8
9 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
10
11 VERSION = $(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
12
13 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
14         CONFIG_DEBUG = true
15 endif
16 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
17 endif
18
19 PACKAGE_PREFIX = busybox-cvs
20
21 PACKAGES_DEB = $(PACKAGE_PREFIX) $(PACKAGE_PREFIX)-static
22 PACKAGES_UDEB = $(PACKAGE_PREFIX)-udeb
23 ifneq ($(wildcard ./debian/config-net-udeb-$(DEB_HOST_ARCH)),)
24 PACKAGES_UDEB += $(PACKAGE_PREFIX)-net-udeb
25 endif
26 PACKAGES = $(PACKAGES_DEB) $(PACKAGES_UDEB)
27 DEBHELPER_PACKAGES_DEB = $(patsubst %,-p%,$(PACKAGES_DEB))
28
29 build-arch: build-arch-deb build-arch-static build-arch-udeb build-arch-net-udeb build-arch-doc
30
31 build-arch-deb: build-arch-deb-stamp
32 build-arch-deb-stamp:
33         $(MAKE) clean
34
35 ifeq ($(wildcard ./debian/config-deb-$(DEB_HOST_ARCH)),)
36         cp ./debian/config-deb .config
37 else
38         cp ./debian/config-deb-$(DEB_HOST_ARCH) .config
39 endif
40
41         $(MAKE) dep
42         $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
43
44         install -d install-$(PACKAGE_PREFIX)/bin
45         install busybox install-$(PACKAGE_PREFIX)/bin/busybox
46
47         touch $@
48
49 build-arch-static: build-arch-static-stamp
50 build-arch-static-stamp:
51         $(MAKE) clean
52
53 ifeq ($(wildcard ./debian/config-static-$(DEB_HOST_ARCH)),)
54         cp ./debian/config-static .config
55 else
56         cp ./debian/config-static-$(DEB_HOST_ARCH) .config
57 endif
58
59         $(MAKE) dep
60         $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
61
62         install -d install-$(PACKAGE_PREFIX)-static/bin
63         install busybox install-$(PACKAGE_PREFIX)-static/bin/busybox
64
65         touch $@
66
67 build-arch-udeb: build-arch-udeb-stamp
68 build-arch-udeb-stamp:
69         $(MAKE) clean
70
71 ifeq ($(wildcard ./debian/config-udeb-$(DEB_HOST_ARCH)),)
72         cp ./debian/config-udeb .config
73 else
74         cp ./debian/config-udeb-$(DEB_HOST_ARCH) .config
75 endif
76
77         $(MAKE) dep
78         $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
79
80         $(MAKE) PREFIX=$(CURDIR)/install-$(PACKAGE_PREFIX)-udeb install
81
82         touch $@
83
84 build-arch-net-udeb: build-arch-net-udeb-stamp
85 build-arch-net-udeb-stamp:
86 ifneq ($(wildcard ./debian/config-net-udeb-$(DEB_HOST_ARCH)),)
87         $(MAKE) clean
88
89         cp ./debian/config-net-udeb-$(DEB_HOST_ARCH) .config
90
91         $(MAKE) dep
92         $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG)
93
94         $(MAKE) PREFIX=$(CURDIR)/install-$(PACKAGE_PREFIX)-net-udeb install
95 endif
96
97         touch $@
98
99 build-arch-doc: build-arch-doc-stamp
100 build-arch-doc-stamp:
101         $(MAKE) docs/BusyBox.1
102
103         cp docs/BusyBox.1 busybox.1
104
105         touch $@
106
107 build: build-arch
108
109 clean:
110         dh_testdir
111         dh_testroot
112         rm -f build-*-stamp debian/files~
113
114         $(MAKE) distclean
115         -rm -rf busybox-deb busybox-static install* busybox.1
116
117         dh_clean
118
119 install: build-arch
120         dh_testdir
121         dh_testroot
122         dh_clean -k
123         dh_installdirs
124
125         for i in $(PACKAGES); do \
126         ( \
127                 cd install-$$i; \
128                 find -type d -exec install -d $(CURDIR)/debian/$$i/{} \;; \
129                 find \( -type f -o -type l \) -exec cp -a {} $(CURDIR)/debian/$$i/{} \;; \
130         ); \
131         done
132
133         install -m644 debian/$(PACKAGE_PREFIX)-static.override \
134                 debian/$(PACKAGE_PREFIX)-static/usr/share/lintian/overrides/$(PACKAGE_PREFIX)-static
135
136 # Build architecture-dependent files here.
137 binary-arch: build-arch install
138         dh_testdir -a
139         dh_testroot -a
140 #       dh_installdebconf -a
141         dh_installdocs $(DEBHELPER_PACKAGES_DEB)
142 #       dh_installexamples -a
143 #       dh_installmenu -a
144 #       dh_installlogrotate -a
145 #       dh_installemacsen -a
146 #       dh_installpam -a
147 #       dh_installmime -a
148 #       dh_installinit -a
149 #       dh_installcron -a
150         dh_installman $(DEBHELPER_PACKAGES_DEB)
151 #       dh_installinfo -a
152 #       dh_undocumented -a
153         dh_installchangelogs Changelog $(DEBHELPER_PACKAGES_DEB)
154         dh_strip -a
155         dh_link -a
156         dh_compress -a
157         dh_fixperms -a
158 #       dh_makeshlibs -a
159         dh_installdeb -a
160 #       dh_perl -a
161         dh_shlibdeps -a
162         dh_gencontrol $(DEBHELPER_PACKAGES_DEB)
163         dh_md5sums $(DEBHELPER_PACKAGES_DEB)
164         dh_builddeb $(DEBHELPER_PACKAGES_DEB)
165
166         $(foreach PACKAGE, $(PACKAGES_UDEB), \
167         dh_gencontrol -p$(PACKAGE) -- -fdebian/files~; \
168         dpkg-distaddfile $(PACKAGE)_$(VERSION)_$(DEB_HOST_ARCH).udeb debian-installer extra; \
169         dh_builddeb -p$(PACKAGE) --filename=$(PACKAGE)_$(VERSION)_$(DEB_HOST_ARCH).udeb; \
170         )
171
172 binary: binary-arch
173 .PHONY: build clean binary-indep binary-arch binary install