]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/rules
Merge branch 'master' into bug442134-srivasta
[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 # 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;                \
29                fi)
30 HAVE_ORG_EMACS:=$(strip $(EMACS))
31
32
33 # Location of the source dir
34 SRCTOP    := $(CURDIR)
35 TMPTOP    := $(SRCTOP)/debian/tmp
36 DOCDIR    := $(TMPTOP)/usr/share/doc/$(package)
37 LIBDIR    := $(TMPTOP)/usr/share/doc-base
38
39 sanitycheck := debian/rules policy.sgml
40
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
44
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
51 FHS_NEW_ARCHIVE  := 
52 FHS_NEW_HTML     := 
53 FHS_NEW_FILES    := 
54
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
62
63 # policy.{pdf,ps,tpt,txt} are generated files
64 FILES_TO_CLEAN  = debian/files debian/buildinfo  debian/substvars \
65                   debian/postinst debian/prerm \
66                   version.ent \
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
73
74 FILES_FROM_ORG := README.txt README.html
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) 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)
95 endif
96         $(MAKE) -C debconf_spec all
97         touch stamp-build
98
99 configure: version.ent
100 version.ent: debian/changelog
101         rm -f $@
102         echo "<!entity version \"$(version)\">" >> $@
103         echo "<!entity date    \"$(date)\">"    >> $@
104
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
114
115
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
120 # made here.
121
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
128         rm -rf                  $(TMPTOP)
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
136         # itself...
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 \
142                                 $(DOCDIR)/changelog
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)/
150         @set -ex; \
151         for file in $(DESC_FILES); do \
152           $(install_file) $$file.desc $(LIBDIR)/$$file; \
153         done
154         @set -ex; \
155         for file in $(SGML_FILES); do \
156           tar -C $(DOCDIR) -zxf $$file.html.tar.gz; \
157         done
158         for file in $(SGML_FILES); do \
159           $(install_file) $${file}-1.html $(DOCDIR); \
160         done
161         $(install_file)     $(FHS_HTML)   $(DOCDIR)/fhs
162         @set -ex; \
163         cd debian/tmp; \
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 ..
170         touch               stamp-policy
171
172
173 .PHONY: configure build binary binary-arch binary-indep clean checkroot
174
175 #Local variables:
176 #mode: makefile
177 #End: