blob: a84153693ad5bc87ed51e44386b76f3c246d2e97 [file] [log] [blame]
Eric Andersenb108a5b2000-06-19 09:21:34 +00001#!/usr/bin/make -f
2
3# This is a bit unusual, in that I have to completely recompile everything
Eric Andersene73fda82000-12-01 22:59:04 +00004# for each package I build (obviously static and dynamic builds require
5# things to be recompiled...)
Eric Andersenb108a5b2000-06-19 09:21:34 +00006
7# This is the debhelper compatability version to use.
Eric Andersene73fda82000-12-01 22:59:04 +00008#export DH_COMPAT=1
Eric Andersenb108a5b2000-06-19 09:21:34 +00009
Eric Andersene73fda82000-12-01 22:59:04 +000010bbbd=debian/busybox_builddir
Eric Andersenb108a5b2000-06-19 09:21:34 +000011bb=debian/tmp
Eric Andersene73fda82000-12-01 22:59:04 +000012bbsbd=debian/busybox_static_builddir
Eric Andersenb108a5b2000-06-19 09:21:34 +000013bbs=debian/busybox-static
Eric Andersene73fda82000-12-01 22:59:04 +000014bbubd=debian/busybox_udeb_builddir
15bbu=debian/busybox-udeb
Eric Andersenb108a5b2000-06-19 09:21:34 +000016
17clean:
18 dh_testdir
19 dh_testroot
Eric Andersene73fda82000-12-01 22:59:04 +000020 rm -f debian/build-stamp-busybox debian/build-stamp-busybox-static debian/build-stamp-busybox-udeb
Eric Andersenb108a5b2000-06-19 09:21:34 +000021 -$(MAKE) clean
Eric Andersene73fda82000-12-01 22:59:04 +000022 -rm -rf $(bb) $(bbbd) $(bbs) $(bbsbd) $(bbubd) $(bbu)
Eric Andersenb108a5b2000-06-19 09:21:34 +000023 dh_clean
24
Eric Andersene73fda82000-12-01 22:59:04 +000025build: debian/build-stamp-busybox
26debian/build-stamp-busybox:
Eric Andersenb108a5b2000-06-19 09:21:34 +000027 dh_testdir
Eric Andersene2f6e122000-12-01 19:55:04 +000028 mkdir -p $(bbbd)
Eric Andersene73fda82000-12-01 22:59:04 +000029 cp Makefile $(bbbd)
30 cp debian/Config.h-deb $(bbbd)/Config.h
Eric Andersenbdfd0d72001-10-24 05:00:29 +000031 -(cd $(bbbd); $(MAKE) "CONFIG_SRC_DIR=../../" applet_source_list)
32 (cd $(bbbd); $(MAKE) USE_SYSTEM_PWD_GRP=false "CONFIG_SRC_DIR=../../")
Eric Andersene73fda82000-12-01 22:59:04 +000033 touch debian/build-stamp-busybox
Eric Andersenb108a5b2000-06-19 09:21:34 +000034
35install: build
36 dh_testdir
37 dh_testroot
38 dh_clean -k
39 dh_installdirs
Eric Andersene73fda82000-12-01 22:59:04 +000040 # Do not run 'make install', since we do not want all the symlinks.
41 # This just installes the busybox binary...
Eric Andersenbdfd0d72001-10-24 05:00:29 +000042 #(cd $(bbbd); $(MAKE) "CONFIG_SRC_DIR=../../" "PREFIX=../../$(bb)" install)
Eric Andersene73fda82000-12-01 22:59:04 +000043 mkdir -p $(bb)/bin/
44 cp $(bbbd)/busybox $(bb)/bin/busybox
Eric Andersen2423b122001-12-08 01:56:15 +000045 mkdir -p $(bb)/usr/share/doc/busybox/busybox.net
46 cp $(bbbd)/docs/busybox.net/BusyBox.html $(bb)/usr/share/doc/busybox/busybox.net/
Eric Andersenb108a5b2000-06-19 09:21:34 +000047 mkdir -p $(bb)/usr/share/man/man1
Eric Andersene73fda82000-12-01 22:59:04 +000048 cp $(bbbd)/docs/BusyBox.1 $(bb)/usr/share/man/man1/busybox.1
Eric Andersenb108a5b2000-06-19 09:21:34 +000049
50# Now for the statically linked stuff
Eric Andersene73fda82000-12-01 22:59:04 +000051build-static: debian/build-stamp-busybox-static
52debian/build-stamp-busybox-static:
Eric Andersenb108a5b2000-06-19 09:21:34 +000053 dh_testdir
Eric Andersene73fda82000-12-01 22:59:04 +000054 mkdir -p $(bbsbd)
55 cp Makefile $(bbsbd)
Eric Andersen69c85722001-02-17 00:41:05 +000056 cp debian/Config.h-static $(bbsbd)/Config.h
Eric Andersenbdfd0d72001-10-24 05:00:29 +000057 (cd $(bbsbd); $(MAKE) DOSTATIC=true USE_SYSTEM_PWD_GRP=false "CONFIG_SRC_DIR=../../")
Eric Andersene73fda82000-12-01 22:59:04 +000058 touch debian/build-stamp-busybox-static
Eric Andersenb108a5b2000-06-19 09:21:34 +000059
60install-static: build
61 dh_testdir
62 dh_testroot
63 dh_clean -k
64 dh_installdirs
65 # Do not run 'make install', since we do not want all the symlinks.
66 # This just installes the busybox binary...
Eric Andersenbdfd0d72001-10-24 05:00:29 +000067 #(cd $(bbsbd); $(MAKE) "CONFIG_SRC_DIR=../../" "PREFIX=../../$(bbs)" install)
Eric Andersenb108a5b2000-06-19 09:21:34 +000068 mkdir -p $(bbs)/bin/
Eric Andersene73fda82000-12-01 22:59:04 +000069 cp $(bbsbd)/busybox $(bbs)/bin/busybox
Eric Andersen2423b122001-12-08 01:56:15 +000070 mkdir -p $(bbs)/usr/share/doc/busybox-static/busybox.net
71 cp $(bbsbd)/docs/busybox.net/BusyBox.html $(bbs)/usr/share/doc/busybox-static/busybox.net/
Eric Andersenb108a5b2000-06-19 09:21:34 +000072 mkdir -p $(bbs)/usr/share/man/man1/
Eric Andersene73fda82000-12-01 22:59:04 +000073 cp $(bbsbd)/docs/BusyBox.1 $(bbs)/usr/share/man/man1/busybox.1
74
75half_clean:
76 dh_testdir
77 dh_testroot
78 rm -rf $(bbs) debian/build-stamp-busybox-static
79 -$(MAKE) clean
Eric Andersenb108a5b2000-06-19 09:21:34 +000080
81do_static: half_clean build-static install-static
82
83
Eric Andersene73fda82000-12-01 22:59:04 +000084
85# Now for the .udeb stuff
Eric Andersene75f6a92000-12-20 20:41:02 +000086PACKAGE=busybox-udeb
Eric Andersen02795052001-07-06 20:36:57 +000087VERSION=$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2 | sed -e s/[0-9]://g)
Eric Andersene73fda82000-12-01 22:59:04 +000088ARCH=$(shell dpkg --print-architecture)
89FILENAME=$(PACKAGE)_$(VERSION)_$(ARCH).udeb
Eric Andersene73fda82000-12-01 22:59:04 +000090
91build-udeb: debian/build-stamp-busybox-udeb
92debian/build-stamp-busybox-udeb:
93 dh_testdir
94 mkdir -p $(bbubd)
95 cp Makefile $(bbubd)
96 cp debian/Config.h-udeb $(bbubd)/Config.h
Eric Andersenbdfd0d72001-10-24 05:00:29 +000097 (cd $(bbubd); $(MAKE) USE_SYSTEM_PWD_GRP=false "CONFIG_SRC_DIR=../../")
Eric Andersene73fda82000-12-01 22:59:04 +000098 touch debian/build-stamp-busybox-udeb
99
100install-udeb: build
101 dh_testdir
102 dh_testroot
103 dh_clean -k
104 dh_installdirs
Eric Andersenbdfd0d72001-10-24 05:00:29 +0000105 (cd $(bbubd); $(MAKE) "CONFIG_SRC_DIR=../../" "PREFIX=../../$(bbu)" install)
Eric Andersene73fda82000-12-01 22:59:04 +0000106 mkdir -p $(bbu)/usr/share/man/man1/
107 cp $(bbubd)/docs/BusyBox.1 $(bbu)/usr/share/man/man1/busybox.1
108
109three_quarter_clean:
110 dh_testdir
111 dh_testroot
112 rm -rf $(bbu) debian/build-stamp-busybox-udeb
113 -$(MAKE) clean
114
115do_udeb: three_quarter_clean build-udeb install-udeb
116
117
118
Eric Andersenb108a5b2000-06-19 09:21:34 +0000119# Build architecture-independent files here.
120binary-indep:
121# We have nothing to do by default.
122
123# Build architecture-dependent files here.
Eric Andersene2f6e122000-12-01 19:55:04 +0000124binary-arch: busybox busybox-static busybox-udeb
Eric Andersenb108a5b2000-06-19 09:21:34 +0000125
126busybox: install
127 @echo "--- Building: $@"
128 dh_testdir
129 dh_testroot
130 dh_installdirs
Eric Andersene73fda82000-12-01 22:59:04 +0000131 dh_installdocs -p$@ $(bbbd)/docs/BusyBox.txt \
132 $(bbbd)/docs/BusyBox.html docs/style-guide.txt \
Eric Andersen2423b122001-12-08 01:56:15 +0000133 docs/busybox.net AUTHORS README TODO
Eric Andersene73fda82000-12-01 22:59:04 +0000134 rm -rf `find $(bb) -name CVS`
135 rm -f `find $(bb) -name .cvsignore`
136 dh_installchangelogs -p$@ Changelog
137 dh_undocumented -p$@
Eric Andersenb108a5b2000-06-19 09:21:34 +0000138 dh_strip -p$@
139 dh_compress -p$@
140 dh_fixperms -p$@
141 dh_installdeb -p$@
142 dh_shlibdeps -p$@
Eric Andersenb108a5b2000-06-19 09:21:34 +0000143 dh_gencontrol -p$@
144 dh_md5sums -p$@
145 dh_builddeb -p$@
146
147
148busybox-static: do_static
149 @echo "--- Building: $@"
150 dh_testdir
151 dh_testroot
152 dh_installdirs
Eric Andersene73fda82000-12-01 22:59:04 +0000153 dh_installdocs -p$@ $(bbsbd)/docs/BusyBox.txt \
154 $(bbsbd)/docs/BusyBox.html docs/style-guide.txt \
Eric Andersen2423b122001-12-08 01:56:15 +0000155 docs/busybox.net AUTHORS README TODO
Eric Andersene73fda82000-12-01 22:59:04 +0000156 rm -rf `find $(bbs) -name CVS`
157 rm -f `find $(bbs) -name .cvsignore`
Eric Andersenb108a5b2000-06-19 09:21:34 +0000158 dh_installchangelogs -p$@ Changelog
Eric Andersene73fda82000-12-01 22:59:04 +0000159 dh_undocumented -p$@
Eric Andersenb108a5b2000-06-19 09:21:34 +0000160 dh_strip -p$@
161 dh_compress -p$@
162 dh_fixperms -p$@
163 dh_installdeb -p$@
164 dh_shlibdeps -p$@
165 dh_gencontrol -p$@
166 dh_md5sums -p$@
167 dh_builddeb -p$@
168
169
Eric Andersene2f6e122000-12-01 19:55:04 +0000170# Note that this builds a .udeb, which is not policy compliant or anything.
171#
Eric Andersene73fda82000-12-01 22:59:04 +0000172busybox-udeb: do_udeb
Eric Andersene2f6e122000-12-01 19:55:04 +0000173 @echo "--- Building: $@"
174 dh_testdir
175 dh_testroot
176 dh_installdirs
Eric Andersene2f6e122000-12-01 19:55:04 +0000177 dh_strip -p$@
178 dh_compress -p$@
179 dh_fixperms -p$@
180 dh_installdeb -p$@
181 dh_shlibdeps -p$@
Eric Andersene2f6e122000-12-01 19:55:04 +0000182 #Make _very_ sure there are no docs lurking about.
Eric Andersene73fda82000-12-01 22:59:04 +0000183 rm -rf $(bbu)/usr/share/man
184 #dh_gencontrol -p$@
Eric Andersene2f6e122000-12-01 19:55:04 +0000185 # Don't write your stupid guesses to debian/files.
Eric Andersene73fda82000-12-01 22:59:04 +0000186 dh_gencontrol -p$@ -- -fdebian/files~
Eric Andersene2f6e122000-12-01 19:55:04 +0000187 # Register file manually.
Eric Andersen02795052001-07-06 20:36:57 +0000188 dpkg-distaddfile $(FILENAME) debian-installer standard
Eric Andersene2f6e122000-12-01 19:55:04 +0000189 dh_md5sums -p$@
190 dh_builddeb -p$@ --filename=$(FILENAME)
191
Eric Andersenb108a5b2000-06-19 09:21:34 +0000192binary: binary-indep binary-arch
193.PHONY: build clean binary-indep binary-arch binary install