]> git.donarmstrong.com Git - debian/debian-policy.git/blob - debian/rules
[bug545548-srivasta]: Make upgradng-checklist a real HTML file
[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
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 upgrading-checklist.html \
57                upgrading-checklist.txt 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)
87         $(MAKE) $(SGML_FILES:=.sgml.validate) \
88                 $(SGML_FILES:=.html.tar.gz) \
89                 $(SGML_FILES:=-1.html) \
90                 $(SGML_FILES:=.txt.gz) \
91                 policy.ps.gz policy.pdf.gz
92 ifneq (,$(strip $(HAVE_ORG_EMACS)))
93         $(MAKE) $(FILES_FROM_ORG)
94 endif
95         $(MAKE) -C debconf_spec all
96         touch stamp-build
97
98 configure: version.ent
99 version.ent: debian/changelog
100         rm -f $@
101         echo "<!entity version \"$(version)\">" >> $@
102         echo "<!entity date    \"$(date)\">"    >> $@
103
104 clean: $(sanitycheck)
105 # Undoes the effect of `make -f debian/rules build'.
106         $(MAKE) -C debconf_spec clean
107         rm -f  $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
108         rm -rf $(DIRS_TO_CLEAN)
109         rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o \
110           -name '*~' -o -name '*.bak' -o -name '#*#' -o \
111           -name '.*.orig' -o -name '.*.rej' -o -name '.SUMS' -o \
112           -size 0 \) -print` TAGS
113
114
115 binary:         binary-indep binary-arch
116 binary-arch:    build $(sanitycheck)
117 # There are no architecture-dependent files to be uploaded
118 # generated by this package.  If there were any they would be
119 # made here.
120
121 binary-indep:   stamp-policy
122 stamp-policy:  build $(sanitycheck)
123         @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
124                 (echo need root priviledges; exit 1)
125 #       This is unnecessary; commenting out
126 #       test -f stamp-build     || $(MAKE) -f        debian/rules build
127         rm -rf                  $(TMPTOP)
128         $(make_directory)       $(TMPTOP)/DEBIAN
129         $(make_directory)       $(DOCDIR)/fhs
130         $(make_directory)       $(LIBDIR)
131         # create a substvar to reference from debian/control so that
132         # we don't hardcode the policy compliance of the policy
133         # package.  I guess some might question this but I take it as
134         # a given that the debian-policy pkg must always comply with
135         # itself...
136         echo "debian-policy:Version=$(version)"      > debian/substvars
137         $(install_file)     $(POLICY_FILES)          $(DOCDIR)/
138         $(install_file)     debian/changelog         $(DOCDIR)/
139         # Be more specific with file compression
140         gzip -f9            $(DOCDIR)/*.txt $(DOCDIR)/*.sgml \
141                                 $(DOCDIR)/changelog
142 # These are allready compressed
143         #$(install_file)    $(FHS_NEW_FILES)         $(DOCDIR)/fhs/
144         $(install_file)     $(FHS_FILES)             $(DOCDIR)/fhs/
145         $(install_file)     debian/copyright         $(DOCDIR)/
146         GZIP=-9 cd debconf_spec && \
147           tar -zcf ../debconf_specification.xml.tar.gz *
148         $(install_file)     debconf_specification.xml.tar.gz $(DOCDIR)/
149         @set -ex; \
150         for file in $(DESC_FILES); do \
151           $(install_file) $$file.desc $(LIBDIR)/$$file; \
152         done
153         @set -ex; \
154         for file in $(SGML_FILES); do \
155           tar -C $(DOCDIR) -zxf $$file.html.tar.gz; \
156         done
157         for file in $(SGML_FILES); do \
158           $(install_file) $${file}-1.html $(DOCDIR); \
159         done
160         $(install_file)     $(FHS_HTML)   $(DOCDIR)/fhs
161         @set -ex; \
162         cd debian/tmp; \
163         find . -path "./DEBIAN" -prune -o -type f -printf '%P\0' \
164            | xargs -r0 md5sum > DEBIAN/md5sums
165         dpkg-gencontrol     -p$(package) -Pdebian/tmp -isp
166         chown               -R root:root debian/tmp
167         chmod               -R go=rX debian/tmp
168         dpkg                --build debian/tmp ..
169         touch               stamp-policy
170
171
172 .PHONY: configure build binary binary-arch binary-indep clean checkroot
173
174 #Local variables:
175 #mode: makefile
176 #End: