]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/rules
Synchronized with patch 65 from Manojs tree
[debian/debian-policy.git] / debian / rules
1 #!/usr/bin/make -f
2 ############################ -*- Mode: Makefile -*- ###########################
3 ## rules ---
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 : Wed Sep  6 09:37:43 2000
9 ## Last Machine Used: glaurung.green-gryphon.com
10 ## Update Count     : 56
11 ## Status           : Unknown, Use with caution!
12 ## HISTORY          :
13 ## Description      :
14 ## $Id$
15 ###############################################################################
16
17 ifdef ARCH
18   ha:=-a$(ARCH)
19 endif
20
21 # set the dpkg-architecture vars
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)
30
31
32
33 # The name of the package (for example, `emacs').
34 package := $(shell grep Source debian/control | sed 's/^Source: //')
35 arch    := $(shell dpkg --print-installation-architecture)
36 date    := $(shell date +"%Y-%m-%d")
37 version := $(shell LC_ALL=C dpkg-parsechangelog | \
38                    grep ^Version: | sed 's/^Version: *//')
39
40 FILES_TO_CLEAN  = debian/files debian/buildinfo  debian/substvars \
41                   debian/postinst debian/prerm \
42                   version.ent  policy.lout policy.lout.ld lout.li \
43                   upgrading-checklist.text policy.text.gz \
44                   menu-policy.text.gz \
45                   policy-process.text.gz policy-process.pdf.gz  \
46                   proposal.text.gz menu-policy.pdf.gz proposal.pdf.gz \
47                   mime-policy.text.gz mime-policy.pdf.gz
48 STAMPS_TO_CLEAN = stamp-policy stamp-build stamp-configure
49 DIRS_TO_CLEAN   = debian/tmp policy.html fhs \
50                    menu-policy.html mime-policy.html \
51                   proposal.html policy-process.html
52 SGML_FILES      = policy  menu-policy mime-policy proposal \
53                   policy-process
54
55 # Location of the source dir
56 SRCTOP    := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi;)
57 TMPTOP    := $(SRCTOP)/debian/tmp
58 DOCDIR    := $(TMPTOP)/usr/share/doc/$(package)
59 LIBDIR    := $(TMPTOP)/usr/share/doc-base
60
61
62 # While we have two versions of the FHS installed in the source package,
63 # we need to modify this to handle it.  This is the easiest way to do it.
64 # FHS_ARCHIVE  =$(shell ls -1 fhs*.tar.gz)
65 # And with version 2.1, we have to build the text and dvi versions
66 # ourselves :-(
67 FHS_ARCHIVE  =fhs-2.1-source.tar.gz
68 FHS_FILES    =fhs/fhs.dvi fhs/fhs.ps fhs/fhs.txt fhs/fhs.pdf
69 FSSTND_FILES =FSSTND-FAQ fsstnd-1.2.dvi.gz fsstnd-1.2.ps.gz fsstnd-1.2.txt.gz
70 POLICY_FILES =policy.text.gz policy.sgml virtual-package-names-list.text \
71               upgrading-checklist.text libc6-migration.text \
72               version.ent proposal.sgml proposal.text.gz \
73               menu-policy.sgml menu-policy.text.gz \
74               mime-policy.sgml mime-policy.text.gz \
75               policy-process.text.gz policy-process.sgml
76 BYHAND_FILES =policy.text.gz libc6-migration.text \
77               virtual-package-names-list.text menu-policy.text.gz \
78               mime-policy.text.gz
79
80
81 install_file   = /usr/bin/install -p    -o root -g root  -m  644
82 install_program= /usr/bin/install -p    -o root -g root  -m  755
83 make_directory = /usr/bin/install -p -d -o root -g root  -m  755
84
85 GROFF_VERSION := $(shell dpkg -s groff | sed -n -e 's/Version: //p')
86
87
88 all build: stamp-build
89 stamp-build:
90         $(checkdir)
91         -test -f stamp-configure || $(MAKE) -f debian/rules configure
92         for file in $(SGML_FILES); do \
93           nsgmls -gues $$file.sgml; \
94           debiandoc2html $$file.sgml; \
95           debiandoc2text $$file.sgml; \
96           if [ -f $$file.txt ]; then mv $$file.txt $$file.text; fi; \
97           gzip -9f $$file.text; \
98         done
99         tar zfx $(FHS_ARCHIVE)
100         # Need to use a patched tmac.m macro file if we're using a pre-1.16
101         # groff; version 1.16 is apparently fixed
102         if dpkg --compare-versions $(GROFF_VERSION) lt 1.16; then \
103             cp /usr/share/groff/tmac/tmac.m fhs && \
104             cd fhs && patch -p1 < ../mm1.32-patch; \
105         fi
106         # The extra '.' in the tmac path doesn't matter if
107         GROFF_TMAC_PATH=. cd fhs && $(MAKE) all
108         lynx -dump fhs-changes-2.1.html > fhs/fhs-changes-2.1.text
109         lynx -dump upgrading-checklist.html > upgrading-checklist.text
110         touch stamp-build
111
112 configure: stamp-configure
113 stamp-configure:
114         rm -f version.ent
115         echo "<!entity version \"$(version)\">" >> version.ent
116         echo "<!entity date    \"$(date)\">"        >> version.ent
117         touch stamp-configure
118
119 clean:
120 # Undoes the effect of `make -f debian/rules build'.
121         $(checkdir)
122         rm -f  $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
123         rm -rf $(DIRS_TO_CLEAN)
124         rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
125           -name '*~' -o -name '*.bak' -o -name '#*#' -o \
126           -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
127           -size 0 \) -print` TAGS
128
129
130 binary:         binary-indep binary-arch
131 binary-arch:    build
132         $(checkdir)
133 # There are no architecture-dependent files to be uploaded
134 # generated by this package.  If there were any they would be
135 # made here.
136
137 binary-indep:   stamp-policy
138 stamp-policy:  build
139         @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
140                 (echo need root priviledges; exit 1)
141         $(checkdir)
142         test -f stamp-build     || $(MAKE) -f        debian/rules build
143         -rm -rf                 $(TMPTOP)
144         $(make_directory)       $(TMPTOP)/DEBIAN
145         $(make_directory)       $(DOCDIR)/fsstnd
146         $(make_directory)       $(DOCDIR)/fhs
147         $(make_directory)       $(LIBDIR)
148         # create a substvar to reference from debian/control so that
149         # we don't hardcode the policy compliance of the policy
150         # package.  I guess some might question this but I take it as
151         # a given that the debian-policy pkg must always comply with
152         # itself...
153         echo "debian-policy:Version=$(version)"      > debian/substvars
154         $(install_file)     $(POLICY_FILES)          $(DOCDIR)/
155         $(install_file)     $(FSSTND_FILES)          $(DOCDIR)/fsstnd/
156         $(install_file)     $(FHS_FILES)             $(DOCDIR)/fhs/
157         $(install_file)     debian/changelog         $(DOCDIR)/
158         -gzip -fqr9         $(DOCDIR)
159         $(install_file)     debian/copyright         $(DOCDIR)/
160         $(install_file)     debian-policy.desc       $(LIBDIR)/debian-policy
161         (tar cf -           policy.html) |           (cd $(DOCDIR);   tar xf -)
162         (tar cf -           menu-policy.html) |      (cd $(DOCDIR);   tar xf -)
163         (tar cf -           mime-policy.html) |      (cd $(DOCDIR);   tar xf -)
164         (tar cf -           proposal.html) |         (cd $(DOCDIR);   tar xf -)
165         (tar cf -           policy-process.html) |   (cd $(DOCDIR);   tar xf -)
166         sed -e 's/#PACKAGE#/$(package)/g' debian/postinst.in > debian/postinst
167         sed -e 's/#PACKAGE#/$(package)/g' debian/prerm.in > debian/prerm
168         $(install_program)  debian/{postinst,prerm}  debian/tmp/DEBIAN/
169         dpkg-gencontrol     -pdebian-policy -Pdebian/tmp -isp
170         chown               -R root.root debian/tmp
171         chmod               -R go=rX debian/tmp
172         dpkg                --build debian/tmp ..
173         debiandoc2latexps    policy.sgml
174         mv policy.ps         ../
175         gzip -9qvf            ../policy.ps
176         debiandoc2latexpdf  policy.sgml
177         mv policy.pdf        ../
178         gzip -9qfv           ../policy.pdf
179         GZIP=-9v tar zcf    ../policy.html.tar.gz    policy.html
180         $(install_file)    version.ent               $(DOCDIR)/
181         dpkg-distaddfile    -fdebian/files           policy.ps.gz       byhand -
182         dpkg-distaddfile    -fdebian/files           policy.pdf.gz      byhand -
183         dpkg-distaddfile    -fdebian/files           policy.html.tar.gz byhand -
184         for i in            $(BYHAND_FILES); do \
185           $(install_file)   $$i            ..                ; \
186           dpkg-distaddfile  -fdebian/files $$i       byhand - ; \
187         done
188         touch              stamp-policy
189
190
191 define checkdir
192         test -f debian/rules -a -f policy.sgml
193 endef
194
195 source diff:
196         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
197
198 .PHONY: binary binary-arch binary-indep clean checkroot
199
200 #Local variables:
201 #mode: makefile
202 #End: