]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/rules
Synchronized with patch 169 from Manojs tree
[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 Oct 26 12:29:03 2002
9 ## Last Machine Used: glaurung.green-gryphon.com
10 ## Update Count     : 58
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 # The name of the package (for example, `emacs').
33 package := $(shell grep Source debian/control | sed 's/^Source: //')
34 # arch  := $(shell dpkg --print-installation-architecture)
35 date    := $(shell date +"%Y-%m-%d")
36 version := $(shell LC_ALL=C dpkg-parsechangelog | \
37                    grep ^Version: | sed 's/^Version: *//')
38
39 # Location of the source dir
40 SRCTOP    := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi;)
41 TMPTOP    := $(SRCTOP)/debian/tmp
42 DOCDIR    := $(TMPTOP)/usr/share/doc/$(package)
43 LIBDIR    := $(TMPTOP)/usr/share/doc-base
44
45
46 SGML_FILES      = policy menu-policy mime-policy policy-process perl-policy
47 DESC_FILES      = debian-policy debian-menu-policy debian-perl-policy \
48                   debian-mime-policy debian-policy-process debconf-spec \
49                   fhs
50
51 # While we have two versions of the FHS installed in the source package,
52 # we need to modify this to handle it.  This is the easiest way to do it.
53 # FHS_ARCHIVE  =$(shell ls -1 fhs*.tar.gz)
54 # And with version 2.1, we have to build the text and dvi versions
55 # ourselves :-(
56 FHS_ARCHIVE  =fhs-2.1-source.tar.gz
57 FHS_HTML     =fhs-2.1.html.tar.gz
58 FHS_FILES    =fhs/fhs.ps fhs/fhs.txt fhs/fhs.pdf
59 FHS_BYHAND   =fhs-2.1.html.tar.gz fhs/fhs.txt
60 # FSSTND_FILES =FSSTND-FAQ fsstnd-1.2.dvi.gz fsstnd-1.2.ps.gz fsstnd-1.2.txt.gz
61 POLICY_FILES = $(SGML_FILES:=.sgml) $(SGML_FILES:=.txt.gz) \
62                virtual-package-names-list.txt \
63                upgrading-checklist.txt libc6-migration.txt version.ent \
64                debconf_spec/debconf_specification.html \
65                debconf_spec/debconf_specification.txt.gz
66 BYHAND_FILES = $(SGML_FILES:=.txt.gz) $(SGML_FILES:=.html.tar.gz) \
67                debconf_spec/debconf_specification.txt.gz \
68                debconf_spec/debconf_specification.html \
69                libc6-migration.txt virtual-package-names-list.txt \
70                policy.ps.gz policy.pdf.gz upgrading-checklist.txt \
71                $(FHS_BYHAND)
72
73 FILES_TO_CLEAN  = debian/files debian/buildinfo  debian/substvars \
74                   debian/postinst debian/prerm \
75                   version.ent upgrading-checklist.txt \
76                   $(SGML_FILES:=.txt.gz) $(SGML_FILES:=.html.tar.gz) \
77                   policy.pdf.gz policy.ps.gz \
78                   debconf_specification.xml.tar.gz
79
80 STAMPS_TO_CLEAN = stamp-policy stamp-build stamp-configure
81 DIRS_TO_CLEAN   = debian/tmp fhs $(SGML_FILES:=.html)
82
83
84 install_file   = /usr/bin/install -p    -o root -g root  -m  644
85 install_program= /usr/bin/install -p    -o root -g root  -m  755
86 make_directory = /usr/bin/install -p -d -o root -g root  -m  755
87
88 GROFF_VERSION := $(shell dpkg -s groff | sed -n -e 's/Version: //p')
89
90
91 all build: stamp-build
92 stamp-build:
93         $(checkdir)
94         -test -f stamp-configure || $(MAKE) -f debian/rules configure
95         @set -ex; \
96         for file in $(SGML_FILES); do \
97           nsgmls -gues $$file.sgml; \
98           debiandoc2html $$file.sgml; \
99           debiandoc2text $$file.sgml; \
100           if [ -f $$file.text ]; then mv $$file.text $$file.txt; fi; \
101           gzip -f9 $$file.txt; \
102           tar -cf $$file.html.tar $$file.html; \
103           gzip -f9 $$file.html.tar; \
104         done
105         tar -zxf $(FHS_ARCHIVE)
106         # Need to use a patched tmac.m macro file if we're using a pre-1.16
107         # groff; version 1.16 is apparently fixed
108         if dpkg --compare-versions "$(GROFF_VERSION)" lt 1.16; then \
109             cp /usr/share/groff/tmac/tmac.m fhs && \
110             cd fhs && patch -p1 < ../mm1.32-patch; \
111         fi
112         # The extra '.' in the tmac path won't harm if unnecessary
113         GROFF_TMAC_PATH=. GROFF_NO_SGR=1 $(MAKE) -C fhs fhs.ps fhs.pdf fhs.txt
114         links -dump fhs-changes-2.1.html | perl -pe 's/[\r\0]//g' > \
115                     fhs/fhs-changes-2.1.txt
116         links -dump upgrading-checklist.html | perl -pe 's/[\r\0]//g' > \
117                     upgrading-checklist.txt
118         $(MAKE) -C debconf_spec all
119         gzip -9f debconf_spec/debconf_specification.txt
120         touch stamp-build
121
122 configure: stamp-configure
123 stamp-configure:
124         rm -f version.ent
125         echo "<!entity version \"$(version)\">" >> version.ent
126         echo "<!entity date    \"$(date)\">"        >> version.ent
127         touch stamp-configure
128
129 clean:
130 # Undoes the effect of `make -f debian/rules build'.
131         $(checkdir)
132         $(MAKE) -C debconf_spec clean
133         rm -f  $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
134         rm -rf $(DIRS_TO_CLEAN)
135         rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
136           -name '*~' -o -name '*.bak' -o -name '#*#' -o \
137           -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
138           -size 0 \) -print` TAGS
139
140
141 binary:         binary-indep binary-arch
142 binary-arch:    build
143         $(checkdir)
144 # There are no architecture-dependent files to be uploaded
145 # generated by this package.  If there were any they would be
146 # made here.
147
148 binary-indep:   stamp-policy
149 stamp-policy:  build
150         @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
151                 (echo need root priviledges; exit 1)
152         $(checkdir)
153 #       This is unnecessary; commenting out
154 #       test -f stamp-build     || $(MAKE) -f        debian/rules build
155         -rm -rf                 $(TMPTOP)
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
164         # itself...
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         # Be more specific with file compression
171         gzip -f9            $(DOCDIR)/*.txt $(DOCDIR)/*.sgml \
172                                 $(DOCDIR)/fhs/* $(DOCDIR)/changelog
173         $(install_file)     debian/copyright         $(DOCDIR)/
174         GZIP=-9 cd debconf_spec && \
175           tar -zcf ../debconf_specification.xml.tar.gz *
176         $(install_file)     debconf_specification.xml.tar.gz $(DOCDIR)/
177         @set -ex; \
178         for file in $(DESC_FILES); do \
179           $(install_file) $$file.desc $(LIBDIR)/$$file; \
180         done
181         @set -ex; \
182         for file in $(SGML_FILES); do \
183           tar -C $(DOCDIR) -zxf $$file.html.tar.gz; \
184         done
185         tar -C $(DOCDIR)/fhs -zxf $(FHS_HTML)
186         sed -e 's/#PACKAGE#/$(package)/g' debian/postinst.in > debian/postinst
187         sed -e 's/#PACKAGE#/$(package)/g' debian/prerm.in > debian/prerm
188         $(install_program)  debian/postinst          debian/tmp/DEBIAN/
189         $(install_program)  debian/prerm             debian/tmp/DEBIAN/
190         dpkg-gencontrol     -pdebian-policy -Pdebian/tmp -isp
191         chown               -R root:root debian/tmp
192         chmod               -R go=rX debian/tmp
193         dpkg                --build debian/tmp ..
194         debiandoc2latexps   policy.sgml
195         gzip -9f            policy.ps
196         debiandoc2latexpdf  policy.sgml
197         gzip -9f            policy.pdf
198         set -e; \
199         for i in            $(BYHAND_FILES); do                          \
200           $(install_file)   $$i            ..                          ; \
201           dpkg-distaddfile  -fdebian/files `basename $$i`     byhand - ; \
202         done
203         touch               stamp-policy
204
205
206 define checkdir
207         test -f debian/rules -a -f policy.sgml
208 endef
209
210 source diff:
211         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
212
213 .PHONY: configure build binary binary-arch binary-indep clean checkroot
214
215 #Local variables:
216 #mode: makefile
217 #End: