2 ############################ -*- Mode: Makefile -*- ###########################
4 ## Author : Manoj Srivastava ( srivasta@tiamat.datasync.com )
5 ## Created On : Thu Oct 29 15:35:55 1998
6 ## Created On Node : tiamat.datasync.com
7 ## Last Modified By : Manoj Srivastava
8 ## Last Modified On : Tue Oct 26 15:20:25 2004
9 ## Last Machine Used: glaurung.internal.golden-gryphon.com
11 ## Status : Unknown, Use with caution!
15 ###############################################################################
21 # set the dpkg-architecture vars; but we don't use them, so we'll comment out
22 export DEB_BUILD_ARCH ?= $(shell dpkg-architecture $(ha) -qDEB_BUILD_ARCH)
23 export DEB_BUILD_GNU_CPU ?= $(shell dpkg-architecture $(ha) -qDEB_BUILD_GNU_CPU)
24 export DEB_BUILD_GNU_SYSTEM?= $(shell dpkg-architecture $(ha) -qDEB_BUILD_GNU_SYSTEM)
25 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture $(ha) -qDEB_BUILD_GNU_TYPE)
26 export DEB_HOST_ARCH ?= $(shell dpkg-architecture $(ha) -qDEB_HOST_ARCH)
27 export DEB_HOST_GNU_CPU ?= $(shell dpkg-architecture $(ha) -qDEB_HOST_GNU_CPU)
28 export DEB_HOST_GNU_SYSTEM ?= $(shell dpkg-architecture $(ha) -qDEB_HOST_GNU_SYSTEM)
29 export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture $(ha) -qDEB_HOST_GNU_TYPE)
31 arch := $(shell dpkg --print-installation-architecture)
34 package := $(shell grep Source debian/control | sed 's/^Source: //')
35 date := $(shell date +"%Y-%m-%d")
36 version := $(shell awk -F '[()]' '/^$(package)/{ print $$2; exit }' debian/changelog)
38 # Location of the source dir
40 TMPTOP := $(SRCTOP)/debian/tmp
41 DOCDIR := $(TMPTOP)/usr/share/doc/$(package)
42 LIBDIR := $(TMPTOP)/usr/share/doc-base
44 sanitycheck := debian/rules policy.sgml
46 SGML_FILES := policy menu-policy mime-policy policy-process perl-policy
47 DESC_FILES := debian-policy debian-menu-policy debian-perl-policy \
48 debian-mime-policy debian-policy-process debconf-spec fhs
50 # While we have two versions of the FHS installed in the source package,
51 # we need to modify this to handle it. This is the easiest way to do it.
52 # FHS_ARCHIVE := $(wildcard fhs*.tar.gz)
53 # And with version 2.1, we have to build the text and dvi versions
55 FHS_ARCHIVE := fhs-2.1-source.tar.gz
56 FHS_HTML := fhs-2.1.html.tar.gz
57 FHS_FILES := fhs/fhs.ps fhs/fhs.txt fhs/fhs.pdf
58 FHS_NEW_ARCHIVE := fhs-2.3-source.tar.gz
59 FHS_NEW_HTML := fhs-2.3.html
60 FHS_NEW_FILES := fhs-2.3.ps.gz fhs-2.3.txt.gz fhs-2.3.pdf.gz
61 # FSSTND_FILES := FSSTND-FAQ fsstnd-1.2.dvi.gz fsstnd-1.2.ps.gz fsstnd-1.2.txt.gz
62 POLICY_FILES = $(SGML_FILES:=.sgml) $(SGML_FILES:=.txt.gz) \
63 virtual-package-names-list.txt \
64 upgrading-checklist.txt libc6-migration.txt version.ent \
65 debconf_spec/debconf_specification.html \
66 debconf_spec/debconf_specification.txt.gz \
67 policy.ps.gz policy.pdf.gz
69 FILES_TO_CLEAN = debian/files debian/buildinfo debian/substvars \
70 debian/postinst debian/prerm \
71 version.ent upgrading-checklist.txt \
72 $(SGML_FILES:=.txt.gz) $(SGML_FILES:=.html.tar.gz) \
73 policy.pdf.gz policy.ps.gz \
74 debconf_specification.xml.tar.gz
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)
87 $(MAKE) $(SGML_FILES:=.sgml.validate) \
88 $(SGML_FILES:=.html.tar.gz) \
89 $(SGML_FILES:=.txt.gz) \
90 policy.ps.gz policy.pdf.gz
91 tar -zxf $(FHS_ARCHIVE)
92 # Need to use a patched tmac.m macro file if we're using a pre-1.16
93 # groff; version 1.16 is apparently fixed
94 if dpkg --compare-versions "$(shell dpkg -s groff | sed -n -e 's/Version: //p')" lt 1.16; then \
95 cp /usr/share/groff/tmac/tmac.m fhs && \
96 cd fhs && patch -p1 < ../mm1.32-patch; \
98 # The extra '.' in the tmac path won't harm if unnecessary
99 GROFF_TMAC_PATH=. GROFF_NO_SGR=1 $(MAKE) -C fhs fhs.ps fhs.pdf fhs.txt
100 links -dump fhs-changes-2.1.html | perl -pe 's/[\r\0]//g' > \
101 fhs/fhs-changes-2.1.txt
102 links -dump upgrading-checklist.html | perl -pe 's/[\r\0]//g' > \
103 upgrading-checklist.txt
104 $(MAKE) -C debconf_spec all
107 configure: version.ent
108 version.ent: debian/changelog
110 echo "<!entity version \"$(version)\">" >> $@
111 echo "<!entity date \"$(date)\">" >> $@
113 clean: $(sanitycheck)
114 # Undoes the effect of `make -f debian/rules build'.
115 $(MAKE) -C debconf_spec clean
116 rm -f $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
117 rm -rf $(DIRS_TO_CLEAN)
118 rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
119 -name '*~' -o -name '*.bak' -o -name '#*#' -o \
120 -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
121 -size 0 \) -print` TAGS
124 binary: binary-indep binary-arch
125 binary-arch: build $(sanitycheck)
126 # There are no architecture-dependent files to be uploaded
127 # generated by this package. If there were any they would be
130 binary-indep: stamp-policy
131 stamp-policy: build $(sanitycheck)
132 @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
133 (echo need root priviledges; exit 1)
134 # This is unnecessary; commenting out
135 # test -f stamp-build || $(MAKE) -f debian/rules build
137 $(make_directory) $(TMPTOP)/DEBIAN
138 # $(make_directory) $(DOCDIR)/fsstnd
139 $(make_directory) $(DOCDIR)/fhs
140 $(make_directory) $(LIBDIR)
141 # create a substvar to reference from debian/control so that
142 # we don't hardcode the policy compliance of the policy
143 # package. I guess some might question this but I take it as
144 # a given that the debian-policy pkg must always comply with
146 echo "debian-policy:Version=$(version)" > debian/substvars
147 $(install_file) $(POLICY_FILES) $(DOCDIR)/
148 # $(install_file) $(FSSTND_FILES) $(DOCDIR)/fsstnd/
149 $(install_file) $(FHS_FILES) $(DOCDIR)/fhs/
150 $(install_file) debian/changelog $(DOCDIR)/
151 # Be more specific with file compression
152 gzip -f9 $(DOCDIR)/*.txt $(DOCDIR)/*.sgml \
153 $(DOCDIR)/fhs/* $(DOCDIR)/changelog
154 # These are allready compressed
155 $(install_file) $(FHS_NEW_FILES) $(DOCDIR)/fhs/
156 $(install_file) debian/copyright $(DOCDIR)/
157 GZIP=-9 cd debconf_spec && \
158 tar -zcf ../debconf_specification.xml.tar.gz *
159 $(install_file) debconf_specification.xml.tar.gz $(DOCDIR)/
161 for file in $(DESC_FILES); do \
162 $(install_file) $$file.desc $(LIBDIR)/$$file; \
165 for file in $(SGML_FILES); do \
166 tar -C $(DOCDIR) -zxf $$file.html.tar.gz; \
168 tar -C $(DOCDIR)/fhs -zxf $(FHS_HTML)
169 $(install_file) $(FHS_NEW_HTML) $(DOCDIR)/fhs
170 sed -e 's/#PACKAGE#/$(package)/g' debian/postinst.in > debian/postinst
171 sed -e 's/#PACKAGE#/$(package)/g' debian/prerm.in > debian/prerm
172 $(install_program) debian/postinst debian/tmp/DEBIAN/
173 $(install_program) debian/prerm debian/tmp/DEBIAN/
174 dpkg-gencontrol -p$(package) -Pdebian/tmp -isp
175 chown -R root:root debian/tmp
176 chmod -R go=rX debian/tmp
177 dpkg --build debian/tmp ..
181 .PHONY: configure build binary binary-arch binary-indep clean checkroot