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
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 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
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 \
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
70 all build build-indep: stamp-build
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) \
81 $(MAKE) -C copyright-format all
82 $(MAKE) -C debconf_spec all
83 GZIP=-9 cd copyright-format && \
84 tar -zcf ../copyright-format.xml.tar.gz *
85 GZIP=-9 cd debconf_spec && \
86 tar -zcf ../debconf_specification.xml.tar.gz *
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
96 echo "<!entity version \"$(version)\">" >> $@
97 echo "<!entity date \"$(date)\">" >> $@
98 copyright-format/version.xml: debian/changelog
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
105 echo '<?xml version="1.0" standalone="no"?>' > $@
106 echo '<!ENTITY version "$(version)">' >> $@
107 echo '<!ENTITY date "$(date)">' >> $@
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
121 binary: binary-indep 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)
128 $(mkdir) $(TMPTOP)/DEBIAN
129 $(mkdir) $(DOCDIR)/fhs
132 # Install simple files.
134 $(install) $(POLICY_FILES) $(DOCDIR)/
135 $(install) $(FHS_FILES) $(DOCDIR)/fhs/
136 $(install) debian/changelog $(DOCDIR)/
137 $(install) debian/copyright $(DOCDIR)/
139 # Install DocBook XML source.
141 $(install) copyright-format.xml.tar.gz $(DOCDIR)/
142 $(install) debconf_specification.xml.tar.gz $(DOCDIR)/
144 # Install generated HTML directories.
146 @set -ex; for file in $(SGML_FILES); do \
147 tar -C $(DOCDIR) -zxf $$file.html.tar.gz; \
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.
153 rm -f $(DOCDIR)/upgrading-checklist-1.html
154 ln -s policy.html/upgrading-checklist.html \
155 $(DOCDIR)/upgrading-checklist-1.html
157 # Install doc-base files.
159 @set -ex; for file in $(DESC_FILES); do \
160 $(install) $$file.desc $(LIBDIR)/$$file; \
163 # Compress files and build MD5 checksums.
165 gzip -f9 $(DOCDIR)/*.txt $(DOCDIR)/*.sgml $(DOCDIR)/changelog
166 @set -ex; cd debian/tmp; \
167 find . -path './DEBIAN' -prune -o -type f -printf '%P\0' \
168 | xargs -r0 md5sum > DEBIAN/md5sums
172 dpkg-gencontrol -p$(package) -Pdebian/tmp -isp
173 chown -R root:root debian/tmp
174 chmod -R go=rX debian/tmp
175 dpkg --build debian/tmp ..
179 .PHONY: all configure build build-arch build-indep binary binary-arch
180 .PHONY: binary-indep clean