blob: 078478627b7faba7abbd0977b463994917186a2a [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 Andersene2f6e122000-12-01 19:55:04 +000031 (cd $(bbbd); $(MAKE) "BB_SRC_DIR=../../")
Eric Andersene73fda82000-12-01 22:59:04 +000032 touch debian/build-stamp-busybox
Eric Andersenb108a5b2000-06-19 09:21:34 +000033
34install: build
35 dh_testdir
36 dh_testroot
37 dh_clean -k
38 dh_installdirs
Eric Andersene73fda82000-12-01 22:59:04 +000039 # Do not run 'make install', since we do not want all the symlinks.
40 # This just installes the busybox binary...
41 #(cd $(bbbd); $(MAKE) "BB_SRC_DIR=../../" "PREFIX=../../$(bb)" install)
42 mkdir -p $(bb)/bin/
43 cp $(bbbd)/busybox $(bb)/bin/busybox
44 mkdir -p $(bb)/usr/share/doc/busybox/busybox.lineo.com
45 cp $(bbbd)/docs/busybox.lineo.com/BusyBox.html $(bb)/usr/share/doc/busybox/busybox.lineo.com/
Eric Andersenb108a5b2000-06-19 09:21:34 +000046 mkdir -p $(bb)/usr/share/man/man1
Eric Andersene73fda82000-12-01 22:59:04 +000047 cp $(bbbd)/docs/BusyBox.1 $(bb)/usr/share/man/man1/busybox.1
Eric Andersenb108a5b2000-06-19 09:21:34 +000048
49# Now for the statically linked stuff
Eric Andersene73fda82000-12-01 22:59:04 +000050build-static: debian/build-stamp-busybox-static
51debian/build-stamp-busybox-static:
Eric Andersenb108a5b2000-06-19 09:21:34 +000052 dh_testdir
Eric Andersene73fda82000-12-01 22:59:04 +000053 mkdir -p $(bbsbd)
54 cp Makefile $(bbsbd)
55 cp debian/Config.h-deb $(bbsbd)/Config.h
56 (cd $(bbsbd); $(MAKE) DOSTATIC=true "BB_SRC_DIR=../../")
57 touch debian/build-stamp-busybox-static
Eric Andersenb108a5b2000-06-19 09:21:34 +000058
59install-static: build
60 dh_testdir
61 dh_testroot
62 dh_clean -k
63 dh_installdirs
64 # Do not run 'make install', since we do not want all the symlinks.
65 # This just installes the busybox binary...
Eric Andersene73fda82000-12-01 22:59:04 +000066 #(cd $(bbsbd); $(MAKE) "BB_SRC_DIR=../../" "PREFIX=../../$(bbs)" install)
Eric Andersenb108a5b2000-06-19 09:21:34 +000067 mkdir -p $(bbs)/bin/
Eric Andersene73fda82000-12-01 22:59:04 +000068 cp $(bbsbd)/busybox $(bbs)/bin/busybox
69 mkdir -p $(bbs)/usr/share/doc/busybox-static/busybox.lineo.com
70 cp $(bbsbd)/docs/busybox.lineo.com/BusyBox.html $(bbs)/usr/share/doc/busybox-static/busybox.lineo.com/
Eric Andersenb108a5b2000-06-19 09:21:34 +000071 mkdir -p $(bbs)/usr/share/man/man1/
Eric Andersene73fda82000-12-01 22:59:04 +000072 cp $(bbsbd)/docs/BusyBox.1 $(bbs)/usr/share/man/man1/busybox.1
73
74half_clean:
75 dh_testdir
76 dh_testroot
77 rm -rf $(bbs) debian/build-stamp-busybox-static
78 -$(MAKE) clean
Eric Andersenb108a5b2000-06-19 09:21:34 +000079
80do_static: half_clean build-static install-static
81
82
Eric Andersene73fda82000-12-01 22:59:04 +000083
84# Now for the .udeb stuff
Eric Andersene75f6a92000-12-20 20:41:02 +000085PACKAGE=busybox-udeb
Eric Andersene73fda82000-12-01 22:59:04 +000086VERSION=$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
87ARCH=$(shell dpkg --print-architecture)
88FILENAME=$(PACKAGE)_$(VERSION)_$(ARCH).udeb
89PRIORITY=$(shell grep ^Priority: debian/control | cut -d ' ' -f 2)
90
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
97 (cd $(bbubd); $(MAKE) "BB_SRC_DIR=../../")
98 touch debian/build-stamp-busybox-udeb
99
100install-udeb: build
101 dh_testdir
102 dh_testroot
103 dh_clean -k
104 dh_installdirs
105 (cd $(bbubd); $(MAKE) "BB_SRC_DIR=../../" "PREFIX=../../$(bbu)" install)
106 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 \
133 docs/busybox.lineo.com AUTHORS README TODO
134 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 \
155 docs/busybox.lineo.com AUTHORS README TODO
156 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.
188 dpkg-distaddfile $(FILENAME) debian-installer $(PRIORITY)
189 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