2 ############################ -*- Mode: Makefile -*- ###########################
4 ## Author : Manoj Srivastava ( srivasta@tiamat.datasync.com )
5 ## Created On : Thu Oct 29 15:35:55 1998
6 ## Created On Node : tiamat.datasync.com
7 ## Last Modified By : Manoj Srivastava
8 ## Last Modified On : Sat Jul 29 23:17:29 2000
9 ## Last Machine Used: glaurung.green-gryphon.com
11 ## Status : Unknown, Use with caution!
15 ###############################################################################
17 # set the dpkg-architecture vars
18 export DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
19 export DEB_BUILD_GNU_CPU := $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)
20 export DEB_BUILD_GNU_SYSTEM:= $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM)
21 export DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
22 export DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
23 export DEB_HOST_GNU_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
24 export DEB_HOST_GNU_SYSTEM := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
25 export DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
29 # The name of the package (for example, `emacs').
30 package := $(shell grep Source debian/control | sed 's/^Source: //')
31 arch := $(shell dpkg --print-installation-architecture)
32 date := $(shell date +"%Y-%m-%d")
33 version := $(shell LC_ALL=C dpkg-parsechangelog | \
34 grep ^Version: | sed 's/^Version: *//')
35 ppackage:= packaging-manual
37 FILES_TO_CLEAN = debian/files debian/buildinfo debian/substvars \
38 debian/postinst debian/prerm \
39 version.ent policy.lout policy.lout.ld lout.li \
40 upgrading-checklist.text policy.text.gz \
41 packaging.lout packaging.text.gz packaging.ps \
42 packaging.pdf.gz menu-policy.text.gz \
43 policy-process.text.gz policy-process.pdf.gz \
44 proposal.text.gz menu-policy.pdf.gz proposal.pdf.gz \
45 mime-policy.text.gz mime-policy.pdf.gz
46 STAMPS_TO_CLEAN = stamp-policy stamp-packaging stamp-build stamp-configure
47 DIRS_TO_CLEAN = debian/tmp policy.html fhs debian/tmp-packaging \
48 packaging.html menu-policy.html mime-policy.html \
49 proposal.html policy-process.html
50 SGML_FILES = policy packaging menu-policy mime-policy proposal \
53 # Location of the source dir
54 SRCTOP := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi;)
55 TMPTOP := $(SRCTOP)/debian/tmp
56 DOCDIR := $(TMPTOP)/usr/share/doc/$(package)
57 LIBDIR := $(TMPTOP)/usr/share/doc-base
59 PTMPTOP := $(SRCTOP)/debian/tmp-packaging
60 PDOCDIR := $(PTMPTOP)/usr/share/doc/$(ppackage)
61 PLIBDIR := $(PTMPTOP)/usr/share/doc-base
63 # While we have two versions of the FHS installed in the source package,
64 # we need to modify this to handle it. This is the easiest way to do it.
65 # FHS_ARCHIVE =$(shell ls -1 fhs*.tar.gz)
66 # And with version 2.1, we have to build the text and dvi versions
68 FHS_ARCHIVE =fhs-2.1-source.tar.gz
69 FHS_FILES =fhs/fhs.dvi fhs/fhs.ps fhs/fhs.txt fhs/fhs.pdf
70 FSSTND_FILES =FSSTND-FAQ fsstnd-1.2.dvi.gz fsstnd-1.2.ps.gz fsstnd-1.2.txt.gz
71 POLICY_FILES =policy.text.gz policy.sgml virtual-package-names-list.text \
72 upgrading-checklist.text libc6-migration.text \
73 version.ent proposal.sgml proposal.text.gz \
74 menu-policy.sgml menu-policy.text.gz \
75 mime-policy.sgml mime-policy.text.gz \
76 policy-process.text.gz policy-process.sgml
77 BYHAND_FILES =policy.text.gz libc6-migration.text \
78 virtual-package-names-list.text menu-policy.text.gz \
80 PBYHAND_FILES=packaging.text.gz
82 install_file = /usr/bin/install -p -o root -g root -m 644
83 install_program= /usr/bin/install -p -o root -g root -m 755
84 make_directory = /usr/bin/install -p -d -o root -g root -m 755
86 GROFF_VERSION := $(shell dpkg -s groff | sed -n -e 's/Version: //p')
89 all build: stamp-build
92 -test -f stamp-configure || $(MAKE) -f debian/rules configure
93 for file in $(SGML_FILES); do \
94 nsgmls -gues $$file.sgml; \
95 debiandoc2html $$file.sgml; \
96 debiandoc2text $$file.sgml; \
97 if [ -f $$file.txt ]; then mv $$file.txt $$file.text; fi; \
98 gzip -9f $$file.text; \
100 tar zfx $(FHS_ARCHIVE)
101 # Need to use a patched tmac.m macro file if we're using a pre-1.16
102 # groff; version 1.16 is apparently fixed
103 if dpkg --compare-versions $(GROFF_VERSION) lt 1.16; then \
104 cp /usr/share/groff/tmac/tmac.m fhs && \
105 cd fhs && patch -p1 < ../mm1.32-patch; \
107 # The extra '.' in the tmac path doesn't matter if
108 GROFF_TMAC_PATH=. cd fhs && $(MAKE) all
109 lynx -dump fhs-changes-2.1.html > fhs/fhs-changes-2.1.text
110 lynx -dump upgrading-checklist.html > upgrading-checklist.text
113 configure: stamp-configure
116 echo "<!entity version \"$(version)\">" >> version.ent
117 echo "<!entity date \"$(date)\">" >> version.ent
118 touch stamp-configure
121 # Undoes the effect of `make -f debian/rules build'.
123 rm -f $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
124 rm -rf $(DIRS_TO_CLEAN)
125 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
126 -name '*~' -o -name '*.bak' -o -name '#*#' -o \
127 -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
128 -size 0 \) -print` TAGS
131 binary: binary-indep binary-arch
134 # There are no architecture-dependent files to be uploaded
135 # generated by this package. If there were any they would be
138 binary-indep: stamp-policy stamp-packaging
140 @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
141 (echo need root priviledges; exit 1)
143 test -f stamp-build || $(MAKE) -f debian/rules build
145 $(make_directory) $(TMPTOP)/DEBIAN
146 $(make_directory) $(DOCDIR)/fsstnd
147 $(make_directory) $(DOCDIR)/fhs
148 $(make_directory) $(LIBDIR)
149 # create a substvar to reference from debian/control so that
150 # we don't hardcode the policy compliance of the policy
151 # package. I guess some might question this but I take it as
152 # a given that the debian-policy pkg must always comply with
154 echo "debian-policy:Version=$(version)" > debian/substvars
155 echo "packaging-manual:Version=$(version)" >> debian/substvars
156 $(install_file) $(POLICY_FILES) $(DOCDIR)/
157 $(install_file) $(FSSTND_FILES) $(DOCDIR)/fsstnd/
158 $(install_file) $(FHS_FILES) $(DOCDIR)/fhs/
159 $(install_file) debian/changelog $(DOCDIR)/
160 -gzip -fqr9 $(DOCDIR)
161 $(install_file) debian/copyright $(DOCDIR)/
162 $(install_file) debian-policy.desc $(LIBDIR)/debian-policy
163 (tar cf - policy.html) | (cd $(DOCDIR); tar xf -)
164 (tar cf - menu-policy.html) | (cd $(DOCDIR); tar xf -)
165 (tar cf - mime-policy.html) | (cd $(DOCDIR); tar xf -)
166 (tar cf - proposal.html) | (cd $(DOCDIR); tar xf -)
167 (tar cf - policy-process.html) | (cd $(DOCDIR); tar xf -)
168 sed -e 's/#PACKAGE#/$(package)/g' debian/postinst.in > debian/postinst
169 sed -e 's/#PACKAGE#/$(package)/g' debian/prerm.in > debian/prerm
170 $(install_program) debian/{postinst,prerm} debian/tmp/DEBIAN/
171 dpkg-gencontrol -pdebian-policy -Pdebian/tmp -isp
172 chown -R root.root debian/tmp
173 chmod -R go=rX debian/tmp
174 dpkg --build debian/tmp ..
175 debiandoc2latexps policy.sgml
177 gzip -9qvf ../policy.ps
178 debiandoc2latexpdf policy.sgml
180 gzip -9qfv ../policy.pdf
181 GZIP=-9v tar zcf ../policy.html.tar.gz policy.html
182 dpkg-distaddfile -fdebian/files policy.ps.gz byhand -
183 dpkg-distaddfile -fdebian/files policy.pdf.gz byhand -
184 dpkg-distaddfile -fdebian/files policy.html.tar.gz byhand -
185 for i in $(BYHAND_FILES); do \
186 $(install_file) $$i .. ; \
187 dpkg-distaddfile -fdebian/files $$i byhand - ; \
191 stamp-packaging: build
192 @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
193 (echo need root priviledges; exit 1)
195 test -f stamp-build || $(MAKE) -f debian/rules build
197 $(make_directory) $(PTMPTOP)/DEBIAN
198 $(make_directory) $(PDOCDIR)
199 $(make_directory) $(PLIBDIR)
200 echo "debian-policy:Version=$(version)" > debian/substvars
201 echo "packaging-manual:Version=$(version)" >> debian/substvars
203 $(install_file) packaging.sgml $(PDOCDIR)/
204 $(install_file) debian/changelog $(PDOCDIR)/
205 -gzip -fqr9 $(PDOCDIR)
206 $(install_file) version.ent $(PDOCDIR)/
207 $(install_file) packaging.text.gz $(PDOCDIR)/
208 $(install_file) debian/copyright $(PDOCDIR)/
209 $(install_file) packaging-manual.desc $(PLIBDIR)/packaging-manual
210 (tar cf - packaging.html) | (cd $(PDOCDIR); tar xf -)
211 sed -e 's/#PACKAGE#/$(ppackage)/g' debian/postinst.in > debian/postinst
212 sed -e 's/#PACKAGE#/$(ppackage)/g' debian/prerm.in > debian/prerm
213 $(install_program) debian/{postinst,prerm} debian/tmp-packaging/DEBIAN/
214 dpkg-gencontrol -ppackaging-manual -Pdebian/tmp-packaging -isp
215 chown -R root.root debian/tmp-packaging
216 chmod -R go=rX debian/tmp-packaging
217 dpkg --build debian/tmp-packaging ..
218 debiandoc2latexps packaging.sgml
219 debiandoc2latexpdf packaging.sgml
222 gzip -9vf ../packaging.ps
223 gzip -9vf ../packaging.pdf
224 GZIP=-9v tar zcf ../packaging.html.tar.gz packaging.html
225 dpkg-distaddfile -fdebian/files packaging.ps.gz byhand -
226 dpkg-distaddfile -fdebian/files packaging.pdf.gz byhand -
227 dpkg-distaddfile -fdebian/files packaging.html.tar.gz byhand -
228 for i in $(PBYHAND_FILES); do \
229 $(install_file) $$i .. ; \
230 dpkg-distaddfile -fdebian/files $$i byhand - ; \
232 touch stamp-packaging
236 test -f debian/rules -a -f policy.sgml
240 @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
242 .PHONY: binary binary-arch binary-indep clean checkroot