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 : Wed Sep 6 09:37:43 2000
9 ## Last Machine Used: glaurung.green-gryphon.com
11 ## Status : Unknown, Use with caution!
15 ###############################################################################
21 # set the dpkg-architecture vars
22 export DEB_BUILD_ARCH := $(shell dpkg-architecture $(ha) -qDEB_BUILD_ARCH)
23 export DEB_BUILD_GNU_CPU := $(shell dpkg-architecture $(ha) -qDEB_BUILD_GNU_CPU)
24 export DEB_BUILD_GNU_SYSTEM:= $(shell dpkg-architecture $(ha) -qDEB_BUILD_GNU_SYSTEM)
25 export DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture $(ha) -qDEB_BUILD_GNU_TYPE)
26 export DEB_HOST_ARCH := $(shell dpkg-architecture $(ha) -qDEB_HOST_ARCH)
27 export DEB_HOST_GNU_CPU := $(shell dpkg-architecture $(ha) -qDEB_HOST_GNU_CPU)
28 export DEB_HOST_GNU_SYSTEM := $(shell dpkg-architecture $(ha) -qDEB_HOST_GNU_SYSTEM)
29 export DEB_HOST_GNU_TYPE := $(shell dpkg-architecture $(ha) -qDEB_HOST_GNU_TYPE)
33 # The name of the package (for example, `emacs').
34 package := $(shell grep Source debian/control | sed 's/^Source: //')
35 arch := $(shell dpkg --print-installation-architecture)
36 date := $(shell date +"%Y-%m-%d")
37 version := $(shell LC_ALL=C dpkg-parsechangelog | \
38 grep ^Version: | sed 's/^Version: *//')
40 FILES_TO_CLEAN = debian/files debian/buildinfo debian/substvars \
41 debian/postinst debian/prerm \
42 version.ent policy.lout policy.lout.ld lout.li \
43 upgrading-checklist.text policy.text.gz \
44 menu-policy.text.gz menu-policy.pdf.gz \
45 policy-process.text.gz policy-process.pdf.gz \
46 mime-policy.text.gz mime-policy.pdf.gz \
47 debconf_spec/debconf_specification.html \
48 debconf_spec/debconf_specification.txt.gz \
50 STAMPS_TO_CLEAN = stamp-policy stamp-build stamp-configure
51 DIRS_TO_CLEAN = debian/tmp policy.html fhs \
52 menu-policy.html mime-policy.html \
54 SGML_FILES = policy menu-policy mime-policy policy-process
56 # Location of the source dir
57 SRCTOP := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi;)
58 TMPTOP := $(SRCTOP)/debian/tmp
59 DOCDIR := $(TMPTOP)/usr/share/doc/$(package)
60 LIBDIR := $(TMPTOP)/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_HTML =fhs-2.1.html.tar.gz
70 FHS_FILES =fhs/fhs.ps fhs/fhs.txt fhs/fhs.pdf
71 FHS_BYHAND =fhs-2.1.html.tar.gz fhs/fhs.txt
72 # FSSTND_FILES =FSSTND-FAQ fsstnd-1.2.dvi.gz fsstnd-1.2.ps.gz fsstnd-1.2.txt.gz
73 POLICY_FILES =policy.text.gz policy.sgml virtual-package-names-list.text \
74 upgrading-checklist.text libc6-migration.text version.ent \
75 menu-policy.sgml menu-policy.text.gz \
76 mime-policy.sgml mime-policy.text.gz \
77 policy-process.text.gz policy-process.sgml \
78 debconf_spec/debconf_specification.html \
79 debconf_spec/debconf_specification.txt.gz
80 BYHAND_FILES =policy.text.gz libc6-migration.text \
81 virtual-package-names-list.text menu-policy.text.gz \
82 mime-policy.text.gz policy.ps.gz policy.pdf.gz \
84 debconf_spec/debconf_specification.txt.gz \
88 install_file = /usr/bin/install -p -o root -g root -m 644
89 install_program= /usr/bin/install -p -o root -g root -m 755
90 make_directory = /usr/bin/install -p -d -o root -g root -m 755
92 GROFF_VERSION := $(shell dpkg -s groff | sed -n -e 's/Version: //p')
95 all build: stamp-build
98 -test -f stamp-configure || $(MAKE) -f debian/rules configure
99 for file in $(SGML_FILES); do \
100 nsgmls -gues $$file.sgml; \
101 debiandoc2html $$file.sgml; \
102 debiandoc2text $$file.sgml; \
103 if [ -f $$file.txt ]; then mv $$file.txt $$file.text; fi; \
104 gzip -9f $$file.text; \
106 tar zfx $(FHS_ARCHIVE)
107 # Need to use a patched tmac.m macro file if we're using a pre-1.16
108 # groff; version 1.16 is apparently fixed
109 if dpkg --compare-versions $(GROFF_VERSION) lt 1.16; then \
110 cp /usr/share/groff/tmac/tmac.m fhs && \
111 cd fhs && patch -p1 < ../mm1.32-patch; \
113 # The extra '.' in the tmac path doesn't matter if
114 GROFF_TMAC_PATH=. cd fhs && $(MAKE) fhs.ps fhs.pdf fhs.txt
115 links -dump fhs-changes-2.1.html | perl -pe 's/[\r\0]//g' > \
116 fhs/fhs-changes-2.1.text
117 cd fhs && tar zfx ../$(FHS_HTML)
118 links -dump upgrading-checklist.html | perl -pe 's/[\r\0]//g' > \
119 upgrading-checklist.text
120 $(MAKE) -C debconf_spec all
121 gzip -9f debconf_spec/debconf_specification.txt
124 configure: stamp-configure
127 echo "<!entity version \"$(version)\">" >> version.ent
128 echo "<!entity date \"$(date)\">" >> version.ent
129 touch stamp-configure
132 # Undoes the effect of `make -f debian/rules build'.
134 rm -f $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
135 rm -rf $(DIRS_TO_CLEAN)
136 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
137 -name '*~' -o -name '*.bak' -o -name '#*#' -o \
138 -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
139 -size 0 \) -print` TAGS
142 binary: binary-indep binary-arch
145 # There are no architecture-dependent files to be uploaded
146 # generated by this package. If there were any they would be
149 binary-indep: stamp-policy
151 @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
152 (echo need root priviledges; exit 1)
154 test -f stamp-build || $(MAKE) -f debian/rules build
156 $(make_directory) $(TMPTOP)/DEBIAN
157 # $(make_directory) $(DOCDIR)/fsstnd
158 $(make_directory) $(DOCDIR)/fhs
159 $(make_directory) $(LIBDIR)
160 # create a substvar to reference from debian/control so that
161 # we don't hardcode the policy compliance of the policy
162 # package. I guess some might question this but I take it as
163 # a given that the debian-policy pkg must always comply with
165 echo "debian-policy:Version=$(version)" > debian/substvars
166 $(install_file) $(POLICY_FILES) $(DOCDIR)/
167 # $(install_file) $(FSSTND_FILES) $(DOCDIR)/fsstnd/
168 $(install_file) $(FHS_FILES) $(DOCDIR)/fhs/
169 $(install_file) debian/changelog $(DOCDIR)/
170 -gzip -fqr9 $(DOCDIR)
171 -gunzip $(DOCDIR)/version.ent
172 $(install_file) debian/copyright $(DOCDIR)/
173 $(install_file) debian-policy.desc $(LIBDIR)/debian-policy
174 (tar cf - policy.html) | (cd $(DOCDIR); tar xf -)
175 (tar cf - menu-policy.html) | (cd $(DOCDIR); tar xf -)
176 (tar cf - mime-policy.html) | (cd $(DOCDIR); tar xf -)
177 (tar cf - policy-process.html) | (cd $(DOCDIR); tar xf -)
178 sed -e 's/#PACKAGE#/$(package)/g' debian/postinst.in > debian/postinst
179 sed -e 's/#PACKAGE#/$(package)/g' debian/prerm.in > debian/prerm
180 $(install_program) debian/postinst debian/tmp/DEBIAN/
181 $(install_program) debian/prerm debian/tmp/DEBIAN/
182 dpkg-gencontrol -pdebian-policy -Pdebian/tmp -isp
183 chown -R root.root debian/tmp
184 chmod -R go=rX debian/tmp
185 dpkg --build debian/tmp ..
186 debiandoc2latexps policy.sgml
188 debiandoc2latexpdf policy.sgml
189 gzip -9qfv policy.pdf
190 GZIP=-9v tar zcf policy.html.tar.gz policy.html
191 for i in $(BYHAND_FILES); do \
192 $(install_file) $$i .. ; \
193 dpkg-distaddfile -fdebian/files `basename $$i` byhand - ; \
199 test -f debian/rules -a -f policy.sgml
203 @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
205 .PHONY: binary binary-arch binary-indep clean checkroot