]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/rules
1969428dbc6ffbbdf90ee4fb003b62b9488df110
[debian/debian-policy.git] / debian / rules
1 #!/usr/bin/make -f
2 ############################ -*- Mode: Makefile -*- ###########################
3 ## rules ---
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
10 ## Update Count     : 55
11 ## Status           : Unknown, Use with caution!
12 ## HISTORY          :
13 ## Description      :
14 ## $Id$
15 ###############################################################################
16
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)
26
27
28
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
36
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 \
51                   policy-process
52
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
58
59 PTMPTOP   := $(SRCTOP)/debian/tmp-packaging
60 PDOCDIR   := $(PTMPTOP)/usr/share/doc/$(ppackage)
61 PLIBDIR   := $(PTMPTOP)/usr/share/doc-base
62
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
67 # ourselves :-(
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 \
79               mime-policy.text.gz
80 PBYHAND_FILES=packaging.text.gz
81
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
85
86
87 all build: stamp-build
88 stamp-build:
89         $(checkdir)
90         -test -f stamp-configure || $(MAKE) -f debian/rules configure
91         for file in $(SGML_FILES); do \
92           nsgmls -gues $$file.sgml; \
93           debiandoc2html $$file.sgml; \
94           debiandoc2text $$file.sgml; \
95           if [ -f $$file.txt ]; then mv $$file.txt $$file.text; fi; \
96           gzip -9f $$file.text; \
97         done
98         tar zfx $(FHS_ARCHIVE)
99         # Need to use a patched tmac.m macro file if we're using a pre-1.16
100         # groff; version 1.16 is apparently fixed
101         if [ dpkg --compare-versions \
102             `dpkg -s groff | sed -n -e 's/Version: //p'` lt 1.16 ]; then \
103             cp /usr/share/groff/tmac/tmac.m fhs && \
104             cd fhs && patch -p1 < ../mm1.32-patch; \
105         fi
106         # The extra '.' in the tmac path doesn't matter if
107         GROFF_TMAC_PATH=. cd fhs && $(MAKE) all
108         lynx -dump fhs-changes-2.1.html > fhs/fhs-changes-2.1.text
109         lynx -dump upgrading-checklist.html > upgrading-checklist.text
110         touch stamp-build
111
112 configure: stamp-configure
113 stamp-configure:
114         rm -f version.ent
115         echo "<!entity version \"$(version)\">" >> version.ent
116         echo "<!entity date    \"$(date)\">"        >> version.ent
117         touch stamp-configure
118
119 clean:
120 # Undoes the effect of `make -f debian/rules build'.
121         $(checkdir)
122         rm -f  $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
123         rm -rf $(DIRS_TO_CLEAN)
124         rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
125           -name '*~' -o -name '*.bak' -o -name '#*#' -o \
126           -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
127           -size 0 \) -print` TAGS
128
129
130 binary:         binary-indep binary-arch
131 binary-arch:    build
132         $(checkdir)
133 # There are no architecture-dependent files to be uploaded
134 # generated by this package.  If there were any they would be
135 # made here.
136
137 binary-indep:   stamp-policy stamp-packaging
138 stamp-policy:  build
139         @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
140                 (echo need root priviledges; exit 1)
141         $(checkdir)
142         test -f stamp-build     || $(MAKE) -f        debian/rules build
143         -rm -rf                 $(TMPTOP)
144         $(make_directory)       $(TMPTOP)/DEBIAN
145         $(make_directory)       $(DOCDIR)/fsstnd
146         $(make_directory)       $(DOCDIR)/fhs
147         $(make_directory)       $(LIBDIR)
148         # create a substvar to reference from debian/control so that
149         # we don't hardcode the policy compliance of the policy
150         # package.  I guess some might question this but I take it as
151         # a given that the debian-policy pkg must always comply with
152         # itself...
153         echo "debian-policy:Version=$(version)"      > debian/substvars
154         echo "packaging-manual:Version=$(version)"   >> debian/substvars
155         $(install_file)     $(POLICY_FILES)          $(DOCDIR)/
156         $(install_file)     $(FSSTND_FILES)          $(DOCDIR)/fsstnd/
157         $(install_file)     $(FHS_FILES)             $(DOCDIR)/fhs/
158         $(install_file)     debian/changelog         $(DOCDIR)/
159         -gzip -fqr9         $(DOCDIR)
160         $(install_file)     debian/copyright         $(DOCDIR)/
161         $(install_file)     debian-policy.desc       $(LIBDIR)/debian-policy
162         (tar cf -           policy.html) |           (cd $(DOCDIR);   tar xf -)
163         (tar cf -           menu-policy.html) |      (cd $(DOCDIR);   tar xf -)
164         (tar cf -           mime-policy.html) |      (cd $(DOCDIR);   tar xf -)
165         (tar cf -           proposal.html) |         (cd $(DOCDIR);   tar xf -)
166         (tar cf -           policy-process.html) |   (cd $(DOCDIR);   tar xf -)
167         sed -e 's/#PACKAGE#/$(package)/g' debian/postinst.in > debian/postinst
168         sed -e 's/#PACKAGE#/$(package)/g' debian/prerm.in > debian/prerm
169         $(install_program)  debian/{postinst,prerm}  debian/tmp/DEBIAN/
170         dpkg-gencontrol     -pdebian-policy -Pdebian/tmp -isp
171         chown               -R root.root debian/tmp
172         chmod               -R go=rX debian/tmp
173         dpkg                --build debian/tmp ..
174         debiandoc2latexps    policy.sgml
175         mv policy.ps         ../
176         gzip -9qvf            ../policy.ps
177         debiandoc2latexpdf  policy.sgml
178         mv policy.pdf        ../
179         gzip -9qfv           ../policy.pdf
180         GZIP=-9v tar zcf    ../policy.html.tar.gz    policy.html
181         dpkg-distaddfile    -fdebian/files           policy.ps.gz       byhand -
182         dpkg-distaddfile    -fdebian/files           policy.pdf.gz      byhand -
183         dpkg-distaddfile    -fdebian/files           policy.html.tar.gz byhand -
184         for i in            $(BYHAND_FILES); do \
185           $(install_file)   $$i            ..                ; \
186           dpkg-distaddfile  -fdebian/files $$i       byhand - ; \
187         done
188         touch              stamp-policy
189
190 stamp-packaging:  build
191         @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
192                 (echo need root priviledges; exit 1)
193         $(checkdir)
194         test -f stamp-build     || $(MAKE) -f        debian/rules build
195         -rm -rf                 $(PTMPTOP)
196         $(make_directory)       $(PTMPTOP)/DEBIAN
197         $(make_directory)       $(PDOCDIR)
198         $(make_directory)       $(PLIBDIR)
199         echo "debian-policy:Version=$(version)"      > debian/substvars
200         echo "packaging-manual:Version=$(version)"   >> debian/substvars
201
202         $(install_file)    packaging.sgml            $(PDOCDIR)/
203         $(install_file)    version.ent               $(PDOCDIR)/
204         $(install_file)    debian/changelog          $(PDOCDIR)/
205         -gzip -fqr9        $(PDOCDIR)
206         $(install_file)    packaging.text.gz         $(PDOCDIR)/
207         $(install_file)    debian/copyright          $(PDOCDIR)/
208         $(install_file)    packaging-manual.desc     $(PLIBDIR)/packaging-manual
209         (tar cf -          packaging.html) |         (cd $(PDOCDIR);   tar xf -)
210         sed -e 's/#PACKAGE#/$(ppackage)/g' debian/postinst.in > debian/postinst
211         sed -e 's/#PACKAGE#/$(ppackage)/g' debian/prerm.in > debian/prerm
212         $(install_program) debian/{postinst,prerm}   debian/tmp-packaging/DEBIAN/
213         dpkg-gencontrol    -ppackaging-manual -Pdebian/tmp-packaging -isp
214         chown              -R root.root debian/tmp-packaging
215         chmod              -R go=rX debian/tmp-packaging
216         dpkg               --build debian/tmp-packaging ..
217         debiandoc2latexps  packaging.sgml
218         debiandoc2latexpdf packaging.sgml
219         mv packaging.ps    ../
220         mv packaging.pdf   ../
221         gzip -9vf          ../packaging.ps
222         gzip -9vf          ../packaging.pdf
223         GZIP=-9v tar zcf   ../packaging.html.tar.gz    packaging.html
224         dpkg-distaddfile   -fdebian/files        packaging.ps.gz       byhand -
225         dpkg-distaddfile   -fdebian/files        packaging.pdf.gz      byhand -
226         dpkg-distaddfile   -fdebian/files        packaging.html.tar.gz byhand -
227         for i in            $(PBYHAND_FILES); do \
228           $(install_file)   $$i            ..                ; \
229           dpkg-distaddfile  -fdebian/files $$i       byhand - ; \
230         done
231         touch              stamp-
232
233
234 define checkdir
235         test -f debian/rules -a -f policy.sgml
236 endef
237
238 source diff:
239         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
240
241 .PHONY: binary binary-arch binary-indep clean checkroot
242
243 #Local variables:
244 #mode: makefile
245 #End: