]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/rules
Import DEP-5 as a document called copyright-format.
[debian/debian-policy.git] / debian / rules
1 #!/usr/bin/make -f
2
3 ifdef ARCH
4   ha:=-a$(ARCH)
5 endif
6
7 # set the dpkg-architecture vars; but we don't use them, so we'll comment out
8 export DEB_BUILD_ARCH      ?= $(shell dpkg-architecture $(ha) -qDEB_BUILD_ARCH)
9 export DEB_BUILD_GNU_CPU   ?= $(shell dpkg-architecture $(ha) -qDEB_BUILD_GNU_CPU)
10 export DEB_BUILD_GNU_SYSTEM?= $(shell dpkg-architecture $(ha) -qDEB_BUILD_GNU_SYSTEM)
11 export DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture $(ha) -qDEB_BUILD_GNU_TYPE)
12 export DEB_HOST_ARCH       ?= $(shell dpkg-architecture $(ha) -qDEB_HOST_ARCH)
13 export DEB_HOST_GNU_CPU    ?= $(shell dpkg-architecture $(ha) -qDEB_HOST_GNU_CPU)
14 export DEB_HOST_GNU_SYSTEM ?= $(shell dpkg-architecture $(ha) -qDEB_HOST_GNU_SYSTEM)
15 export DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture $(ha) -qDEB_HOST_GNU_TYPE)
16
17 arch    := $(shell dpkg --print-architecture)
18
19 # Basic information
20 package := $(shell grep Source debian/control | sed 's/^Source: //')
21 date    := $(shell date +"%Y-%m-%d")
22 version := $(shell awk -F '[()]' '/^$(package)/{ print $$2; exit }' debian/changelog)
23
24 # Currently, emacs23 is required (xemacs is not sufficient).
25 EMACS   := emacs23
26
27 # Location of the source dir
28 SRCTOP    := $(CURDIR)
29 TMPTOP    := $(SRCTOP)/debian/tmp
30 DOCDIR    := $(TMPTOP)/usr/share/doc/$(package)
31 LIBDIR    := $(TMPTOP)/usr/share/doc-base
32
33 sanitycheck := debian/rules policy.sgml
34
35 SGML_FILES := policy menu-policy mime-policy perl-policy upgrading-checklist
36 DESC_FILES := copyright-format debian-policy debian-menu-policy debian-perl-policy \
37               debian-mime-policy debconf-spec fhs
38
39 # While we have two versions of the FHS installed in the source package,
40 # we need to modify this to handle it.  This is the easiest way to do it.
41 # FHS_ARCHIVE := $(wildcard fhs*.tar.gz)
42 FHS_ARCHIVE  := fhs-2.3-source.tar.gz
43 FHS_HTML     := fhs-2.3.html
44 FHS_FILES    := fhs-2.3.ps.gz fhs-2.3.txt.gz fhs-2.3.pdf.gz
45 FHS_NEW_ARCHIVE  := 
46 FHS_NEW_HTML     := 
47 FHS_NEW_FILES    := 
48
49 POLICY_FILES = $(SGML_FILES:=.sgml) $(SGML_FILES:=.txt.gz) \
50                virtual-package-names-list.txt \
51                libc6-migration.txt version.ent \
52                copyright-format/copyright-format.html \
53                copyright-format/copyright-format.txt.gz \
54                debconf_spec/debconf_specification.html \
55                debconf_spec/debconf_specification.txt.gz \
56                policy.ps.gz policy.pdf.gz README.txt README.html \
57                Process.txt Process.html
58
59 FILES_FROM_ORG := Process.html Process.txt README.txt README.html
60
61 # policy.{pdf,ps,tpt,txt} are generated files
62 FILES_TO_CLEAN  = copyright-format.xml.tar.gz \
63                   debian/files debian/buildinfo  debian/substvars \
64                   debian/postinst debian/prerm \
65                   version.ent \
66                   $(SGML_FILES:=.txt.gz) $(SGML_FILES:=.html.tar.gz) \
67                   $(SGML_FILES:=-1.html) \
68                   policy.pdf.gz policy.ps.gz \
69                   debconf_specification.xml.tar.gz \
70                   policy.pdf policy.ps policy.txt policy. \
71                   body.tmp head.tmp policy.tpt \
72                   $(FILES_FROM_ORG)
73
74 STAMPS_TO_CLEAN := stamp-policy stamp-build
75 DIRS_TO_CLEAN   := debian/tmp fhs $(SGML_FILES:=.html)
76
77
78 install_file    := install -p   -o root -g root  -m  644
79 install_program := install -p   -o root -g root  -m  755
80 make_directory  := install -p -d        -o root -g root  -m  755
81
82
83 all build: stamp-build
84 stamp-build: version.ent $(sanitycheck)
85         $(MAKE) $(SGML_FILES:=.sgml.validate) \
86                 $(SGML_FILES:=.html.tar.gz) \
87                 $(SGML_FILES:=-1.html) \
88                 $(SGML_FILES:=.txt.gz) \
89                 policy.ps.gz policy.pdf.gz
90         $(MAKE) $(FILES_FROM_ORG)
91         $(MAKE) -C copyright-format all
92         $(MAKE) -C debconf_spec all
93         touch stamp-build
94
95 configure: version.ent
96 version.ent: debian/changelog
97         rm -f $@
98         echo "<!entity version \"$(version)\">" >> $@
99         echo "<!entity date    \"$(date)\">"    >> $@
100
101 clean: $(sanitycheck)
102 # Undoes the effect of `make -f debian/rules build'.
103         $(MAKE) -C copyright-format clean
104         $(MAKE) -C debconf_spec clean
105         rm -f  $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
106         rm -rf $(DIRS_TO_CLEAN)
107         rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
108           -name '*~' -o -name '*.bak' -o -name '#*#' -o \
109           -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
110           -size 0 \) -print` TAGS
111
112
113 binary:         binary-indep binary-arch
114 binary-arch:    build $(sanitycheck)
115 # There are no architecture-dependent files to be uploaded
116 # generated by this package.  If there were any they would be
117 # made here.
118
119 binary-indep:   stamp-policy
120 stamp-policy:  build $(sanitycheck)
121         @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
122                 (echo need root priviledges; exit 1)
123 #       This is unnecessary; commenting out
124 #       test -f stamp-build     || $(MAKE) -f        debian/rules build
125         rm -rf                  $(TMPTOP)
126         $(make_directory)       $(TMPTOP)/DEBIAN
127         $(make_directory)       $(DOCDIR)/fhs
128         $(make_directory)       $(LIBDIR)
129         # create a substvar to reference from debian/control so that
130         # we don't hardcode the policy compliance of the policy
131         # package.  I guess some might question this but I take it as
132         # a given that the debian-policy pkg must always comply with
133         # itself...
134         echo "debian-policy:Version=$(version)"      > debian/substvars
135         $(install_file)     $(POLICY_FILES)          $(DOCDIR)/
136         $(install_file)     debian/changelog         $(DOCDIR)/
137         # Be more specific with file compression
138         gzip -f9            $(DOCDIR)/*.txt $(DOCDIR)/*.sgml \
139                                 $(DOCDIR)/changelog
140 # These are allready compressed
141         #$(install_file)    $(FHS_NEW_FILES)         $(DOCDIR)/fhs/
142         $(install_file)     $(FHS_FILES)             $(DOCDIR)/fhs/
143         $(install_file)     debian/copyright         $(DOCDIR)/
144         GZIP=-9 cd copyright-format && \
145           tar -zcf ../copyright-format.xml.tar.gz *
146         $(install_file)     copyright-format.xml.tar.gz $(DOCDIR)/
147         @set -ex; \
148         GZIP=-9 cd debconf_spec && \
149           tar -zcf ../debconf_specification.xml.tar.gz *
150         $(install_file)     debconf_specification.xml.tar.gz $(DOCDIR)/
151         @set -ex; \
152         for file in $(DESC_FILES); do \
153           $(install_file) $$file.desc $(LIBDIR)/$$file; \
154         done
155         @set -ex; \
156         for file in $(SGML_FILES); do \
157           tar -C $(DOCDIR) -zxf $$file.html.tar.gz; \
158         done
159         for file in $(SGML_FILES); do \
160           $(install_file) $${file}-1.html $(DOCDIR); \
161         done
162         $(install_file)     $(FHS_HTML)   $(DOCDIR)/fhs
163         @set -ex; \
164         cd debian/tmp; \
165         find . -path "./DEBIAN" -prune -o -type f -printf '%P\0' \
166            | xargs -r0 md5sum > DEBIAN/md5sums
167         dpkg-gencontrol     -p$(package) -Pdebian/tmp -isp
168         chown               -R root:root debian/tmp
169         chmod               -R go=rX debian/tmp
170         dpkg                --build debian/tmp ..
171         touch               stamp-policy
172
173
174 .PHONY: configure build binary binary-arch binary-indep clean checkroot
175
176 #Local variables:
177 #mode: makefile
178 #End: