]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/rules
69b5dfd1b1b607d19d02a0cec8eb48bc0f8ef9c6
[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 : Wed Sep  6 09:37:43 2000
9 ## Last Machine Used: glaurung.green-gryphon.com
10 ## Update Count     : 56
11 ## Status           : Unknown, Use with caution!
12 ## HISTORY          :
13 ## Description      :
14 ## $Id$
15 ###############################################################################
16
17 ifdef ARCH
18   ha:=-a$(ARCH)
19 endif
20
21 # set the dpkg-architecture vars; but we don't use them, so we'll comment out
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)
30
31
32
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: *//')
39
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.txt policy.txt.gz \
44                   menu-policy.txt.gz menu-policy.pdf.gz \
45                   perl-policy.txt.gz perl-policy.pdf.gz \
46                   policy-process.txt.gz policy-process.pdf.gz \
47                   mime-policy.txt.gz mime-policy.pdf.gz \
48                   debconf_spec/debconf_specification.html \
49                   debconf_spec/debconf_specification.txt.gz \
50
51 STAMPS_TO_CLEAN = stamp-policy stamp-build stamp-configure
52 DIRS_TO_CLEAN   = debian/tmp policy.html fhs \
53                   menu-policy.html mime-policy.html \
54                   policy-process.html perl-policy.html
55 SGML_FILES      = policy menu-policy mime-policy policy-process perl-policy
56
57 # Location of the source dir
58 SRCTOP    := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi;)
59 TMPTOP    := $(SRCTOP)/debian/tmp
60 DOCDIR    := $(TMPTOP)/usr/share/doc/$(package)
61 LIBDIR    := $(TMPTOP)/usr/share/doc-base
62
63
64 # While we have two versions of the FHS installed in the source package,
65 # we need to modify this to handle it.  This is the easiest way to do it.
66 # FHS_ARCHIVE  =$(shell ls -1 fhs*.tar.gz)
67 # And with version 2.1, we have to build the text and dvi versions
68 # ourselves :-(
69 FHS_ARCHIVE  =fhs-2.1-source.tar.gz
70 FHS_HTML     =fhs-2.1.html.tar.gz
71 FHS_FILES    =fhs/fhs.ps fhs/fhs.txt fhs/fhs.pdf
72 FHS_BYHAND   =fhs-2.1.html.tar.gz fhs/fhs.txt
73 # FSSTND_FILES =FSSTND-FAQ fsstnd-1.2.dvi.gz fsstnd-1.2.ps.gz fsstnd-1.2.txt.gz
74 POLICY_FILES =policy.txt.gz policy.sgml virtual-package-names-list.txt \
75               upgrading-checklist.txt libc6-migration.txt version.ent \
76               menu-policy.sgml menu-policy.txt.gz \
77               perl-policy.sgml perl-policy.txt.gz \
78               mime-policy.sgml mime-policy.txt.gz \
79               policy-process.txt.gz policy-process.sgml \
80               debconf_spec/debconf_specification.html \
81               debconf_spec/debconf_specification.txt.gz
82 BYHAND_FILES =policy.txt.gz libc6-migration.txt \
83               virtual-package-names-list.txt menu-policy.txt.gz \
84               mime-policy.txt.gz policy.ps.gz policy.pdf.gz \
85               policy.html.tar.gz perl-policy.txt.gz \
86               debconf_spec/debconf_specification.txt.gz \
87               $(FHS_BYHAND)
88
89
90 install_file   = /usr/bin/install -p    -o root -g root  -m  644
91 install_program= /usr/bin/install -p    -o root -g root  -m  755
92 make_directory = /usr/bin/install -p -d -o root -g root  -m  755
93
94 GROFF_VERSION := $(shell dpkg -s groff | sed -n -e 's/Version: //p')
95
96
97 all build: stamp-build
98 stamp-build:
99         $(checkdir)
100         -test -f stamp-configure || $(MAKE) -f debian/rules configure
101         for file in $(SGML_FILES); do \
102           nsgmls -gues $$file.sgml; \
103           debiandoc2html $$file.sgml; \
104           debiandoc2text $$file.sgml; \
105           if [ -f $$file.text ]; then mv $$file.text $$file.txt; fi; \
106           gzip -9f $$file.txt; \
107         done
108         tar zfx $(FHS_ARCHIVE)
109         # Need to use a patched tmac.m macro file if we're using a pre-1.16
110         # groff; version 1.16 is apparently fixed
111         if dpkg --compare-versions $(GROFF_VERSION) lt 1.16; then \
112             cp /usr/share/groff/tmac/tmac.m fhs && \
113             cd fhs && patch -p1 < ../mm1.32-patch; \
114         fi
115         # The extra '.' in the tmac path doesn't matter if
116         GROFF_TMAC_PATH=. cd fhs && $(MAKE) fhs.ps fhs.pdf fhs.txt
117         links -dump fhs-changes-2.1.html | perl -pe 's/[\r\0]//g' > \
118                     fhs/fhs-changes-2.1.txt
119         links -dump upgrading-checklist.html | perl -pe 's/[\r\0]//g' > \
120                     upgrading-checklist.txt
121         $(MAKE) -C debconf_spec all
122         gzip -9f debconf_spec/debconf_specification.txt
123         touch stamp-build
124
125 configure: stamp-configure
126 stamp-configure:
127         rm -f version.ent
128         echo "<!entity version \"$(version)\">" >> version.ent
129         echo "<!entity date    \"$(date)\">"        >> version.ent
130         touch stamp-configure
131
132 clean:
133 # Undoes the effect of `make -f debian/rules build'.
134         $(checkdir)
135         rm -f  $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
136         rm -rf $(DIRS_TO_CLEAN)
137         rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
138           -name '*~' -o -name '*.bak' -o -name '#*#' -o \
139           -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
140           -size 0 \) -print` TAGS
141
142
143 binary:         binary-indep binary-arch
144 binary-arch:    build
145         $(checkdir)
146 # There are no architecture-dependent files to be uploaded
147 # generated by this package.  If there were any they would be
148 # made here.
149
150 binary-indep:   stamp-policy
151 stamp-policy:  build
152         @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
153                 (echo need root priviledges; exit 1)
154         $(checkdir)
155 #       This is unnecessary; commenting out
156 #       test -f stamp-build     || $(MAKE) -f        debian/rules build
157         -rm -rf                 $(TMPTOP)
158         $(make_directory)       $(TMPTOP)/DEBIAN
159 #       $(make_directory)       $(DOCDIR)/fsstnd
160         $(make_directory)       $(DOCDIR)/fhs
161         $(make_directory)       $(LIBDIR)
162         # create a substvar to reference from debian/control so that
163         # we don't hardcode the policy compliance of the policy
164         # package.  I guess some might question this but I take it as
165         # a given that the debian-policy pkg must always comply with
166         # itself...
167         echo "debian-policy:Version=$(version)"      > debian/substvars
168         $(install_file)     $(POLICY_FILES)          $(DOCDIR)/
169 #       $(install_file)     $(FSSTND_FILES)          $(DOCDIR)/fsstnd/
170         $(install_file)     $(FHS_FILES)             $(DOCDIR)/fhs/
171         $(install_file)     debian/changelog         $(DOCDIR)/
172         # Be more specific with file compression
173         -gzip -q9           $(DOCDIR)/*.txt $(DOCDIR)/*.sgml \
174                                 $(DOCDIR)/fhs/* $(DOCDIR)/changelog
175         $(install_file)     debian/copyright         $(DOCDIR)/
176         $(install_file)     debian-policy.desc       $(LIBDIR)/debian-policy
177         (tar cf -           policy.html) |           (cd $(DOCDIR) && tar xf -)
178         (tar cf -           menu-policy.html) |      (cd $(DOCDIR) && tar xf -)
179         (tar cf -           perl-policy.html) |      (cd $(DOCDIR) && tar xf -)
180         (tar cf -           mime-policy.html) |      (cd $(DOCDIR) && tar xf -)
181         (tar cf -           policy-process.html) |   (cd $(DOCDIR) && tar xf -)
182         tar -C $(DOCDIR)/fhs -zfx $(FHS_HTML)
183         sed -e 's/#PACKAGE#/$(package)/g' debian/postinst.in > debian/postinst
184         sed -e 's/#PACKAGE#/$(package)/g' debian/prerm.in > debian/prerm
185         $(install_program)  debian/postinst          debian/tmp/DEBIAN/
186         $(install_program)  debian/prerm             debian/tmp/DEBIAN/
187         dpkg-gencontrol     -pdebian-policy -Pdebian/tmp -isp
188         chown               -R root.root debian/tmp
189         chmod               -R go=rX debian/tmp
190         dpkg                --build debian/tmp ..
191         debiandoc2latexps   policy.sgml
192         gzip -9qvf          policy.ps
193         debiandoc2latexpdf  policy.sgml
194         gzip -9qfv          policy.pdf
195         GZIP=-9v tar zcf    policy.html.tar.gz    policy.html
196         for i in            $(BYHAND_FILES); do                          \
197           $(install_file)   $$i            ..                          ; \
198           dpkg-distaddfile  -fdebian/files `basename $$i`     byhand - ; \
199         done
200         touch               stamp-policy
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: configure build binary binary-arch binary-indep clean checkroot
211
212 #Local variables:
213 #mode: makefile
214 #End: