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 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 6 | DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 7 | DEB_HOST_GNU_CPU ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU) |
| 8 | DEB_HOST_GNU_SYSTEM ?= $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM) |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 9 | |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 10 | VERSION = $(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2) |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 11 | |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 12 | ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) |
Eric Andersen | e527207 | 2003-07-22 22:15:21 +0000 | [diff] [blame] | 13 | CONFIG_DEBUG = true |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 14 | endif |
Glenn L McGrath | b9e57f4 | 2002-12-01 20:16:01 +0000 | [diff] [blame] | 15 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 16 | endif |
Eric Andersen | b108a5b | 2000-06-19 09:21:34 +0000 | [diff] [blame] | 17 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 18 | PACKAGE_PREFIX = busybox-cvs |
| 19 | |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 20 | ARCH_FLOPPY_UDEB = $(shell sh debian/control-extract Architecture $(PACKAGE_PREFIX)-floppy-udeb) |
| 21 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 22 | PACKAGES_DEB = $(PACKAGE_PREFIX) $(PACKAGE_PREFIX)-static |
| 23 | PACKAGES_UDEB = $(PACKAGE_PREFIX)-udeb |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 24 | ifneq ($(filter $(DEB_HOST_ARCH),$(ARCH_FLOPPY_UDEB)),) |
| 25 | PACKAGES_UDEB += $(PACKAGE_PREFIX)-floppy-udeb |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 26 | endif |
| 27 | PACKAGES = $(PACKAGES_DEB) $(PACKAGES_UDEB) |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 28 | |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 29 | DEBHELPER_PACKAGES_DEB = $(patsubst %,-p%,$(PACKAGES_DEB)) |
| 30 | DEBHELPER_PACKAGES_UDEB = $(patsubst %,-p%,$(PACKAGES_UDEB)) |
| 31 | |
| 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) |
| 37 | |
| 38 | configure: configure-stamp |
| 39 | configure-stamp: |
| 40 | sh ./configure |
| 41 | |
| 42 | touch $@ |
| 43 | |
| 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 |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 47 | |
| 48 | build-arch-deb: build-arch-deb-stamp |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 49 | build-arch-deb-stamp: configure-stamp |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 50 | $(MAKE) clean |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 51 | |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 52 | cp $(CONFIG_DEB) .config |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 53 | |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 54 | $(MAKE) dep |
Eric Andersen | e527207 | 2003-07-22 22:15:21 +0000 | [diff] [blame] | 55 | $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG) |
Eric Andersen | b108a5b | 2000-06-19 09:21:34 +0000 | [diff] [blame] | 56 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 57 | install -d install-$(PACKAGE_PREFIX)/bin |
| 58 | install busybox install-$(PACKAGE_PREFIX)/bin/busybox |
| 59 | |
| 60 | touch $@ |
| 61 | |
| 62 | build-arch-static: build-arch-static-stamp |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 63 | build-arch-static-stamp: configure-stamp |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 64 | $(MAKE) clean |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 65 | |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 66 | cp $(CONFIG_STATIC) .config |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 67 | |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 68 | $(MAKE) dep |
Eric Andersen | e527207 | 2003-07-22 22:15:21 +0000 | [diff] [blame] | 69 | $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG) |
Glenn L McGrath | 1b16bf6 | 2002-11-23 07:14:55 +0000 | [diff] [blame] | 70 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 71 | install -d install-$(PACKAGE_PREFIX)-static/bin |
| 72 | install busybox install-$(PACKAGE_PREFIX)-static/bin/busybox |
| 73 | |
| 74 | touch $@ |
| 75 | |
| 76 | build-arch-udeb: build-arch-udeb-stamp |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 77 | build-arch-udeb-stamp: configure-stamp |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 78 | $(MAKE) clean |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 79 | |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 80 | cp $(CONFIG_UDEB) .config |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 81 | |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 82 | $(MAKE) dep |
Eric Andersen | e527207 | 2003-07-22 22:15:21 +0000 | [diff] [blame] | 83 | $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG) |
Eric Andersen | e2f6e12 | 2000-12-01 19:55:04 +0000 | [diff] [blame] | 84 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 85 | $(MAKE) PREFIX=$(CURDIR)/install-$(PACKAGE_PREFIX)-udeb install |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 86 | # Remove init link, but init support is still compiled in to be |
| 87 | # used. |
| 88 | rm -f $(CURDIR)/install-$(PACKAGE_PREFIX)-udeb/sbin/init |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 89 | |
| 90 | touch $@ |
| 91 | |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 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)),) |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 95 | $(MAKE) clean |
| 96 | |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 97 | cp $(CONFIG_FLOPPY_UDEB) .config |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 98 | |
| 99 | $(MAKE) dep |
Eric Andersen | e527207 | 2003-07-22 22:15:21 +0000 | [diff] [blame] | 100 | $(MAKE) CONFIG_DEBUG=$(CONFIG_DEBUG) |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 101 | |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 102 | $(MAKE) PREFIX=$(CURDIR)/install-$(PACKAGE_PREFIX)-floppy-udeb install |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 103 | endif |
| 104 | |
| 105 | touch $@ |
| 106 | |
| 107 | build-arch-doc: build-arch-doc-stamp |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 108 | build-arch-doc-stamp: configure-stamp |
Glenn L McGrath | c4698b3 | 2002-12-08 20:45:47 +0000 | [diff] [blame] | 109 | $(MAKE) docs/BusyBox.1 |
| 110 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 111 | cp docs/BusyBox.1 busybox.1 |
| 112 | |
| 113 | touch $@ |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 114 | |
Glenn L McGrath | c4698b3 | 2002-12-08 20:45:47 +0000 | [diff] [blame] | 115 | build: build-arch |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 116 | |
| 117 | clean: |
Glenn L McGrath | 12371f9 | 2002-11-26 02:16:06 +0000 | [diff] [blame] | 118 | dh_testdir |
| 119 | dh_testroot |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 120 | rm -f build-*-stamp configure-stamp debian/files~ |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 121 | |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 122 | -$(MAKE) distclean |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 123 | -rm -rf busybox-deb busybox-static install* busybox.1 |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 124 | |
| 125 | dh_clean |
| 126 | |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 127 | install-deb: build-arch-deb-all |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 128 | dh_testdir |
| 129 | dh_testroot |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 130 | dh_clean -k $(DEBHELPER_PACKAGES_DEB) |
| 131 | dh_installdirs $(DEBHELPER_PACKAGES_DEB) |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 132 | |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 133 | for i in $(PACKAGES_DEB); do \ |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 134 | ( \ |
| 135 | cd install-$$i; \ |
| 136 | find -type d -exec install -d $(CURDIR)/debian/$$i/{} \;; \ |
| 137 | find \( -type f -o -type l \) -exec cp -a {} $(CURDIR)/debian/$$i/{} \;; \ |
| 138 | ); \ |
| 139 | done |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 140 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 141 | install -m644 debian/$(PACKAGE_PREFIX)-static.override \ |
| 142 | debian/$(PACKAGE_PREFIX)-static/usr/share/lintian/overrides/$(PACKAGE_PREFIX)-static |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 143 | |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 144 | install-udeb: build-arch-udeb-all |
| 145 | dh_testdir |
| 146 | dh_testroot |
| 147 | dh_clean -k $(DEBHELPER_PACKAGES_UDEB) |
| 148 | dh_installdirs $(DEBHELPER_PACKAGES_UDEB) |
| 149 | |
| 150 | for i in $(PACKAGES_UDEB); do \ |
| 151 | ( \ |
| 152 | cd install-$$i; \ |
| 153 | find -type d -exec install -d $(CURDIR)/debian/$$i/{} \;; \ |
| 154 | find \( -type f -o -type l \) -exec cp -a {} $(CURDIR)/debian/$$i/{} \;; \ |
| 155 | ); \ |
| 156 | done |
| 157 | |
| 158 | binary-arch: binary-arch-deb binary-arch-udeb |
| 159 | |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 160 | # Build architecture-dependent files here. |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 161 | binary-arch-deb: build-arch-deb-all install-deb |
| 162 | dh_testdir |
| 163 | dh_testroot |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 164 | dh_installdocs $(DEBHELPER_PACKAGES_DEB) |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 165 | dh_installman $(DEBHELPER_PACKAGES_DEB) |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 166 | dh_installchangelogs Changelog $(DEBHELPER_PACKAGES_DEB) |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 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) |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 173 | dh_gencontrol $(DEBHELPER_PACKAGES_DEB) |
| 174 | dh_md5sums $(DEBHELPER_PACKAGES_DEB) |
| 175 | dh_builddeb $(DEBHELPER_PACKAGES_DEB) |
Glenn L McGrath | c4698b3 | 2002-12-08 20:45:47 +0000 | [diff] [blame] | 176 | |
Glenn L McGrath | a43facc | 2004-01-01 00:23:01 +0000 | [diff] [blame] | 177 | # Build architecture-dependent files here. |
| 178 | binary-arch-udeb: build-arch-udeb-all install-udeb |
| 179 | dh_testdir |
| 180 | dh_testroot |
| 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) |
| 188 | |
Glenn L McGrath | 4957fc7 | 2003-04-06 15:35:52 +0000 | [diff] [blame] | 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; \ |
| 193 | ) |
Glenn L McGrath | 12371f9 | 2002-11-26 02:16:06 +0000 | [diff] [blame] | 194 | |
Glenn L McGrath | c4698b3 | 2002-12-08 20:45:47 +0000 | [diff] [blame] | 195 | binary: binary-arch |
Glenn L McGrath | 6fc6d7f | 2002-12-01 02:09:19 +0000 | [diff] [blame] | 196 | .PHONY: build clean binary-indep binary-arch binary install |