]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/rules
4a2d973a39cb945d8939aaaf3310ba8bf6c25a38
[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
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.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 \
49
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 \
53                   policy-process.html
54 SGML_FILES      = policy menu-policy mime-policy policy-process
55
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
61
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_HTML     =fhs-2.1.html.tar.gz
70 FHS_FILES    =fhs/fhs.ps fhs/fhs.txt fhs/fhs.pdf
71 FSSTND_FILES =FSSTND-FAQ fsstnd-1.2.dvi.gz fsstnd-1.2.ps.gz fsstnd-1.2.txt.gz
72 POLICY_FILES =policy.text.gz policy.sgml virtual-package-names-list.text \
73               upgrading-checklist.text libc6-migration.text version.ent \
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               debconf_spec/debconf_specification.html \
78               debconf_spec/debconf_specification.txt.gz
79 BYHAND_FILES =policy.text.gz libc6-migration.text \
80               virtual-package-names-list.text menu-policy.text.gz \
81               mime-policy.text.gz policy.ps.gz policy.pdf.gz \
82               policy.html.tar.gz \
83               debconf_spec/debconf_specification.txt.gz
84
85
86 install_file   = /usr/bin/install -p    -o root -g root  -m  644
87 install_program= /usr/bin/install -p    -o root -g root  -m  755
88 make_directory = /usr/bin/install -p -d -o root -g root  -m  755
89
90 GROFF_VERSION := $(shell dpkg -s groff | sed -n -e 's/Version: //p')
91
92
93 all build: stamp-build
94 stamp-build:
95         $(checkdir)
96         -test -f stamp-configure || $(MAKE) -f debian/rules configure
97         for file in $(SGML_FILES); do \
98           nsgmls -gues $$file.sgml; \
99           debiandoc2html $$file.sgml; \
100           debiandoc2text $$file.sgml; \
101           if [ -f $$file.txt ]; then mv $$file.txt $$file.text; fi; \
102           gzip -9f $$file.text; \
103         done
104         tar zfx $(FHS_ARCHIVE)
105         # Need to use a patched tmac.m macro file if we're using a pre-1.16
106         # groff; version 1.16 is apparently fixed
107         if dpkg --compare-versions $(GROFF_VERSION) lt 1.16; then \
108             cp /usr/share/groff/tmac/tmac.m fhs && \
109             cd fhs && patch -p1 < ../mm1.32-patch; \
110         fi
111         # The extra '.' in the tmac path doesn't matter if
112         GROFF_TMAC_PATH=. cd fhs && $(MAKE) fhs.ps fhs.pdf fhs.txt
113         links -dump fhs-changes-2.1.html | perl -pe 's/[\r\0]//g' > \
114                     fhs/fhs-changes-2.1.text
115         cd fhs && tar zfx ../$(FHS_HTML)
116         links -dump upgrading-checklist.html | perl -pe 's/[\r\0]//g' > \
117                     upgrading-checklist.text
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         rm -f  $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
133         rm -rf $(DIRS_TO_CLEAN)
134         rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
135           -name '*~' -o -name '*.bak' -o -name '#*#' -o \
136           -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
137           -size 0 \) -print` TAGS
138
139
140 binary:         binary-indep binary-arch
141 binary-arch:    build
142         $(checkdir)
143 # There are no architecture-dependent files to be uploaded
144 # generated by this package.  If there were any they would be
145 # made here.
146
147 binary-indep:   stamp-policy
148 stamp-policy:  build
149         @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
150                 (echo need root priviledges; exit 1)
151         $(checkdir)
152         test -f stamp-build     || $(MAKE) -f        debian/rules build
153         -rm -rf                 $(TMPTOP)
154         $(make_directory)       $(TMPTOP)/DEBIAN
155         $(make_directory)       $(DOCDIR)/fsstnd
156         $(make_directory)       $(DOCDIR)/fhs
157         $(make_directory)       $(LIBDIR)
158         # create a substvar to reference from debian/control so that
159         # we don't hardcode the policy compliance of the policy
160         # package.  I guess some might question this but I take it as
161         # a given that the debian-policy pkg must always comply with
162         # itself...
163         echo "debian-policy:Version=$(version)"      > debian/substvars
164         $(install_file)     $(POLICY_FILES)          $(DOCDIR)/
165         $(install_file)     $(FSSTND_FILES)          $(DOCDIR)/fsstnd/
166         $(install_file)     $(FHS_FILES)             $(DOCDIR)/fhs/
167         $(install_file)     debian/changelog         $(DOCDIR)/
168         -gzip -fqr9         $(DOCDIR)
169         $(install_file)     debian/copyright         $(DOCDIR)/
170         $(install_file)     debian-policy.desc       $(LIBDIR)/debian-policy
171         (tar cf -           policy.html) |           (cd $(DOCDIR);   tar xf -)
172         (tar cf -           menu-policy.html) |      (cd $(DOCDIR);   tar xf -)
173         (tar cf -           mime-policy.html) |      (cd $(DOCDIR);   tar xf -)
174         (tar cf -           policy-process.html) |   (cd $(DOCDIR);   tar xf -)
175         sed -e 's/#PACKAGE#/$(package)/g' debian/postinst.in > debian/postinst
176         sed -e 's/#PACKAGE#/$(package)/g' debian/prerm.in > debian/prerm
177         $(install_program)  debian/postinst          debian/tmp/DEBIAN/
178         $(install_program)  debian/prerm             debian/tmp/DEBIAN/
179         dpkg-gencontrol     -pdebian-policy -Pdebian/tmp -isp
180         chown               -R root.root debian/tmp
181         chmod               -R go=rX debian/tmp
182         dpkg                --build debian/tmp ..
183         debiandoc2latexps    policy.sgml
184         gzip -9qvf           policy.ps
185         debiandoc2latexpdf   policy.sgml
186         gzip -9qfv           policy.pdf
187         GZIP=-9v tar zcf     policy.html.tar.gz    policy.html
188         $(install_file)      version.ent           $(DOCDIR)/
189         for i in            $(BYHAND_FILES); do                          \
190           $(install_file)   $$i            ..                          ; \
191           dpkg-distaddfile  -fdebian/files `basename $$i`     byhand - ; \
192         done
193         touch              stamp-policy
194
195
196 define checkdir
197         test -f debian/rules -a -f policy.sgml
198 endef
199
200 source diff:
201         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
202
203 .PHONY: binary binary-arch binary-indep clean checkroot
204
205 #Local variables:
206 #mode: makefile
207 #End: