]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/rules
Merge branch 'master' into bug504880-rra
[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 := 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                debconf_spec/debconf_specification.html \
53                debconf_spec/debconf_specification.txt.gz \
54                policy.ps.gz policy.pdf.gz README.txt README.html \
55                Process.txt Process.html
56
57 FILES_FROM_ORG := Process.html Process.txt README.txt README.html
58
59 # policy.{pdf,ps,tpt,txt} are generated files
60 FILES_TO_CLEAN  = debian/files debian/buildinfo  debian/substvars \
61                   debian/postinst debian/prerm \
62                   version.ent \
63                   $(SGML_FILES:=.txt.gz) $(SGML_FILES:=.html.tar.gz) \
64                   $(SGML_FILES:=-1.html) \
65                   policy.pdf.gz policy.ps.gz \
66                   debconf_specification.xml.tar.gz \
67                   policy.pdf policy.ps policy.txt policy. \
68                   body.tmp head.tmp policy.tpt \
69                   $(FILES_FROM_ORG)
70
71 STAMPS_TO_CLEAN := stamp-policy stamp-build
72 DIRS_TO_CLEAN   := debian/tmp fhs $(SGML_FILES:=.html)
73
74
75 install_file    := install -p   -o root -g root  -m  644
76 install_program := install -p   -o root -g root  -m  755
77 make_directory  := install -p -d        -o root -g root  -m  755
78
79
80 all build: stamp-build
81 stamp-build: version.ent $(sanitycheck)
82         $(MAKE) $(SGML_FILES:=.sgml.validate) \
83                 $(SGML_FILES:=.html.tar.gz) \
84                 $(SGML_FILES:=-1.html) \
85                 $(SGML_FILES:=.txt.gz) \
86                 policy.ps.gz policy.pdf.gz
87         $(MAKE) $(FILES_FROM_ORG)
88         $(MAKE) -C debconf_spec all
89         touch stamp-build
90
91 configure: version.ent
92 version.ent: debian/changelog
93         rm -f $@
94         echo "<!entity version \"$(version)\">" >> $@
95         echo "<!entity date    \"$(date)\">"    >> $@
96
97 clean: $(sanitycheck)
98 # Undoes the effect of `make -f debian/rules build'.
99         $(MAKE) -C debconf_spec clean
100         rm -f  $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
101         rm -rf $(DIRS_TO_CLEAN)
102         rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
103           -name '*~' -o -name '*.bak' -o -name '#*#' -o \
104           -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
105           -size 0 \) -print` TAGS
106
107
108 binary:         binary-indep binary-arch
109 binary-arch:    build $(sanitycheck)
110 # There are no architecture-dependent files to be uploaded
111 # generated by this package.  If there were any they would be
112 # made here.
113
114 binary-indep:   stamp-policy
115 stamp-policy:  build $(sanitycheck)
116         @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
117                 (echo need root priviledges; exit 1)
118 #       This is unnecessary; commenting out
119 #       test -f stamp-build     || $(MAKE) -f        debian/rules build
120         rm -rf                  $(TMPTOP)
121         $(make_directory)       $(TMPTOP)/DEBIAN
122         $(make_directory)       $(DOCDIR)/fhs
123         $(make_directory)       $(LIBDIR)
124         # create a substvar to reference from debian/control so that
125         # we don't hardcode the policy compliance of the policy
126         # package.  I guess some might question this but I take it as
127         # a given that the debian-policy pkg must always comply with
128         # itself...
129         echo "debian-policy:Version=$(version)"      > debian/substvars
130         $(install_file)     $(POLICY_FILES)          $(DOCDIR)/
131         $(install_file)     debian/changelog         $(DOCDIR)/
132         # Be more specific with file compression
133         gzip -f9            $(DOCDIR)/*.txt $(DOCDIR)/*.sgml \
134                                 $(DOCDIR)/changelog
135 # These are allready compressed
136         #$(install_file)    $(FHS_NEW_FILES)         $(DOCDIR)/fhs/
137         $(install_file)     $(FHS_FILES)             $(DOCDIR)/fhs/
138         $(install_file)     debian/copyright         $(DOCDIR)/
139         GZIP=-9 cd debconf_spec && \
140           tar -zcf ../debconf_specification.xml.tar.gz *
141         $(install_file)     debconf_specification.xml.tar.gz $(DOCDIR)/
142         @set -ex; \
143         for file in $(DESC_FILES); do \
144           $(install_file) $$file.desc $(LIBDIR)/$$file; \
145         done
146         @set -ex; \
147         for file in $(SGML_FILES); do \
148           tar -C $(DOCDIR) -zxf $$file.html.tar.gz; \
149         done
150         for file in $(SGML_FILES); do \
151           $(install_file) $${file}-1.html $(DOCDIR); \
152         done
153         $(install_file)     $(FHS_HTML)   $(DOCDIR)/fhs
154         @set -ex; \
155         cd debian/tmp; \
156         find . -path "./DEBIAN" -prune -o -type f -printf '%P\0' \
157            | xargs -r0 md5sum > DEBIAN/md5sums
158         dpkg-gencontrol     -p$(package) -Pdebian/tmp -isp
159         chown               -R root:root debian/tmp
160         chmod               -R go=rX debian/tmp
161         dpkg                --build debian/tmp ..
162         touch               stamp-policy
163
164
165 .PHONY: configure build binary binary-arch binary-indep clean checkroot
166
167 #Local variables:
168 #mode: makefile
169 #End: