blob: 47605fa7161d0569d554eb2d40012099429fe7fe [file] [log] [blame]
Eric Andersenb108a5b2000-06-19 09:21:34 +00001#!/usr/bin/make -f
2
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +00003# Uncomment this to turn on verbose mode.
4#export DH_VERBOSE=1
5
6# This is the debhelper compatibility version to use.
Glenn L McGrath1b16bf62002-11-23 07:14:55 +00007export DH_COMPAT=3
Eric Andersenb108a5b2000-06-19 09:21:34 +00008
Glenn L McGrath4957fc72003-04-06 15:35:52 +00009DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
10
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +000011VERSION = $(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +000012
Glenn L McGrath1b16bf62002-11-23 07:14:55 +000013ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +000014 DODEBUG = true
Glenn L McGrath1b16bf62002-11-23 07:14:55 +000015endif
Glenn L McGrathb9e57f42002-12-01 20:16:01 +000016ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
Glenn L McGrath1b16bf62002-11-23 07:14:55 +000017endif
Eric Andersenb108a5b2000-06-19 09:21:34 +000018
Glenn L McGrath4957fc72003-04-06 15:35:52 +000019PACKAGE_PREFIX = busybox-cvs
20
21PACKAGES_DEB = $(PACKAGE_PREFIX) $(PACKAGE_PREFIX)-static
22PACKAGES_UDEB = $(PACKAGE_PREFIX)-udeb
23ifneq ($(wildcard ./debian/config-net-udeb-$(DEB_HOST_ARCH)),)
24PACKAGES_UDEB += $(PACKAGE_PREFIX)-net-udeb
25endif
26PACKAGES = $(PACKAGES_DEB) $(PACKAGES_UDEB)
27DEBHELPER_PACKAGES_DEB = $(patsubst %,-p%,$(PACKAGES_DEB))
28
29build-arch: build-arch-deb build-arch-static build-arch-udeb build-arch-net-udeb build-arch-doc
30
31build-arch-deb: build-arch-deb-stamp
32build-arch-deb-stamp:
Glenn L McGrath1b16bf62002-11-23 07:14:55 +000033 $(MAKE) clean
Glenn L McGrath4957fc72003-04-06 15:35:52 +000034
35ifeq ($(wildcard ./debian/config-deb-$(DEB_HOST_ARCH)),)
Glenn L McGrath1b16bf62002-11-23 07:14:55 +000036 cp ./debian/config-deb .config
Glenn L McGrath4957fc72003-04-06 15:35:52 +000037else
38 cp ./debian/config-deb-$(DEB_HOST_ARCH) .config
39endif
40
Glenn L McGrath1b16bf62002-11-23 07:14:55 +000041 $(MAKE) dep
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +000042 $(MAKE) DODEBUG=$(DODEBUG)
Eric Andersenb108a5b2000-06-19 09:21:34 +000043
Glenn L McGrath4957fc72003-04-06 15:35:52 +000044 install -d install-$(PACKAGE_PREFIX)/bin
45 install busybox install-$(PACKAGE_PREFIX)/bin/busybox
46
47 touch $@
48
49build-arch-static: build-arch-static-stamp
50build-arch-static-stamp:
Glenn L McGrath1b16bf62002-11-23 07:14:55 +000051 $(MAKE) clean
Glenn L McGrath4957fc72003-04-06 15:35:52 +000052
53ifeq ($(wildcard ./debian/config-static-$(DEB_HOST_ARCH)),)
Glenn L McGrath1b16bf62002-11-23 07:14:55 +000054 cp ./debian/config-static .config
Glenn L McGrath4957fc72003-04-06 15:35:52 +000055else
56 cp ./debian/config-static-$(DEB_HOST_ARCH) .config
57endif
58
Glenn L McGrath1b16bf62002-11-23 07:14:55 +000059 $(MAKE) dep
Glenn L McGrathc4698b32002-12-08 20:45:47 +000060 $(MAKE) DODEBUG=$(DODEBUG)
Glenn L McGrath1b16bf62002-11-23 07:14:55 +000061
Glenn L McGrath4957fc72003-04-06 15:35:52 +000062 install -d install-$(PACKAGE_PREFIX)-static/bin
63 install busybox install-$(PACKAGE_PREFIX)-static/bin/busybox
64
65 touch $@
66
67build-arch-udeb: build-arch-udeb-stamp
68build-arch-udeb-stamp:
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +000069 $(MAKE) clean
Glenn L McGrath4957fc72003-04-06 15:35:52 +000070
71ifeq ($(wildcard ./debian/config-udeb-$(DEB_HOST_ARCH)),)
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +000072 cp ./debian/config-udeb .config
Glenn L McGrath4957fc72003-04-06 15:35:52 +000073else
74 cp ./debian/config-udeb-$(DEB_HOST_ARCH) .config
75endif
76
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +000077 $(MAKE) dep
78 $(MAKE) DODEBUG=$(DODEBUG)
Eric Andersene2f6e122000-12-01 19:55:04 +000079
Glenn L McGrath4957fc72003-04-06 15:35:52 +000080 $(MAKE) PREFIX=$(CURDIR)/install-$(PACKAGE_PREFIX)-udeb install
81
82 touch $@
83
84build-arch-net-udeb: build-arch-net-udeb-stamp
85build-arch-net-udeb-stamp:
86ifneq ($(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) DODEBUG=$(DODEBUG)
93
94 $(MAKE) PREFIX=$(CURDIR)/install-$(PACKAGE_PREFIX)-net-udeb install
95endif
96
97 touch $@
98
99build-arch-doc: build-arch-doc-stamp
100build-arch-doc-stamp:
Glenn L McGrathc4698b32002-12-08 20:45:47 +0000101 $(MAKE) docs/BusyBox.1
102
Glenn L McGrath4957fc72003-04-06 15:35:52 +0000103 cp docs/BusyBox.1 busybox.1
104
105 touch $@
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +0000106
Glenn L McGrathc4698b32002-12-08 20:45:47 +0000107build: build-arch
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +0000108
109clean:
Glenn L McGrath12371f92002-11-26 02:16:06 +0000110 dh_testdir
111 dh_testroot
Glenn L McGrath4957fc72003-04-06 15:35:52 +0000112 rm -f build-*-stamp debian/files~
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +0000113
114 $(MAKE) distclean
Glenn L McGrath4957fc72003-04-06 15:35:52 +0000115 -rm -rf busybox-deb busybox-static install* busybox.1
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +0000116
117 dh_clean
118
119install: build-arch
120 dh_testdir
121 dh_testroot
122 dh_clean -k
123 dh_installdirs
124
Glenn L McGrath4957fc72003-04-06 15:35:52 +0000125 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
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +0000132
Glenn L McGrath4957fc72003-04-06 15:35:52 +0000133 install -m644 debian/$(PACKAGE_PREFIX)-static.override \
134 debian/$(PACKAGE_PREFIX)-static/usr/share/lintian/overrides/$(PACKAGE_PREFIX)-static
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +0000135
136# Build architecture-dependent files here.
137binary-arch: build-arch install
138 dh_testdir -a
139 dh_testroot -a
140# dh_installdebconf -a
Glenn L McGrath4957fc72003-04-06 15:35:52 +0000141 dh_installdocs $(DEBHELPER_PACKAGES_DEB)
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +0000142# 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
Glenn L McGrath4957fc72003-04-06 15:35:52 +0000150 dh_installman $(DEBHELPER_PACKAGES_DEB)
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +0000151# dh_installinfo -a
152# dh_undocumented -a
Glenn L McGrath4957fc72003-04-06 15:35:52 +0000153 dh_installchangelogs Changelog $(DEBHELPER_PACKAGES_DEB)
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +0000154 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
Glenn L McGrath4957fc72003-04-06 15:35:52 +0000162 dh_gencontrol $(DEBHELPER_PACKAGES_DEB)
163 dh_md5sums $(DEBHELPER_PACKAGES_DEB)
164 dh_builddeb $(DEBHELPER_PACKAGES_DEB)
Glenn L McGrathc4698b32002-12-08 20:45:47 +0000165
Glenn L McGrath4957fc72003-04-06 15:35:52 +0000166 $(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 )
Glenn L McGrath12371f92002-11-26 02:16:06 +0000171
Glenn L McGrathc4698b32002-12-08 20:45:47 +0000172binary: binary-arch
Glenn L McGrath6fc6d7f2002-12-01 02:09:19 +0000173.PHONY: build clean binary-indep binary-arch binary install