]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/rules
Synchronized with patch 220 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 # arch  := $(shell dpkg --print-installation-architecture)
32
33 # Basic information
34 package := $(shell grep Source debian/control | sed 's/^Source: //')
35 date    := $(shell date +"%Y-%m-%d")
36 version := $(shell awk -F '[()]' '/^$(package)/{ print $$2; exit }' debian/changelog)
37
38 # Location of the source dir
39 SRCTOP    := $(CURDIR)
40 TMPTOP    := $(SRCTOP)/debian/tmp
41 DOCDIR    := $(TMPTOP)/usr/share/doc/$(package)
42 LIBDIR    := $(TMPTOP)/usr/share/doc-base
43
44 sanitycheck := debian/rules policy.sgml
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 fhs
49
50 # While we have two versions of the FHS installed in the source package,
51 # we need to modify this to handle it.  This is the easiest way to do it.
52 # FHS_ARCHIVE := $(wildcard fhs*.tar.gz)
53 # And with version 2.1, we have to build the text and dvi versions
54 # ourselves :-(
55 FHS_ARCHIVE  := fhs-2.1-source.tar.gz
56 FHS_HTML     := fhs-2.1.html.tar.gz
57 FHS_FILES    := fhs/fhs.ps fhs/fhs.txt fhs/fhs.pdf
58 # FSSTND_FILES := FSSTND-FAQ fsstnd-1.2.dvi.gz fsstnd-1.2.ps.gz fsstnd-1.2.txt.gz
59 POLICY_FILES = $(SGML_FILES:=.sgml) $(SGML_FILES:=.txt.gz) \
60                virtual-package-names-list.txt \
61                upgrading-checklist.txt libc6-migration.txt version.ent \
62                debconf_spec/debconf_specification.html \
63                debconf_spec/debconf_specification.txt.gz
64
65 FILES_TO_CLEAN  = debian/files debian/buildinfo  debian/substvars \
66                   debian/postinst debian/prerm \
67                   version.ent upgrading-checklist.txt \
68                   $(SGML_FILES:=.txt.gz) $(SGML_FILES:=.html.tar.gz) \
69                   policy.pdf.gz policy.ps.gz \
70                   debconf_specification.xml.tar.gz
71
72 STAMPS_TO_CLEAN := stamp-policy stamp-build
73 DIRS_TO_CLEAN   := debian/tmp fhs $(SGML_FILES:=.html)
74
75
76 install_file    := install -p   -o root -g root  -m  644
77 install_program := install -p   -o root -g root  -m  755
78 make_directory  := install -p -d        -o root -g root  -m  755
79
80
81 all build: stamp-build
82 stamp-build: version.ent $(sanitycheck)
83         $(MAKE) $(SGML_FILES:=.sgml.validate) \
84                 $(SGML_FILES:=.html.tar.gz) \
85                 $(SGML_FILES:=.txt.gz)
86         tar -zxf $(FHS_ARCHIVE)
87         # Need to use a patched tmac.m macro file if we're using a pre-1.16
88         # groff; version 1.16 is apparently fixed
89         if dpkg --compare-versions "$(shell dpkg -s groff | sed -n -e 's/Version: //p')" lt 1.16; then \
90             cp /usr/share/groff/tmac/tmac.m fhs && \
91             cd fhs && patch -p1 < ../mm1.32-patch; \
92         fi
93         # The extra '.' in the tmac path won't harm if unnecessary
94         GROFF_TMAC_PATH=. GROFF_NO_SGR=1 $(MAKE) -C fhs fhs.ps fhs.pdf fhs.txt
95         links -dump fhs-changes-2.1.html | perl -pe 's/[\r\0]//g' > \
96                     fhs/fhs-changes-2.1.txt
97         links -dump upgrading-checklist.html | perl -pe 's/[\r\0]//g' > \
98                     upgrading-checklist.txt
99         $(MAKE) -C debconf_spec all
100         gzip -9f debconf_spec/debconf_specification.txt
101         touch stamp-build
102
103 configure: version.ent
104 version.ent: debian/changelog
105         rm -f $@
106         echo "<!entity version \"$(version)\">" >> $@
107         echo "<!entity date    \"$(date)\">"    >> $@
108
109 clean: $(sanitycheck)
110 # Undoes the effect of `make -f debian/rules build'.
111         $(MAKE) -C debconf_spec clean
112         rm -f  $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
113         rm -rf $(DIRS_TO_CLEAN)
114         rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
115           -name '*~' -o -name '*.bak' -o -name '#*#' -o \
116           -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
117           -size 0 \) -print` TAGS
118
119
120 binary:         binary-indep binary-arch
121 binary-arch:    build $(sanitycheck)
122 # There are no architecture-dependent files to be uploaded
123 # generated by this package.  If there were any they would be
124 # made here.
125
126 binary-indep:   stamp-policy
127 stamp-policy:  build $(sanitycheck)
128         @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
129                 (echo need root priviledges; exit 1)
130 #       This is unnecessary; commenting out
131 #       test -f stamp-build     || $(MAKE) -f        debian/rules build
132         rm -rf                  $(TMPTOP)
133         $(make_directory)       $(TMPTOP)/DEBIAN
134 #       $(make_directory)       $(DOCDIR)/fsstnd
135         $(make_directory)       $(DOCDIR)/fhs
136         $(make_directory)       $(LIBDIR)
137         # create a substvar to reference from debian/control so that
138         # we don't hardcode the policy compliance of the policy
139         # package.  I guess some might question this but I take it as
140         # a given that the debian-policy pkg must always comply with
141         # itself...
142         echo "debian-policy:Version=$(version)"      > debian/substvars
143         $(install_file)     $(POLICY_FILES)          $(DOCDIR)/
144 #       $(install_file)     $(FSSTND_FILES)          $(DOCDIR)/fsstnd/
145         $(install_file)     $(FHS_FILES)             $(DOCDIR)/fhs/
146         $(install_file)     debian/changelog         $(DOCDIR)/
147         # Be more specific with file compression
148         gzip -f9            $(DOCDIR)/*.txt $(DOCDIR)/*.sgml \
149                                 $(DOCDIR)/fhs/* $(DOCDIR)/changelog
150         $(install_file)     debian/copyright         $(DOCDIR)/
151         GZIP=-9 cd debconf_spec && \
152           tar -zcf ../debconf_specification.xml.tar.gz *
153         $(install_file)     debconf_specification.xml.tar.gz $(DOCDIR)/
154         @set -ex; \
155         for file in $(DESC_FILES); do \
156           $(install_file) $$file.desc $(LIBDIR)/$$file; \
157         done
158         @set -ex; \
159         for file in $(SGML_FILES); do \
160           tar -C $(DOCDIR) -zxf $$file.html.tar.gz; \
161         done
162         tar -C $(DOCDIR)/fhs -zxf $(FHS_HTML)
163         sed -e 's/#PACKAGE#/$(package)/g' debian/postinst.in > debian/postinst
164         sed -e 's/#PACKAGE#/$(package)/g' debian/prerm.in > debian/prerm
165         $(install_program)  debian/postinst          debian/tmp/DEBIAN/
166         $(install_program)  debian/prerm             debian/tmp/DEBIAN/
167         dpkg-gencontrol     -p$(package) -Pdebian/tmp -isp
168         chown               -R root:root debian/tmp
169         chmod               -R go=rX debian/tmp
170         dpkg                --build debian/tmp ..
171         debiandoc2latexps   policy.sgml
172         gzip -9f            policy.ps
173         debiandoc2latexpdf  policy.sgml
174         gzip -9f            policy.pdf
175         touch               stamp-policy
176
177
178 .PHONY: configure build binary binary-arch binary-indep clean checkroot
179
180 #Local variables:
181 #mode: makefile
182 #End: