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 }')
8 # Currently, emacs23 is required (xemacs is not sufficient).
11 # Location of the source and build directories.
13 TMPTOP := $(SRCTOP)/debian/tmp
14 DOCDIR := $(TMPTOP)/usr/share/doc/$(package)
15 LIBDIR := $(TMPTOP)/usr/share/doc-base
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
22 # org-mode source files in the top-level directory. We generate text and
23 # HTML versions from these.
24 ORG_FILES := Process README
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 autopkgtest
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
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 autopkgtest/autopkgtest.html \
44 autopkgtest/autopkgtest.txt.gz \
45 debconf_spec/debconf_specification.html \
46 debconf_spec/debconf_specification.txt.gz \
47 policy.ps.gz policy.pdf.gz README.txt README.html \
48 Process.txt Process.html
50 # Used by the clean rules. STAMPS_TO_CLEAN are the stamp files used to tell
51 # make that a target has completed, and are removed first. FILES_TO_CLEAN
52 # are individual generated files to remove. DIRS_TO_CLEAN are entire
53 # directories to remove.
54 STAMPS_TO_CLEAN := stamp-binary stamp-build
55 DIRS_TO_CLEAN := $(SGML_FILES:=.html) debian/tmp fhs
56 FILES_TO_CLEAN := $(SGML_FILES:=.txt) $(SGML_FILES:=.txt.gz) \
57 $(SGML_FILES:=.html.tar.gz) $(SGML_FILES:=-1.html) \
58 $(ORG_FILES:=.html) $(ORG_FILES:=.txt) \
59 policy.pdf.gz policy.ps.gz \
60 policy.pdf policy.ps policy.tpt policy.txt \
61 copyright-format/version.xml \
62 autopkgtest/version.txt \
63 debconf_spec/include/version.xml version.ent \
64 copyright-format.xml.tar.gz \
65 debconf_specification.xml.tar.gz \
68 # Install files and directories with the correct ownership and permissions.
69 install := install -p -o root -g root -m 644
70 mkdir := install -d -o root -g root -m 755
73 all build build-indep: stamp-build
75 stamp-build: version.ent copyright-format/version.xml \
76 autopkgtest/version.txt \
77 debconf_spec/include/version.xml
78 $(MAKE) $(SGML_FILES:=.sgml.validate) \
79 $(SGML_FILES:=.html.tar.gz) \
80 $(SGML_FILES:=-1.html) \
81 $(SGML_FILES:=.txt.gz) \
82 policy.ps.gz policy.pdf.gz
83 $(MAKE) $(ORG_FILES:=.html) \
85 $(MAKE) -C copyright-format all
86 $(MAKE) -C autopkgtest all
87 $(MAKE) -C debconf_spec all
88 cd copyright-format && \
89 GZIP=-n9 tar -zcf ../copyright-format.xml.tar.gz *
91 GZIP=-n9 tar -zcf ../debconf_specification.xml.tar.gz *
94 # Create the version files for inclusion in the various documents. We want
95 # to put the Policy version and date in each document, even if they
96 # separately have their own versions.
97 configure: version.ent copyright-format/version.xml \
98 autopkgtest/version.txt \
99 debconf_spec/include/version.xml
100 version.ent: debian/changelog
102 echo "<!entity version \"$(version)\">" >> $@
103 echo "<!entity date \"$(date)\">" >> $@
104 copyright-format/version.xml: debian/changelog
106 echo '<?xml version="1.0" standalone="no"?>' > $@
107 echo '<!ENTITY version "$(version)">' >> $@
108 echo '<!ENTITY date "$(date)">' >> $@
109 debconf_spec/include/version.xml: debian/changelog
111 echo '<?xml version="1.0" standalone="no"?>' > $@
112 echo '<!ENTITY version "$(version)">' >> $@
113 echo '<!ENTITY date "$(date)">' >> $@
114 autopkgtest/version.txt: debian/changelog
118 echo 'Debian Policy $(version), $(date)' >> $@
121 rm -f $(STAMPS_TO_CLEAN)
122 $(MAKE) -C copyright-format clean
123 $(MAKE) -C autopkgtest clean
124 $(MAKE) -C debconf_spec clean
125 rm -f $(FILES_TO_CLEAN)
126 rm -rf $(DIRS_TO_CLEAN)
127 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
128 -name '*~' -o -name '*.bak' -o -name '#*#' -o \
129 -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
130 -size 0 \) -print` TAGS
133 binary: binary-indep binary-arch
135 binary-indep: stamp-binary
136 stamp-binary: stamp-build
137 @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') -eq 0 || \
138 (echo 'You must run this as root (or use fakeroot)' >&2; exit 1)
140 $(mkdir) $(TMPTOP)/DEBIAN
141 $(mkdir) $(DOCDIR)/fhs
144 # Install simple files.
146 $(install) $(POLICY_FILES) $(DOCDIR)/
147 $(install) $(FHS_FILES) $(DOCDIR)/fhs/
148 $(install) debian/changelog $(DOCDIR)/
149 $(install) debian/copyright $(DOCDIR)/
151 # Install DocBook XML source.
153 $(install) copyright-format.xml.tar.gz $(DOCDIR)/
154 $(install) debconf_specification.xml.tar.gz $(DOCDIR)/
156 # Install generated HTML directories.
158 @set -ex; for file in $(SGML_FILES); do \
159 tar -C $(DOCDIR) -zxf $$file.html.tar.gz; \
162 # Make upgrading-checklist-1.html a symlink to the copy in the policy.html
163 # directory. This is temporary until it becomes a proper appendix.
165 rm -f $(DOCDIR)/upgrading-checklist-1.html
166 ln -s policy.html/upgrading-checklist.html \
167 $(DOCDIR)/upgrading-checklist-1.html
169 # Install doc-base files.
171 @set -ex; for file in $(DESC_FILES); do \
172 $(install) $$file.desc $(LIBDIR)/$$file; \
175 # Compress files and build MD5 checksums.
177 gzip -f9 $(DOCDIR)/*.sgml $(DOCDIR)/changelog
178 gzip -f9 -n $(DOCDIR)/*.txt
179 @set -ex; cd debian/tmp; \
180 find . -path './DEBIAN' -prune -o -type f -printf '%P\0' \
181 | xargs -r0 md5sum > DEBIAN/md5sums
185 dpkg-gencontrol -p$(package) -Pdebian/tmp
186 chown -R root:root debian/tmp
187 chmod -R go=rX debian/tmp
188 dpkg --build debian/tmp ..
192 .PHONY: all configure build build-arch build-indep binary binary-arch
193 .PHONY: binary-indep clean