]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/rules
Fix FHS handling in debian/rules
[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 : Julian Gilbey
8 ## Last Modified On : Mon Dec 20 21:01:12 GMT 1999
9 ## Last Machine Used: glaurung.green-gryphon.com
10 ## Update Count     : 51
11 ## Status           : Unknown, Use with caution!
12 ## HISTORY          :
13 ## Description      :
14 ## $Id$
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
23
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                   proposal.text.gz menu-policy.pdf.gz proposal.pdf.gz \
31                   mime-policy.text.gz mime-policy.pdf.gz
32 STAMPS_TO_CLEAN = stamp-policy stamp-packaging stamp-build stamp-configure
33 DIRS_TO_CLEAN   = debian/tmp policy.html fhs debian/tmp-packaging \
34                   packaging.html menu-policy.html mime-policy.html \
35                   proposal.html
36 SGML_FILES      = policy packaging menu-policy mime-policy proposal
37
38 # Location of the source dir
39 SRCTOP    := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi;)
40 TMPTOP    := $(SRCTOP)/debian/tmp
41 DOCDIR    := $(TMPTOP)/usr/share/doc/$(package)
42 LIBDIR    := $(TMPTOP)/usr/share/doc-base
43
44 PTMPTOP   := $(SRCTOP)/debian/tmp-packaging
45 PDOCDIR   := $(PTMPTOP)/usr/share/doc/$(ppackage)
46 PLIBDIR   := $(PTMPTOP)/usr/share/doc-base
47
48 # While we have two versions of the FHS installed in the source package,
49 # we need to modify this to handle it.  This is the easiest way to do it.
50 # FHS_ARCHIVE  =$(shell ls -1 fhs*.tar.gz)
51 FHS_ARCHIVE  =fhs-2.1-pre-03.tar.gz
52 FHS_FILES    =fhs/fhs.dvi fhs/fhs.ps fhs/fhs.txt
53 FSSTND_FILES =FSSTND-FAQ fsstnd-1.2.dvi.gz fsstnd-1.2.ps.gz fsstnd-1.2.txt.gz
54 POLICY_FILES =policy.text.gz policy.sgml virtual-package-names-list.text \
55               upgrading-checklist.text libc6-migration.text \
56               version.ent proposal.sgml proposal.text.gz \
57               menu-policy.sgml menu-policy.text.gz \
58               mime-policy.sgml mime-policy.text.gz
59 BYHAND_FILES =policy.text.gz libc6-migration.text \
60               virtual-package-names-list.text menu-policy.text.gz \
61               mime-policy.text.gz
62 PBYHAND_FILES=packaging.text.gz
63
64 install_file   = /usr/bin/install -p    -o root -g root  -m  644
65 install_program= /usr/bin/install -p    -o root -g root  -m  755
66 make_directory = /usr/bin/install -p -d -o root -g root  -m  755
67
68
69 all build: stamp-build
70 stamp-build:
71         $(checkdir)
72         -test -f stamp-configure || $(MAKE) -f debian/rules configure
73         for file in $(SGML_FILES); do \
74           nsgmls -gues $$file.sgml; \
75           debiandoc2html $$file.sgml; \
76           debiandoc2text $$file.sgml; \
77           if [ -f $$file.txt ]; then mv $$file.txt $$file.text; fi; \
78           gzip -9f $$file.text; \
79         done
80         tar zfx $(FHS_ARCHIVE)
81         lynx -dump upgrading-checklist.html > upgrading-checklist.text
82         touch stamp-build
83
84 configure: stamp-configure
85 stamp-configure:
86         rm -f version.ent
87         echo "<!entity version \"$(version)\">" >> version.ent
88         echo "<!entity date    \"$(date)\">"        >> version.ent
89         touch stamp-configure
90
91 clean:
92 # Undoes the effect of `make -f debian/rules build'.
93         $(checkdir)
94         rm -f  $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
95         rm -rf $(DIRS_TO_CLEAN)
96         rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
97           -name '*~' -o -name '*.bak' -o -name '#*#' -o \
98           -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
99           -size 0 \) -print` TAGS
100
101
102 binary:         binary-indep binary-arch
103 binary-arch:    build
104         $(checkdir)
105 # There are no architecture-dependent files to be uploaded
106 # generated by this package.  If there were any they would be
107 # made here.
108
109 binary-indep:   stamp-policy stamp-packaging
110 stamp-policy:  build
111         @test root = "`whoami`" || (echo need root priviledges; exit 1)
112         $(checkdir)
113         test -f stamp-build     || $(MAKE) -f        debian/rules build
114         -rm -rf                 $(TMPTOP)
115         $(make_directory)       $(TMPTOP)/DEBIAN
116         $(make_directory)       $(DOCDIR)/fsstnd
117         $(make_directory)       $(DOCDIR)/fhs
118         $(make_directory)       $(LIBDIR)
119         # create a substvar to reference from debian/control so that
120         # we don't hardcode the policy compliance of the policy
121         # package.  I guess some might question this but I take it as
122         # a given that the debian-policy pkg must always comply with
123         # itself...
124         echo "debian-policy:Version=$(version)"      > debian/substvars
125         echo "packaging-manual:Version=$(version)"   >> debian/substvars
126         $(install_file)     $(POLICY_FILES)          $(DOCDIR)/
127         $(install_file)     $(FSSTND_FILES)          $(DOCDIR)/fsstnd/
128         $(install_file)     $(FHS_FILES)             $(DOCDIR)/fhs/
129         $(install_file)     debian/changelog         $(DOCDIR)/
130         -gzip -fqr9         $(DOCDIR)
131         $(install_file)     debian/copyright         $(DOCDIR)/
132         $(install_file)     debian-policy.desc       $(LIBDIR)/debian-policy
133         (tar cf -           policy.html) |           (cd $(DOCDIR);   tar xf -)
134         (tar cf -           menu-policy.html) |      (cd $(DOCDIR);   tar xf -)
135         (tar cf -           mime-policy.html) |      (cd $(DOCDIR);   tar xf -)
136         (tar cf -           proposal.html) |         (cd $(DOCDIR);   tar xf -)
137         sed -e 's/#PACKAGE#/$(package)/' debian/postinst.in > debian/postinst
138         sed -e 's/#PACKAGE#/$(package)/' debian/prerm.in > debian/prerm
139         $(install_program)  debian/{postinst,prerm}  debian/tmp/DEBIAN/
140         dpkg-gencontrol     -pdebian-policy -Pdebian/tmp -isp
141         chown               -R root.root debian/tmp
142         chmod               -R go=rX debian/tmp
143         dpkg                --build debian/tmp ..
144         debiandoc2latexps    policy.sgml
145         mv policy.ps         ../
146         gzip -9qvf            ../policy.ps
147         debiandoc2latexpdf  policy.sgml
148         mv policy.pdf        ../
149         gzip -9qfv           ../policy.pdf
150         GZIP=-9v tar zcf    ../policy.html.tar.gz    policy.html
151         dpkg-distaddfile    -fdebian/files           policy.ps.gz       byhand -
152         dpkg-distaddfile    -fdebian/files           policy.pdf.gz      byhand -
153         dpkg-distaddfile    -fdebian/files           policy.html.tar.gz byhand -
154         for i in            $(BYHAND_FILES); do \
155           $(install_file)   $$i            ..                ; \
156           dpkg-distaddfile  -fdebian/files $$i       byhand - ; \
157         done
158         touch              stamp-policy
159
160 stamp-packaging:  build
161         @test root = "`whoami`" || (echo need root priviledges; exit 1)
162         $(checkdir)
163         test -f stamp-build     || $(MAKE) -f        debian/rules build
164         -rm -rf                 $(PTMPTOP)
165         $(make_directory)       $(PTMPTOP)/DEBIAN
166         $(make_directory)       $(PDOCDIR)
167         $(make_directory)       $(PLIBDIR)
168         echo "debian-policy:Version=$(version)"      > debian/substvars
169         echo "packaging-manual:Version=$(version)"   >> debian/substvars
170
171         $(install_file)    packaging.sgml            $(PDOCDIR)/
172         $(install_file)    version.ent               $(PDOCDIR)/
173         $(install_file)    debian/changelog          $(PDOCDIR)/
174         -gzip -fqr9        $(PDOCDIR)
175         $(install_file)    packaging.text.gz         $(PDOCDIR)/
176         $(install_file)    debian/copyright          $(PDOCDIR)/
177         $(install_file)    packaging-manual.desc     $(PLIBDIR)/packaging-manual
178         (tar cf -          packaging.html) |         (cd $(PDOCDIR);   tar xf -)
179         sed -e 's/#PACKAGE#/$(ppackage)/' debian/postinst.in > debian/postinst
180         sed -e 's/#PACKAGE#/$(ppackage)/' debian/prerm.in > debian/prerm
181         $(install_program) debian/{postinst,prerm}   debian/tmp-packaging/DEBIAN/
182         dpkg-gencontrol    -ppackaging-manual -Pdebian/tmp-packaging -isp
183         chown              -R root.root debian/tmp-packaging
184         chmod              -R go=rX debian/tmp-packaging
185         dpkg               --build debian/tmp-packaging ..
186         debiandoc2latexps  packaging.sgml
187         debiandoc2latexpdf packaging.sgml
188         mv packaging.ps    ../
189         mv packaging.pdf   ../
190         gzip -9vf          ../packaging.ps
191         gzip -9vf          ../packaging.pdf
192         GZIP=-9v tar zcf   ../packaging.html.tar.gz    packaging.html
193         dpkg-distaddfile   -fdebian/files        packaging.ps.gz       byhand -
194         dpkg-distaddfile   -fdebian/files        packaging.pdf.gz      byhand -
195         dpkg-distaddfile   -fdebian/files        packaging.html.tar.gz byhand -
196         for i in            $(PBYHAND_FILES); do \
197           $(install_file)   $$i            ..                ; \
198           dpkg-distaddfile  -fdebian/files $$i       byhand - ; \
199         done
200         touch              stamp-
201
202
203 define checkdir
204         test -f debian/rules -a -f policy.sgml
205 endef
206
207 source diff:
208         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
209
210 .PHONY: binary binary-arch binary-indep clean checkroot
211
212 #Local variables:
213 #mode: makefile
214 #End: