]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/rules
Sync with upstream
[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 : Tue Oct 26 15:20:25 2004
9 ## Last Machine Used: glaurung.internal.golden-gryphon.com
10 ## Update Count     : 62
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; 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)
30
31 arch    := $(shell dpkg --print-installation-architecture)
32
33 # Basic information
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)
37
38 # Location of the source dir
39 SRCTOP    := $(CURDIR)
40 TMPTOP    := $(SRCTOP)/debian/tmp
41 DOCDIR    := $(TMPTOP)/usr/share/doc/$(package)
42 LIBDIR    := $(TMPTOP)/usr/share/doc-base
43
44 sanitycheck := debian/rules policy.sgml
45
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
49
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 FHS_ARCHIVE  := fhs-2.3-source.tar.gz
54 FHS_HTML     := fhs-2.3.html
55 FHS_FILES    := fhs-2.3.ps.gz fhs-2.3.txt.gz fhs-2.3.pdf.gz
56 FHS_NEW_ARCHIVE  := 
57 FHS_NEW_HTML     := 
58 FHS_NEW_FILES    := 
59
60 POLICY_FILES = $(SGML_FILES:=.sgml) $(SGML_FILES:=.txt.gz) \
61                virtual-package-names-list.txt \
62                upgrading-checklist.txt libc6-migration.txt version.ent \
63                debconf_spec/debconf_specification.html \
64                debconf_spec/debconf_specification.txt.gz \
65                policy.ps.gz policy.pdf.gz
66
67 # policy.{pdf,ps,tpt,txt} are generated files
68 FILES_TO_CLEAN  = debian/files debian/buildinfo  debian/substvars \
69                   debian/postinst debian/prerm \
70                   version.ent upgrading-checklist.txt \
71                   $(SGML_FILES:=.txt.gz) $(SGML_FILES:=.html.tar.gz) \
72                   policy.pdf.gz policy.ps.gz \
73                   debconf_specification.xml.tar.gz \
74                   policy.pdf policy.ps policy.txt policy.
75
76 STAMPS_TO_CLEAN := stamp-policy stamp-build
77 DIRS_TO_CLEAN   := debian/tmp fhs $(SGML_FILES:=.html)
78
79
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
83
84
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         links -dump upgrading-checklist.html | perl -pe 's/[\r\0]//g' > \
92                     upgrading-checklist.txt
93         $(MAKE) -C debconf_spec all
94         touch stamp-build
95
96 configure: version.ent
97 version.ent: debian/changelog
98         rm -f $@
99         echo "<!entity version \"$(version)\">" >> $@
100         echo "<!entity date    \"$(date)\">"    >> $@
101
102 clean: $(sanitycheck)
103 # Undoes the effect of `make -f debian/rules build'.
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 debconf_spec && \
145           tar -zcf ../debconf_specification.xml.tar.gz *
146         $(install_file)     debconf_specification.xml.tar.gz $(DOCDIR)/
147         @set -ex; \
148         for file in $(DESC_FILES); do \
149           $(install_file) $$file.desc $(LIBDIR)/$$file; \
150         done
151         @set -ex; \
152         for file in $(SGML_FILES); do \
153           tar -C $(DOCDIR) -zxf $$file.html.tar.gz; \
154         done
155         $(install_file)     $(FHS_HTML)   $(DOCDIR)/fhs
156         @set -ex; \
157         cd debian/tmp; \
158         find . -type f -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums
159         sed -e 's/#PACKAGE#/$(package)/g' debian/postinst.in > debian/postinst
160         sed -e 's/#PACKAGE#/$(package)/g' debian/prerm.in > debian/prerm
161         $(install_program)  debian/postinst          debian/tmp/DEBIAN/
162         $(install_program)  debian/prerm             debian/tmp/DEBIAN/
163         dpkg-gencontrol     -p$(package) -Pdebian/tmp -isp
164         chown               -R root:root debian/tmp
165         chmod               -R go=rX debian/tmp
166         dpkg                --build debian/tmp ..
167         touch               stamp-policy
168
169
170 .PHONY: configure build binary binary-arch binary-indep clean checkroot
171
172 #Local variables:
173 #mode: makefile
174 #End: