]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/rules
d242b66020baaee7f0d0acb3934ce63ffab7b099
[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   := emacs23
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                    version.ent                                          \
60                    copyright-format-1.0.xml.tar.gz                      \
61                    debconf_specification.xml.tar.gz                     \
62                    debian/files
63
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
67
68
69 all build build-indep: stamp-build
70 build-arch:
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) \
78                 $(ORG_FILES:=.txt)
79         $(MAKE) -C copyright-format all
80         $(MAKE) -C debconf_spec all
81         GZIP=-9 cd copyright-format && \
82                 tar -zcf ../copyright-format-1.0.xml.tar.gz *
83         GZIP=-9 cd debconf_spec && \
84                 tar -zcf ../debconf_specification.xml.tar.gz *
85         touch stamp-build
86
87 configure: version.ent
88 version.ent: debian/changelog
89         rm -f $@
90         echo "<!entity version \"$(version)\">" >> $@
91         echo "<!entity date    \"$(date)\">"    >> $@
92
93 clean:
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
103
104
105 binary: binary-indep binary-arch
106 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)
111         rm -rf          $(TMPTOP)
112         $(mkdir)        $(TMPTOP)/DEBIAN
113         $(mkdir)        $(DOCDIR)/fhs
114         $(mkdir)        $(LIBDIR)
115 #
116 # Install simple files.
117 #
118         $(install)      $(POLICY_FILES)         $(DOCDIR)/
119         $(install)      $(FHS_FILES)            $(DOCDIR)/fhs/
120         $(install)      debian/changelog        $(DOCDIR)/
121         $(install)      debian/copyright        $(DOCDIR)/
122 #
123 # Install DocBook XML source.
124 #
125         $(install)      copyright-format-1.0.xml.tar.gz         $(DOCDIR)/
126         $(install)      debconf_specification.xml.tar.gz        $(DOCDIR)/
127 #
128 # Install generated HTML directories.
129 #
130         @set -ex; for file in $(SGML_FILES); do                 \
131                 tar -C $(DOCDIR) -zxf $$file.html.tar.gz;       \
132         done
133 #
134 # Install doc-base files.
135 #
136         @set -ex; for file in $(DESC_FILES); do                 \
137                 $(install) $$file.desc $(LIBDIR)/$$file;        \
138         done
139 #
140 # Compress files and build MD5 checksums.
141 #
142         gzip -f9 $(DOCDIR)/*.txt $(DOCDIR)/*.sgml $(DOCDIR)/changelog
143         @set -ex; cd debian/tmp; \
144         find . -path './DEBIAN' -prune -o -type f -printf '%P\0' \
145                 | xargs -r0 md5sum > DEBIAN/md5sums
146 #
147 # Build the package.
148 #
149         dpkg-gencontrol -p$(package) -Pdebian/tmp -isp
150         chown -R root:root debian/tmp
151         chmod -R go=rX debian/tmp
152         dpkg --build debian/tmp ..
153         touch stamp-binary
154
155
156 .PHONY: all configure build build-arch build-indep binary binary-arch
157 .PHONY: binary-indep clean