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 if we're using a pre-1.16
87 # groff; version 1.16 is apparently fixed
88 if [ dpkg --compare-versions \
89 `dpkg -s groff | sed -n -e 's/Version: //p'` lt 1.16 ]; then \
90 cp /usr/share/groff/tmac/tmac.m fhs && \
91 cd fhs && patch -p1 < ../mm1.32-patch; \
93 # The extra '.' in the tmac path doesn't matter if
94 GROFF_TMAC_PATH=. cd fhs && $(MAKE) all
95 lynx -dump fhs-changes-2.1.html > fhs/fhs-changes-2.1.text
96 lynx -dump upgrading-checklist.html > upgrading-checklist.text
99 configure: stamp-configure
102 echo "<!entity version \"$(version)\">" >> version.ent
103 echo "<!entity date \"$(date)\">" >> version.ent
104 touch stamp-configure
107 # Undoes the effect of `make -f debian/rules build'.
109 rm -f $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
110 rm -rf $(DIRS_TO_CLEAN)
111 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
112 -name '*~' -o -name '*.bak' -o -name '#*#' -o \
113 -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
114 -size 0 \) -print` TAGS
117 binary: binary-indep binary-arch
120 # There are no architecture-dependent files to be uploaded
121 # generated by this package. If there were any they would be
124 binary-indep: stamp-policy stamp-packaging
126 @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
127 (echo need root priviledges; exit 1)
129 test -f stamp-build || $(MAKE) -f debian/rules build
131 $(make_directory) $(TMPTOP)/DEBIAN
132 $(make_directory) $(DOCDIR)/fsstnd
133 $(make_directory) $(DOCDIR)/fhs
134 $(make_directory) $(LIBDIR)
135 # create a substvar to reference from debian/control so that
136 # we don't hardcode the policy compliance of the policy
137 # package. I guess some might question this but I take it as
138 # a given that the debian-policy pkg must always comply with
140 echo "debian-policy:Version=$(version)" > debian/substvars
141 echo "packaging-manual:Version=$(version)" >> debian/substvars
142 $(install_file) $(POLICY_FILES) $(DOCDIR)/
143 $(install_file) $(FSSTND_FILES) $(DOCDIR)/fsstnd/
144 $(install_file) $(FHS_FILES) $(DOCDIR)/fhs/
145 $(install_file) debian/changelog $(DOCDIR)/
146 -gzip -fqr9 $(DOCDIR)
147 $(install_file) debian/copyright $(DOCDIR)/
148 $(install_file) debian-policy.desc $(LIBDIR)/debian-policy
149 (tar cf - policy.html) | (cd $(DOCDIR); tar xf -)
150 (tar cf - menu-policy.html) | (cd $(DOCDIR); tar xf -)
151 (tar cf - mime-policy.html) | (cd $(DOCDIR); tar xf -)
152 (tar cf - proposal.html) | (cd $(DOCDIR); tar xf -)
153 (tar cf - policy-process.html) | (cd $(DOCDIR); tar xf -)
154 sed -e 's/#PACKAGE#/$(package)/g' debian/postinst.in > debian/postinst
155 sed -e 's/#PACKAGE#/$(package)/g' debian/prerm.in > debian/prerm
156 $(install_program) debian/{postinst,prerm} debian/tmp/DEBIAN/
157 dpkg-gencontrol -pdebian-policy -Pdebian/tmp -isp
158 chown -R root.root debian/tmp
159 chmod -R go=rX debian/tmp
160 dpkg --build debian/tmp ..
161 debiandoc2latexps policy.sgml
163 gzip -9qvf ../policy.ps
164 debiandoc2latexpdf policy.sgml
166 gzip -9qfv ../policy.pdf
167 GZIP=-9v tar zcf ../policy.html.tar.gz policy.html
168 dpkg-distaddfile -fdebian/files policy.ps.gz byhand -
169 dpkg-distaddfile -fdebian/files policy.pdf.gz byhand -
170 dpkg-distaddfile -fdebian/files policy.html.tar.gz byhand -
171 for i in $(BYHAND_FILES); do \
172 $(install_file) $$i .. ; \
173 dpkg-distaddfile -fdebian/files $$i byhand - ; \
177 stamp-packaging: build
178 @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
179 (echo need root priviledges; exit 1)
181 test -f stamp-build || $(MAKE) -f debian/rules build
183 $(make_directory) $(PTMPTOP)/DEBIAN
184 $(make_directory) $(PDOCDIR)
185 $(make_directory) $(PLIBDIR)
186 echo "debian-policy:Version=$(version)" > debian/substvars
187 echo "packaging-manual:Version=$(version)" >> debian/substvars
189 $(install_file) packaging.sgml $(PDOCDIR)/
190 $(install_file) version.ent $(PDOCDIR)/
191 $(install_file) debian/changelog $(PDOCDIR)/
192 -gzip -fqr9 $(PDOCDIR)
193 $(install_file) packaging.text.gz $(PDOCDIR)/
194 $(install_file) debian/copyright $(PDOCDIR)/
195 $(install_file) packaging-manual.desc $(PLIBDIR)/packaging-manual
196 (tar cf - packaging.html) | (cd $(PDOCDIR); tar xf -)
197 sed -e 's/#PACKAGE#/$(ppackage)/g' debian/postinst.in > debian/postinst
198 sed -e 's/#PACKAGE#/$(ppackage)/g' debian/prerm.in > debian/prerm
199 $(install_program) debian/{postinst,prerm} debian/tmp-packaging/DEBIAN/
200 dpkg-gencontrol -ppackaging-manual -Pdebian/tmp-packaging -isp
201 chown -R root.root debian/tmp-packaging
202 chmod -R go=rX debian/tmp-packaging
203 dpkg --build debian/tmp-packaging ..
204 debiandoc2latexps packaging.sgml
205 debiandoc2latexpdf packaging.sgml
208 gzip -9vf ../packaging.ps
209 gzip -9vf ../packaging.pdf
210 GZIP=-9v tar zcf ../packaging.html.tar.gz packaging.html
211 dpkg-distaddfile -fdebian/files packaging.ps.gz byhand -
212 dpkg-distaddfile -fdebian/files packaging.pdf.gz byhand -
213 dpkg-distaddfile -fdebian/files packaging.html.tar.gz byhand -
214 for i in $(PBYHAND_FILES); do \
215 $(install_file) $$i .. ; \
216 dpkg-distaddfile -fdebian/files $$i byhand - ; \
222 test -f debian/rules -a -f policy.sgml
226 @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
228 .PHONY: binary binary-arch binary-indep clean checkroot