]> git.donarmstrong.com Git - debhelper.git/blob - debian/rules
f2401f75f09e8ddeba572d3061c90bca80ee5d40
[debhelper.git] / debian / rules
1 #!/usr/bin/make -f
2 # This is _not_ a good example of a debhelper rules file.
3 # See examples/ for some good examples.
4
5 # This generates a list of synopses of debhelper commands, and substitutes
6 # it in to the #LIST# line on the man page fed to it on stdin. Must be passed
7 # parameters of all the executables or pod files to get the synopses from.
8 # (Like I said, this is not a good example of a debhelper rules file..)
9 # For correct conversion of pod tags (like S< >) #LIST# must be substituted in
10 # the pod file and not in the troff file.
11 MAKEMANLIST=perl -e ' \
12                 undef $$/; \
13                 foreach (@ARGV) { \
14                         open (IN, $$_) or die "$$_: $$!"; \
15                         $$file=<IN>; \
16                         close IN; \
17                         if ($$file=~m/=head1 .*?\n\n(.*?) - (.*?)\n\n/s) { \
18                                 $$collect.="=item $$1(1)\n\n$$2\n\n"; \
19                         } \
20                 } \
21                 END { \
22                         while (<STDIN>) { \
23                                 s/\#LIST\#/$$collect/; \
24                                 print; \
25                         }; \
26                 }'
27
28 # Figure out the `current debhelper version.
29 VERSION=$(shell expr "`dpkg-parsechangelog |grep Version:`" : '.*Version: \(.*\)')
30
31 PERLLIBDIR=$(shell perl -MConfig -e 'print $$Config{vendorlib}')
32
33 POD2MAN=pod2man -c Debhelper -r "$(VERSION)"
34
35 # l10n to be built is determined from .po files
36 LANGS=$(notdir $(basename $(wildcard man/po4a/po/*.po)))
37
38 version:
39         printf "package Debian::Debhelper::Dh_Version;\n\$$version='$(VERSION)';" > \
40                 Debian/Debhelper/Dh_Version.pm
41
42 build: version test build-stamp
43 build-stamp:
44         find . -maxdepth 1 -type f -perm +100 -name "dh_*" \
45                 -exec $(POD2MAN) {} {}.1 \;
46         cat debhelper.pod | \
47                 $(MAKEMANLIST) `find . -maxdepth 1 -type f -perm +100 -name "dh_*" | sort` | \
48                 $(POD2MAN) --name="debhelper" --section=7  > debhelper.7
49         po4a man/po4a/po4a.cfg 
50         set -e; \
51         for lang in $(LANGS); do \
52                 dir=man/$$lang; \
53                 for file in $$dir/dh_*.pod; do \
54                         prog=`basename $$file | sed 's/.pod//'`; \
55                         $(POD2MAN) $$file $$prog.$$lang.1; \
56                 done; \
57                 cat $$dir/debhelper.pod | \
58                         $(MAKEMANLIST) `find $$dir -type f -maxdepth 1 -name "dh_*.pod" | sort` | \
59                         $(POD2MAN) --section=7 > debhelper.$$lang.7; \
60         done
61         
62         touch build-stamp
63
64 clean:
65         ./run dh_testdir
66         ./run dh_testroot
67         ./run dh_clean *.1 *.7 *-stamp Debian/Debhelper/Dh_Version.pm
68         po4a --rm-translations --rm-backups man/po4a/po4a.cfg
69         for lang in $(LANGS); do \
70                 if [ -e man/$$lang ]; then rmdir man/$$lang; fi; \
71         done;
72
73 test: version test-stamp
74 test-stamp:
75         ./run dh_clean
76         ./run perl -MTest::Harness -e 'runtests grep { ! /CVS/ && ! /\.svn/ } @ARGV' t/*
77         ./run dh_clean
78         touch test-stamp
79
80 binary-indep: build
81         ./run dh_testdir
82         ./run dh_testroot
83         ./run dh_clean -k
84         ./run dh_install -X .1 dh_* usr/bin
85         ./run dh_install Debian/Debhelper/*.pm $(PERLLIBDIR)/Debian/Debhelper/
86         ./run dh_install autoscripts usr/share/debhelper
87         ./run dh_installdocs doc/*
88         ./run dh_installexamples examples/*
89         ./run dh_installman *.1 *.7
90         ./run dh_installchangelogs
91         ./run dh_link
92         ./run dh_compress
93         ./run dh_fixperms
94         ./run dh_perl
95         ./run dh_installdeb
96         ./run dh_gencontrol
97         ./run dh_md5sums
98         ./run dh_builddeb
99
100 # Not intended for use by anyone except the author.
101 announcedir:
102         @echo ${HOME}/src/joeywiki/code/debhelper/news
103
104 binary-arch:
105 binary: binary-indep binary-arch
106 .PHONY: build clean binary-indep binary-arch binary