]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/rules
Use gzip -n for compressing generated files.
[debian/debian-policy.git] / debian / rules
1 #!/usr/bin/make -f
2
3 # Basic package information.
4 package := $(shell grep Source debian/control | sed 's/^Source: //')
5 date    := $(shell date +"%Y-%m-%d")
6 version := $(shell dpkg-parsechangelog | awk '/^Version:/ { print $$2; exit }')
7
8 # Currently, emacs23 is required (xemacs is not sufficient).
9 EMACS   := emacs24
10
11 # Location of the source and build directories.
12 SRCTOP  := $(CURDIR)
13 TMPTOP  := $(SRCTOP)/debian/tmp
14 DOCDIR  := $(TMPTOP)/usr/share/doc/$(package)
15 LIBDIR  := $(TMPTOP)/usr/share/doc-base
16
17 # SGML source files in the top-level directory.  We do some common actions
18 # with each of these: validate, build text, HTML, and one-page HTML output,
19 # and generate a tarball of the source.
20 SGML_FILES  := policy menu-policy perl-policy upgrading-checklist
21
22 # org-mode source files in the top-level directory.  We generate text and
23 # HTML versions from these.
24 ORG_FILES   := Process README
25
26 # doc-base description files for the documents we include.
27 DESC_FILES  := copyright-format-1.0 debian-policy debian-menu-policy \
28                debian-perl-policy debconf-spec fhs
29
30 # Our local copy of the File Hierarchy Standard.  We don't build this from
31 # source, but we do have a copy of the source in FHS_ARCHIVE.
32 FHS_ARCHIVE := fhs-2.3-source.tar.gz
33 FHS_FILES   := fhs-2.3.html fhs-2.3.ps.gz fhs-2.3.txt.gz fhs-2.3.pdf.gz
34
35 # A list of the simple Policy files that we include in the documentation
36 # directory of the generated package.  The tarballs of source are handled
37 # separately, as are the directories of HTML output.
38 POLICY_FILES := $(SGML_FILES:=.sgml) $(SGML_FILES:=.txt.gz)             \
39                 $(SGML_FILES:=-1.html) version.ent                      \
40                 virtual-package-names-list.txt libc6-migration.txt      \
41                 copyright-format/copyright-format-1.0.html              \
42                 copyright-format/copyright-format-1.0.txt.gz            \
43                 debconf_spec/debconf_specification.html                 \
44                 debconf_spec/debconf_specification.txt.gz               \
45                 policy.ps.gz policy.pdf.gz README.txt README.html       \
46                 Process.txt Process.html
47
48 # Used by the clean rules.  STAMPS_TO_CLEAN are the stamp files used to tell
49 # make that a target has completed, and are removed first.  FILES_TO_CLEAN
50 # are individual generated files to remove.  DIRS_TO_CLEAN are entire
51 # directories to remove.
52 STAMPS_TO_CLEAN := stamp-binary stamp-build
53 DIRS_TO_CLEAN   := $(SGML_FILES:=.html) debian/tmp fhs
54 FILES_TO_CLEAN  := $(SGML_FILES:=.txt) $(SGML_FILES:=.txt.gz)           \
55                    $(SGML_FILES:=.html.tar.gz) $(SGML_FILES:=-1.html)   \
56                    $(ORG_FILES:=.html) $(ORG_FILES:=.txt)               \
57                    policy.pdf.gz policy.ps.gz                           \
58                    policy.pdf policy.ps policy.tpt policy.txt           \
59                    copyright-format/version.xml                         \
60                    debconf_spec/include/version.xml version.ent         \
61                    copyright-format.xml.tar.gz                          \
62                    debconf_specification.xml.tar.gz                     \
63                    debian/files
64
65 # Install files and directories with the correct ownership and permissions.
66 install := install -p -o root -g root -m 644
67 mkdir   := install -d -o root -g root -m 755
68
69
70 all build build-indep: stamp-build
71 build-arch:
72 stamp-build: version.ent copyright-format/version.xml \
73              debconf_spec/include/version.xml
74         $(MAKE) $(SGML_FILES:=.sgml.validate) \
75                 $(SGML_FILES:=.html.tar.gz) \
76                 $(SGML_FILES:=-1.html) \
77                 $(SGML_FILES:=.txt.gz) \
78                 policy.ps.gz policy.pdf.gz
79         $(MAKE) $(ORG_FILES:=.html) \
80                 $(ORG_FILES:=.txt)
81         $(MAKE) -C copyright-format all
82         $(MAKE) -C debconf_spec all
83         cd copyright-format && \
84                 GZIP=-n9 tar -zcf ../copyright-format.xml.tar.gz *
85         cd debconf_spec && \
86                 GZIP=-n9 tar -zcf ../debconf_specification.xml.tar.gz *
87         touch stamp-build
88
89 # Create the version files for inclusion in the various documents.  We want
90 # to put the Policy version and date in each document, even if they
91 # separately have their own versions.
92 configure: version.ent copyright-format/version.xml \
93            debconf_spec/include/version.xml
94 version.ent: debian/changelog
95         rm -f $@
96         echo "<!entity version \"$(version)\">" >> $@
97         echo "<!entity date    \"$(date)\">"    >> $@
98 copyright-format/version.xml: debian/changelog
99         rm -f $@
100         echo '<?xml version="1.0" standalone="no"?>' >  $@
101         echo '<!ENTITY version "$(version)">'        >> $@
102         echo '<!ENTITY date    "$(date)">'           >> $@
103 debconf_spec/include/version.xml: debian/changelog
104         rm -f $@
105         echo '<?xml version="1.0" standalone="no"?>' >  $@
106         echo '<!ENTITY version "$(version)">'        >> $@
107         echo '<!ENTITY date    "$(date)">'           >> $@
108
109 clean:
110         rm -f $(STAMPS_TO_CLEAN)
111         $(MAKE) -C copyright-format clean
112         $(MAKE) -C debconf_spec clean
113         rm -f $(FILES_TO_CLEAN)
114         rm -rf $(DIRS_TO_CLEAN)
115         rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o        \
116           -name '*~' -o -name '*.bak' -o -name '#*#' -o                 \
117           -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o         \
118           -size 0 \) -print` TAGS
119
120
121 binary: binary-indep binary-arch
122 binary-arch:
123 binary-indep: stamp-binary
124 stamp-binary: stamp-build
125         @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') -eq 0 || \
126             (echo 'You must run this as root (or use fakeroot)' >&2; exit 1)
127         rm -rf          $(TMPTOP)
128         $(mkdir)        $(TMPTOP)/DEBIAN
129         $(mkdir)        $(DOCDIR)/fhs
130         $(mkdir)        $(LIBDIR)
131 #
132 # Install simple files.
133 #
134         $(install)      $(POLICY_FILES)         $(DOCDIR)/
135         $(install)      $(FHS_FILES)            $(DOCDIR)/fhs/
136         $(install)      debian/changelog        $(DOCDIR)/
137         $(install)      debian/copyright        $(DOCDIR)/
138 #
139 # Install DocBook XML source.
140 #
141         $(install)      copyright-format.xml.tar.gz             $(DOCDIR)/
142         $(install)      debconf_specification.xml.tar.gz        $(DOCDIR)/
143 #
144 # Install generated HTML directories.
145 #
146         @set -ex; for file in $(SGML_FILES); do                 \
147                 tar -C $(DOCDIR) -zxf $$file.html.tar.gz;       \
148         done
149 #
150 # Make upgrading-checklist-1.html a symlink to the copy in the policy.html
151 # directory.  This is temporary until it becomes a proper appendix.
152 #
153         rm -f $(DOCDIR)/upgrading-checklist-1.html
154         ln -s policy.html/upgrading-checklist.html \
155                 $(DOCDIR)/upgrading-checklist-1.html
156 #
157 # Install doc-base files.
158 #
159         @set -ex; for file in $(DESC_FILES); do                 \
160                 $(install) $$file.desc $(LIBDIR)/$$file;        \
161         done
162 #
163 # Compress files and build MD5 checksums.
164 #
165         gzip -f9 $(DOCDIR)/*.sgml $(DOCDIR)/changelog
166         gzip -f9 -n $(DOCDIR)/*.txt
167         @set -ex; cd debian/tmp; \
168         find . -path './DEBIAN' -prune -o -type f -printf '%P\0' \
169                 | xargs -r0 md5sum > DEBIAN/md5sums
170 #
171 # Build the package.
172 #
173         dpkg-gencontrol -p$(package) -Pdebian/tmp
174         chown -R root:root debian/tmp
175         chmod -R go=rX debian/tmp
176         dpkg --build debian/tmp ..
177         touch stamp-binary
178
179
180 .PHONY: all configure build build-arch build-indep binary binary-arch
181 .PHONY: binary-indep clean