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 : Fri Mar 17 17:01:28 2000
9 ## Last Machine Used: glaurung.green-gryphon.com
11 ## Status : Unknown, Use with caution!
15 ###############################################################################
16 # The name of the package (for example, `emacs').
17 package := $(shell grep Source debian/control | sed 's/^Source: //')
18 arch := $(shell dpkg --print-installation-architecture)
19 date := $(shell date +"%Y-%m-%d")
20 version := $(shell LC_ALL=C dpkg-parsechangelog | \
21 grep ^Version: | sed 's/^Version: *//')
22 ppackage:= packaging-manual
24 FILES_TO_CLEAN = debian/files debian/buildinfo debian/substvars \
25 debian/postinst debian/prerm \
26 version.ent policy.lout policy.lout.ld lout.li \
27 upgrading-checklist.text policy.text.gz \
28 packaging.lout packaging.text.gz packaging.ps \
29 packaging.pdf.gz menu-policy.text.gz \
30 policy-process.text.gz policy-process.pdf.gz \
31 proposal.text.gz menu-policy.pdf.gz proposal.pdf.gz \
32 mime-policy.text.gz mime-policy.pdf.gz
33 STAMPS_TO_CLEAN = stamp-policy stamp-packaging stamp-build stamp-configure
34 DIRS_TO_CLEAN = debian/tmp policy.html fhs debian/tmp-packaging \
35 packaging.html menu-policy.html mime-policy.html \
36 proposal.html policy-process.html
37 SGML_FILES = policy packaging menu-policy mime-policy proposal \
40 # Location of the source dir
41 SRCTOP := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi;)
42 TMPTOP := $(SRCTOP)/debian/tmp
43 DOCDIR := $(TMPTOP)/usr/share/doc/$(package)
44 LIBDIR := $(TMPTOP)/usr/share/doc-base
46 PTMPTOP := $(SRCTOP)/debian/tmp-packaging
47 PDOCDIR := $(PTMPTOP)/usr/share/doc/$(ppackage)
48 PLIBDIR := $(PTMPTOP)/usr/share/doc-base
50 # While we have two versions of the FHS installed in the source package,
51 # we need to modify this to handle it. This is the easiest way to do it.
52 # FHS_ARCHIVE =$(shell ls -1 fhs*.tar.gz)
53 # And with version 2.1, we have to build the text and dvi versions
55 FHS_ARCHIVE =fhs-2.1-source.tar.gz
56 FHS_FILES =fhs/fhs.dvi fhs/fhs.ps fhs/fhs.txt fhs/fhs.pdf
57 FSSTND_FILES =FSSTND-FAQ fsstnd-1.2.dvi.gz fsstnd-1.2.ps.gz fsstnd-1.2.txt.gz
58 POLICY_FILES =policy.text.gz policy.sgml virtual-package-names-list.text \
59 upgrading-checklist.text libc6-migration.text \
60 version.ent proposal.sgml proposal.text.gz \
61 menu-policy.sgml menu-policy.text.gz \
62 mime-policy.sgml mime-policy.text.gz \
63 policy-process.text.gz policy-process.sgml
64 BYHAND_FILES =policy.text.gz libc6-migration.text \
65 virtual-package-names-list.text menu-policy.text.gz \
67 PBYHAND_FILES=packaging.text.gz
69 install_file = /usr/bin/install -p -o root -g root -m 644
70 install_program= /usr/bin/install -p -o root -g root -m 755
71 make_directory = /usr/bin/install -p -d -o root -g root -m 755
74 all build: stamp-build
77 -test -f stamp-configure || $(MAKE) -f debian/rules configure
78 for file in $(SGML_FILES); do \
79 nsgmls -gues $$file.sgml; \
80 debiandoc2html $$file.sgml; \
81 debiandoc2text $$file.sgml; \
82 if [ -f $$file.txt ]; then mv $$file.txt $$file.text; fi; \
83 gzip -9f $$file.text; \
85 tar zfx $(FHS_ARCHIVE)
86 # Need to use a patched tmac.m macro file; can remove this
87 # bit once groff is fixed
88 cp /usr/share/groff/tmac/tmac.m fhs
89 cd fhs && patch -p1 < ../mm1.32-patch
90 GROFF_TMAC_PATH=. cd fhs && $(MAKE) all
91 lynx -dump fhs-changes-2.1.html > fhs/fhs-changes-2.1.text
92 lynx -dump upgrading-checklist.html > upgrading-checklist.text
95 configure: stamp-configure
98 echo "<!entity version \"$(version)\">" >> version.ent
99 echo "<!entity date \"$(date)\">" >> version.ent
100 touch stamp-configure
103 # Undoes the effect of `make -f debian/rules build'.
105 rm -f $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
106 rm -rf $(DIRS_TO_CLEAN)
107 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
108 -name '*~' -o -name '*.bak' -o -name '#*#' -o \
109 -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
110 -size 0 \) -print` TAGS
113 binary: binary-indep binary-arch
116 # There are no architecture-dependent files to be uploaded
117 # generated by this package. If there were any they would be
120 binary-indep: stamp-policy stamp-packaging
122 @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
123 (echo need root priviledges; exit 1)
125 test -f stamp-build || $(MAKE) -f debian/rules build
127 $(make_directory) $(TMPTOP)/DEBIAN
128 $(make_directory) $(DOCDIR)/fsstnd
129 $(make_directory) $(DOCDIR)/fhs
130 $(make_directory) $(LIBDIR)
131 # create a substvar to reference from debian/control so that
132 # we don't hardcode the policy compliance of the policy
133 # package. I guess some might question this but I take it as
134 # a given that the debian-policy pkg must always comply with
136 echo "debian-policy:Version=$(version)" > debian/substvars
137 echo "packaging-manual:Version=$(version)" >> debian/substvars
138 $(install_file) $(POLICY_FILES) $(DOCDIR)/
139 $(install_file) $(FSSTND_FILES) $(DOCDIR)/fsstnd/
140 $(install_file) $(FHS_FILES) $(DOCDIR)/fhs/
141 $(install_file) debian/changelog $(DOCDIR)/
142 -gzip -fqr9 $(DOCDIR)
143 $(install_file) debian/copyright $(DOCDIR)/
144 $(install_file) debian-policy.desc $(LIBDIR)/debian-policy
145 (tar cf - policy.html) | (cd $(DOCDIR); tar xf -)
146 (tar cf - menu-policy.html) | (cd $(DOCDIR); tar xf -)
147 (tar cf - mime-policy.html) | (cd $(DOCDIR); tar xf -)
148 (tar cf - proposal.html) | (cd $(DOCDIR); tar xf -)
149 (tar cf - policy-process.html) | (cd $(DOCDIR); tar xf -)
150 sed -e 's/#PACKAGE#/$(package)/g' debian/postinst.in > debian/postinst
151 sed -e 's/#PACKAGE#/$(package)/g' debian/prerm.in > debian/prerm
152 $(install_program) debian/{postinst,prerm} debian/tmp/DEBIAN/
153 dpkg-gencontrol -pdebian-policy -Pdebian/tmp -isp
154 chown -R root.root debian/tmp
155 chmod -R go=rX debian/tmp
156 dpkg --build debian/tmp ..
157 debiandoc2latexps policy.sgml
159 gzip -9qvf ../policy.ps
160 debiandoc2latexpdf policy.sgml
162 gzip -9qfv ../policy.pdf
163 GZIP=-9v tar zcf ../policy.html.tar.gz policy.html
164 dpkg-distaddfile -fdebian/files policy.ps.gz byhand -
165 dpkg-distaddfile -fdebian/files policy.pdf.gz byhand -
166 dpkg-distaddfile -fdebian/files policy.html.tar.gz byhand -
167 for i in $(BYHAND_FILES); do \
168 $(install_file) $$i .. ; \
169 dpkg-distaddfile -fdebian/files $$i byhand - ; \
173 stamp-packaging: build
174 @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
175 (echo need root priviledges; exit 1)
177 test -f stamp-build || $(MAKE) -f debian/rules build
179 $(make_directory) $(PTMPTOP)/DEBIAN
180 $(make_directory) $(PDOCDIR)
181 $(make_directory) $(PLIBDIR)
182 echo "debian-policy:Version=$(version)" > debian/substvars
183 echo "packaging-manual:Version=$(version)" >> debian/substvars
185 $(install_file) packaging.sgml $(PDOCDIR)/
186 $(install_file) version.ent $(PDOCDIR)/
187 $(install_file) debian/changelog $(PDOCDIR)/
188 -gzip -fqr9 $(PDOCDIR)
189 $(install_file) packaging.text.gz $(PDOCDIR)/
190 $(install_file) debian/copyright $(PDOCDIR)/
191 $(install_file) packaging-manual.desc $(PLIBDIR)/packaging-manual
192 (tar cf - packaging.html) | (cd $(PDOCDIR); tar xf -)
193 sed -e 's/#PACKAGE#/$(ppackage)/g' debian/postinst.in > debian/postinst
194 sed -e 's/#PACKAGE#/$(ppackage)/g' debian/prerm.in > debian/prerm
195 $(install_program) debian/{postinst,prerm} debian/tmp-packaging/DEBIAN/
196 dpkg-gencontrol -ppackaging-manual -Pdebian/tmp-packaging -isp
197 chown -R root.root debian/tmp-packaging
198 chmod -R go=rX debian/tmp-packaging
199 dpkg --build debian/tmp-packaging ..
200 debiandoc2latexps packaging.sgml
201 debiandoc2latexpdf packaging.sgml
204 gzip -9vf ../packaging.ps
205 gzip -9vf ../packaging.pdf
206 GZIP=-9v tar zcf ../packaging.html.tar.gz packaging.html
207 dpkg-distaddfile -fdebian/files packaging.ps.gz byhand -
208 dpkg-distaddfile -fdebian/files packaging.pdf.gz byhand -
209 dpkg-distaddfile -fdebian/files packaging.html.tar.gz byhand -
210 for i in $(PBYHAND_FILES); do \
211 $(install_file) $$i .. ; \
212 dpkg-distaddfile -fdebian/files $$i byhand - ; \
218 test -f debian/rules -a -f policy.sgml
222 @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
224 .PHONY: binary binary-arch binary-indep clean checkroot