File: rules

package info (click to toggle)
doc-base 0.7.8
  • links: PTS
  • area: main
  • in suites: potato
  • size: 72 kB
  • ctags: 32
  • sloc: perl: 428; sh: 113; makefile: 72
file content (105 lines) | stat: -rwxr-xr-x 3,232 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/make -f
# rules file for doc-base
#
# I do not use debstd, debhelper, or any of that stuff.
# I believe in stripped down rules files; nothing that is not required.
# I believe in readability through abstraction.

package		:= doc-base

# directory abstraction
prefix		:= debian/tmp
sbindir		:= $(prefix)/usr/sbin
mandir		:= $(prefix)/usr/share/man
docdir		:= $(prefix)/usr/share/doc/$(package)
sharedir	:= $(prefix)/usr/share/$(package)
vardir		:= $(prefix)/var/lib/$(package)

# build abstraction
install_file	:= install -o root -g root -m 644
install_script	:= install -o root -g root -m 755
install_program	:= install -o root -g root -m 755 --strip
make_directory	:= install -d -o root -g root -m 755
compress	:= gzip -9f

# determine our version number
DEB_VERSION	:= $(shell LC_ALL=C dpkg-parsechangelog | grep ^Version: | sed 's/^Version: *//')

build:
	$(checkdir)
	perl -cw install-docs		# check perl script syntax
	rm -f version.ent
	echo "<!entity version \"$(DEB_VERSION)\">" >> version.ent
	echo "<!entity date    \"$(DATE)\">"        >> version.ent
	nsgmls -wall -s -E20 doc-base.sgml	# check SGML syntax
	debiandoc2html doc-base.sgml
	debiandoc2text doc-base.sgml
	pod2man --section=8 --center="Debian Utilities"		\
		--release="doc-base v$(DEB_VERSION)"		\
		install-docs > install-docs.8
	pod2html --title "install-docs reference" 		\
		< install-docs > install-docs.html
	touch build

clean:
	$(checkdir)
	rm -f build
	rm -rf doc-base.html doc-base.txt* install-docs.8 install-docs.html
	rm -f pod2html* version.ent
	rm -f `find . -name "*~"`
	rm -rf $(prefix) debian/files* core debian/substvars

binary-indep:	checkroot build
	$(checkdir)
	rm -rf $(prefix)
	$(make_directory) $(prefix)/DEBIAN
	$(make_directory) $(docdir) $(sbindir) $(sharedir) $(mandir)/man8
	$(make_directory) $(vardir)/info/
	$(install_script) install-docs $(sbindir)/
	$(install_file) doc-base.txt doc-base.sgml version.ent $(docdir)/
	$(install_file) doc-base.desc $(sharedir)/doc-base
	$(make_directory) $(docdir)/doc-base.html
	$(install_file) doc-base.html/* $(docdir)/doc-base.html/
	$(install_file) install-docs.8 $(mandir)/man8/
	$(install_file) install-docs.html $(docdir)/
	$(install_file) install-docs.desc $(sharedir)/install-docs-man

	$(install_file) debian/changelog debian/copyright $(docdir)/

	# make sure control files are good
	sh -n debian/preinst
	sh -n debian/postinst
	sh -n debian/prerm
	# install control files
	$(install_script) debian/preinst debian/postinst debian/prerm \
		$(prefix)/DEBIAN/

	# compress docs (policy)	
	find $(mandir) -type f | xargs $(compress)
	find $(docdir) -type f \
	    \( -size +4k -or -name "changelog*" \) \
            ! -name "*.htm" ! -name "*.html" ! -name "*.gif" \
            ! -name "copyright" | xargs $(compress)

	dpkg-gencontrol -isp
	dpkg --build $(prefix) ..

binary-arch:	checkroot build
	$(checkdir)
# There are no architecture-dependent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

define checkdir
	test -f debian/rules
endef

# Below here is fairly generic really

binary:		binary-indep binary-arch

checkroot:
	$(checkdir)
	test root = "`whoami`"

.PHONY: binary binary-arch binary-indep clean checkroot