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