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)
17 arch := $(shell dpkg --print-architecture)
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)
24 # either /usr/bin/emacs-snampshot or /usr/bin/emacs23
25 EMACS:=$(shell if [ -x /usr/bin/emacs-snapshot ]; then \
26 echo /usr/bin/emacs-snapshot; \
27 elif [ -x /usr/bin/emacs23 ]; then \
28 echo /usr/bin/emacs23; \
30 HAVE_ORG_EMACS:=$(strip $(EMACS))
33 # Location of the source dir
35 TMPTOP := $(SRCTOP)/debian/tmp
36 DOCDIR := $(TMPTOP)/usr/share/doc/$(package)
37 LIBDIR := $(TMPTOP)/usr/share/doc-base
39 sanitycheck := debian/rules policy.sgml
41 SGML_FILES := policy menu-policy mime-policy perl-policy upgrading-checklist
42 DESC_FILES := debian-policy debian-menu-policy debian-perl-policy \
43 debian-mime-policy debconf-spec fhs
45 # While we have two versions of the FHS installed in the source package,
46 # we need to modify this to handle it. This is the easiest way to do it.
47 # FHS_ARCHIVE := $(wildcard fhs*.tar.gz)
48 FHS_ARCHIVE := fhs-2.3-source.tar.gz
49 FHS_HTML := fhs-2.3.html
50 FHS_FILES := fhs-2.3.ps.gz fhs-2.3.txt.gz fhs-2.3.pdf.gz
55 POLICY_FILES = $(SGML_FILES:=.sgml) $(SGML_FILES:=.txt.gz) \
56 virtual-package-names-list.txt \
57 libc6-migration.txt version.ent \
58 debconf_spec/debconf_specification.html \
59 debconf_spec/debconf_specification.txt.gz \
60 policy.ps.gz policy.pdf.gz README.txt README.html \
61 Process.txt Process.html
63 # policy.{pdf,ps,tpt,txt} are generated files
64 FILES_TO_CLEAN = debian/files debian/buildinfo debian/substvars \
65 debian/postinst debian/prerm \
67 $(SGML_FILES:=.txt.gz) $(SGML_FILES:=.html.tar.gz) \
68 $(SGML_FILES:=-1.html) \
69 policy.pdf.gz policy.ps.gz \
70 debconf_specification.xml.tar.gz \
71 policy.pdf policy.ps policy.txt policy. \
72 body.tmp head.tmp policy.tpt
74 FILES_FROM_ORG := README.txt README.html
76 STAMPS_TO_CLEAN := stamp-policy stamp-build
77 DIRS_TO_CLEAN := debian/tmp fhs $(SGML_FILES:=.html)
80 install_file := install -p -o root -g root -m 644
81 install_program := install -p -o root -g root -m 755
82 make_directory := install -p -d -o root -g root -m 755
85 all build: stamp-build
86 stamp-build: version.ent $(sanitycheck) README.txt README.html \
87 Process.txt Process.html
88 $(MAKE) $(SGML_FILES:=.sgml.validate) \
89 $(SGML_FILES:=.html.tar.gz) \
90 $(SGML_FILES:=-1.html) \
91 $(SGML_FILES:=.txt.gz) \
92 policy.ps.gz policy.pdf.gz
93 ifneq (,$(strip $(HAVE_ORG_EMACS)))
94 $(MAKE) $(FILES_FROM_ORG)
96 $(MAKE) -C debconf_spec all
99 configure: version.ent
100 version.ent: debian/changelog
102 echo "<!entity version \"$(version)\">" >> $@
103 echo "<!entity date \"$(date)\">" >> $@
105 clean: $(sanitycheck)
106 # Undoes the effect of `make -f debian/rules build'.
107 $(MAKE) -C debconf_spec clean
108 rm -f $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
109 rm -rf $(DIRS_TO_CLEAN)
110 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
111 -name '*~' -o -name '*.bak' -o -name '#*#' -o \
112 -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
113 -size 0 \) -print` TAGS
116 binary: binary-indep binary-arch
117 binary-arch: build $(sanitycheck)
118 # There are no architecture-dependent files to be uploaded
119 # generated by this package. If there were any they would be
122 binary-indep: stamp-policy
123 stamp-policy: build $(sanitycheck)
124 @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
125 (echo need root priviledges; exit 1)
126 # This is unnecessary; commenting out
127 # test -f stamp-build || $(MAKE) -f debian/rules build
129 $(make_directory) $(TMPTOP)/DEBIAN
130 $(make_directory) $(DOCDIR)/fhs
131 $(make_directory) $(LIBDIR)
132 # create a substvar to reference from debian/control so that
133 # we don't hardcode the policy compliance of the policy
134 # package. I guess some might question this but I take it as
135 # a given that the debian-policy pkg must always comply with
137 echo "debian-policy:Version=$(version)" > debian/substvars
138 $(install_file) $(POLICY_FILES) $(DOCDIR)/
139 $(install_file) debian/changelog $(DOCDIR)/
140 # Be more specific with file compression
141 gzip -f9 $(DOCDIR)/*.txt $(DOCDIR)/*.sgml \
143 # These are allready compressed
144 #$(install_file) $(FHS_NEW_FILES) $(DOCDIR)/fhs/
145 $(install_file) $(FHS_FILES) $(DOCDIR)/fhs/
146 $(install_file) debian/copyright $(DOCDIR)/
147 GZIP=-9 cd debconf_spec && \
148 tar -zcf ../debconf_specification.xml.tar.gz *
149 $(install_file) debconf_specification.xml.tar.gz $(DOCDIR)/
151 for file in $(DESC_FILES); do \
152 $(install_file) $$file.desc $(LIBDIR)/$$file; \
155 for file in $(SGML_FILES); do \
156 tar -C $(DOCDIR) -zxf $$file.html.tar.gz; \
158 for file in $(SGML_FILES); do \
159 $(install_file) $${file}-1.html $(DOCDIR); \
161 $(install_file) $(FHS_HTML) $(DOCDIR)/fhs
164 find . -path "./DEBIAN" -prune -o -type f -printf '%P\0' \
165 | xargs -r0 md5sum > DEBIAN/md5sums
166 dpkg-gencontrol -p$(package) -Pdebian/tmp -isp
167 chown -R root:root debian/tmp
168 chmod -R go=rX debian/tmp
169 dpkg --build debian/tmp ..
173 .PHONY: configure build binary binary-arch binary-indep clean checkroot