Eric Andersen | b108a5b | 2000-06-19 09:21:34 +0000 | [diff] [blame] | 1 | #!/usr/bin/make -f |
| 2 | |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 3 | # Uncomment this to turn on verbose mode. |
| 4 | #export DH_VERBOSE=1 |
| 5 | |
| 6 | # This is the debhelper compatibility version to use. |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 7 | export DH_COMPAT=3 |
Eric Andersen | b108a5b | 2000-06-19 09:21:34 +0000 | [diff] [blame] | 8 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 9 | DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) |
| 10 | |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 11 | VERSION = $(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2) |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 12 | |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 13 | ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) |
Eric Andersen | e527207 | 2003-07-22 22:15:21 +0000 | [diff] [blame] | 14 | CONFIG_DEBUG = true |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 15 | endif |
Glenn L McGrath | b9e57f4 | 2002-12-01 20:16:01 +0000 | [diff] [blame] | 16 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 17 | endif |
Eric Andersen | b108a5b | 2000-06-19 09:21:34 +0000 | [diff] [blame] | 18 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 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: |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 33 | $(MAKE) clean |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 34 | |
| 35 | ifeq ($(wildcard ./debian/config-deb-$(DEB_HOST_ARCH)),) |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 36 | cp ./debian/config-deb .config |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 37 | else |
| 38 | cp ./debian/config-deb-$(DEB_HOST_ARCH) .config |
| 39 | endif |
| 40 | |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 41 | $(MAKE) dep |
Eric Andersen | e527207 | 2003-07-22 22:15:21 +0000 | [diff] [blame] | 42 | $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG) |
Eric Andersen | b108a5b | 2000-06-19 09:21:34 +0000 | [diff] [blame] | 43 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 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: |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 51 | $(MAKE) clean |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 52 | |
| 53 | ifeq ($(wildcard ./debian/config-static-$(DEB_HOST_ARCH)),) |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 54 | cp ./debian/config-static .config |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 55 | else |
| 56 | cp ./debian/config-static-$(DEB_HOST_ARCH) .config |
| 57 | endif |
| 58 | |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 59 | $(MAKE) dep |
Eric Andersen | e527207 | 2003-07-22 22:15:21 +0000 | [diff] [blame] | 60 | $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG) |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 61 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 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: |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 69 | $(MAKE) clean |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 70 | |
| 71 | ifeq ($(wildcard ./debian/config-udeb-$(DEB_HOST_ARCH)),) |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 72 | cp ./debian/config-udeb .config |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 73 | else |
| 74 | cp ./debian/config-udeb-$(DEB_HOST_ARCH) .config |
| 75 | endif |
| 76 | |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 77 | $(MAKE) dep |
Eric Andersen | e527207 | 2003-07-22 22:15:21 +0000 | [diff] [blame] | 78 | $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG) |
Eric Andersen | e2f6e12 | 2000-12-01 19:55:04 +0000 | [diff] [blame] | 79 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 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 |
Eric Andersen | e527207 | 2003-07-22 22:15:21 +0000 | [diff] [blame] | 92 | $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG) |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 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: |
Glenn L McGrath | c4698b3 | 2002-12-08 20:45:47 +0000 | [diff] [blame] | 101 | $(MAKE) docs/BusyBox.1 |
| 102 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 103 | cp docs/BusyBox.1 busybox.1 |
| 104 | |
| 105 | touch $@ |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 106 | |
Glenn L McGrath | c4698b3 | 2002-12-08 20:45:47 +0000 | [diff] [blame] | 107 | build: build-arch |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 108 | |
| 109 | clean: |
Glenn L McGrath | 12371f9 | 2002-11-26 02:16:06 +0000 | [diff] [blame] | 110 | dh_testdir |
| 111 | dh_testroot |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 112 | rm -f build-*-stamp debian/files~ |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 113 | |
| 114 | $(MAKE) distclean |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 115 | -rm -rf busybox-deb busybox-static install* busybox.1 |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 116 | |
| 117 | dh_clean |
| 118 | |
| 119 | install: build-arch |
| 120 | dh_testdir |
| 121 | dh_testroot |
| 122 | dh_clean -k |
| 123 | dh_installdirs |
| 124 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 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 |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 132 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 133 | install -m644 debian/$(PACKAGE_PREFIX)-static.override \ |
| 134 | debian/$(PACKAGE_PREFIX)-static/usr/share/lintian/overrides/$(PACKAGE_PREFIX)-static |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 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 |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 141 | dh_installdocs $(DEBHELPER_PACKAGES_DEB) |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 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 |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 150 | dh_installman $(DEBHELPER_PACKAGES_DEB) |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 151 | # dh_installinfo -a |
| 152 | # dh_undocumented -a |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 153 | dh_installchangelogs Changelog $(DEBHELPER_PACKAGES_DEB) |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 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 |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 162 | dh_gencontrol $(DEBHELPER_PACKAGES_DEB) |
| 163 | dh_md5sums $(DEBHELPER_PACKAGES_DEB) |
| 164 | dh_builddeb $(DEBHELPER_PACKAGES_DEB) |
Glenn L McGrath | c4698b3 | 2002-12-08 20:45:47 +0000 | [diff] [blame] | 165 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 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 | ) |
Glenn L McGrath | 12371f9 | 2002-11-26 02:16:06 +0000 | [diff] [blame] | 171 | |
Glenn L McGrath | c4698b3 | 2002-12-08 20:45:47 +0000 | [diff] [blame] | 172 | binary: binary-arch |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 173 | .PHONY: build clean binary-indep binary-arch binary install |