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 \
60 copyright-format.xml.tar.gz \
61 debconf_specification.xml.tar.gz \
64 # Install files and directories with the correct ownership and permissions.
65 install := install -p -o root -g root -m 644
66 mkdir := install -d -o root -g root -m 755
69 all build build-indep: stamp-build
71 stamp-build: version.ent
72 $(MAKE) $(SGML_FILES:=.sgml.validate) \
73 $(SGML_FILES:=.html.tar.gz) \
74 $(SGML_FILES:=-1.html) \
75 $(SGML_FILES:=.txt.gz) \
76 policy.ps.gz policy.pdf.gz
77 $(MAKE) $(ORG_FILES:=.html) \
79 $(MAKE) -C copyright-format all
80 $(MAKE) -C debconf_spec all
81 GZIP=-9 cd copyright-format && \
82 tar -zcf ../copyright-format.xml.tar.gz *
83 GZIP=-9 cd debconf_spec && \
84 tar -zcf ../debconf_specification.xml.tar.gz *
87 configure: version.ent
88 version.ent: debian/changelog
90 echo "<!entity version \"$(version)\">" >> $@
91 echo "<!entity date \"$(date)\">" >> $@
94 rm -f $(STAMPS_TO_CLEAN)
95 $(MAKE) -C copyright-format clean
96 $(MAKE) -C debconf_spec clean
97 rm -f $(FILES_TO_CLEAN)
98 rm -rf $(DIRS_TO_CLEAN)
99 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
100 -name '*~' -o -name '*.bak' -o -name '#*#' -o \
101 -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
102 -size 0 \) -print` TAGS
105 binary: binary-indep binary-arch
107 binary-indep: stamp-binary
108 stamp-binary: stamp-build
109 @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') -eq 0 || \
110 (echo 'You must run this as root (or use fakeroot)' >&2; exit 1)
112 $(mkdir) $(TMPTOP)/DEBIAN
113 $(mkdir) $(DOCDIR)/fhs
116 # Install simple files.
118 $(install) $(POLICY_FILES) $(DOCDIR)/
119 $(install) $(FHS_FILES) $(DOCDIR)/fhs/
120 $(install) debian/changelog $(DOCDIR)/
121 $(install) debian/copyright $(DOCDIR)/
123 # Install DocBook XML source.
125 $(install) copyright-format.xml.tar.gz $(DOCDIR)/
126 $(install) debconf_specification.xml.tar.gz $(DOCDIR)/
128 # Install generated HTML directories.
130 @set -ex; for file in $(SGML_FILES); do \
131 tar -C $(DOCDIR) -zxf $$file.html.tar.gz; \
134 # Make upgrading-checklist-1.html a symlink to the copy in the policy.html
135 # directory. This is temporary until it becomes a proper appendix.
137 rm -f $(DOCDIR)/upgrading-checklist-1.html
138 ln -s policy.html/upgrading-checklist.html \
139 $(DOCDIR)/upgrading-checklist-1.html
141 # Install doc-base files.
143 @set -ex; for file in $(DESC_FILES); do \
144 $(install) $$file.desc $(LIBDIR)/$$file; \
147 # Compress files and build MD5 checksums.
149 gzip -f9 $(DOCDIR)/*.txt $(DOCDIR)/*.sgml $(DOCDIR)/changelog
150 @set -ex; cd debian/tmp; \
151 find . -path './DEBIAN' -prune -o -type f -printf '%P\0' \
152 | xargs -r0 md5sum > DEBIAN/md5sums
156 dpkg-gencontrol -p$(package) -Pdebian/tmp -isp
157 chown -R root:root debian/tmp
158 chmod -R go=rX debian/tmp
159 dpkg --build debian/tmp ..
163 .PHONY: all configure build build-arch build-indep binary binary-arch
164 .PHONY: binary-indep clean