]> git.donarmstrong.com Git - debhelper.git/blob - Makefile
Run pod2man with --utf8. Closes: #541270
[debhelper.git] / Makefile
1 # This generates a list of synopses of debhelper commands, and substitutes
2 # it in to the #LIST# line on the man page fed to it on stdin. Must be passed
3 # parameters of all the executables or pod files to get the synopses from.
4 # For correct conversion of pod tags (like S< >) #LIST# must be substituted in
5 # the pod file and not in the troff file.
6 MAKEMANLIST=perl -e ' \
7                 undef $$/; \
8                 foreach (@ARGV) { \
9                         open (IN, $$_) or die "$$_: $$!"; \
10                         $$file=<IN>; \
11                         close IN; \
12                         if ($$file=~m/=head1 .*?\n\n(.*?) - (.*?)\n\n/s) { \
13                                 $$collect.="=item $$1(1)\n\n$$2\n\n"; \
14                         } \
15                 } \
16                 END { \
17                         while (<STDIN>) { \
18                                 s/\#LIST\#/$$collect/; \
19                                 print; \
20                         }; \
21                 }'
22
23 # Figure out the `current debhelper version.
24 VERSION=$(shell expr "`dpkg-parsechangelog |grep Version:`" : '.*Version: \(.*\)')
25
26 PERLLIBDIR=$(shell perl -MConfig -e 'print $$Config{vendorlib}')/Debian/Debhelper
27
28 POD2MAN=pod2man --utf8 -c Debhelper -r "$(VERSION)"
29
30 # l10n to be built is determined from .po files
31 LANGS=$(notdir $(basename $(wildcard man/po4a/po/*.po)))
32
33 build: version
34         find . -maxdepth 1 -type f -perm +100 -name "dh*" \
35                 -exec $(POD2MAN) {} {}.1 \;
36         cat debhelper.pod | \
37                 $(MAKEMANLIST) `find . -maxdepth 1 -type f -perm +100 -name "dh_*" | sort` | \
38                 $(POD2MAN) --name="debhelper" --section=7  > debhelper.7
39         po4a -L UTF-8 man/po4a/po4a.cfg 
40         set -e; \
41         for lang in $(LANGS); do \
42                 dir=man/$$lang; \
43                 for file in $$dir/dh*.pod; do \
44                         prog=`basename $$file | sed 's/.pod//'`; \
45                         $(POD2MAN) $$file $$prog.$$lang.1; \
46                 done; \
47                 if [ -e $$dir/debhelper.pod ]; then \
48                         cat $$dir/debhelper.pod | \
49                                 $(MAKEMANLIST) `find $$dir -type f -maxdepth 1 -name "dh_*.pod" | sort` | \
50                                 $(POD2MAN) --name="debhelper" --section=7 > debhelper.$$lang.7; \
51                 fi; \
52         done
53
54 version:
55         printf "package Debian::Debhelper::Dh_Version;\n\$$version='$(VERSION)';\n1" > \
56                 Debian/Debhelper/Dh_Version.pm
57
58 clean:
59         rm -f *.1 *.7 Debian/Debhelper/Dh_Version.pm
60         po4a --rm-translations --rm-backups man/po4a/po4a.cfg
61         for lang in $(LANGS); do \
62                 if [ -e man/$$lang ]; then rmdir man/$$lang; fi; \
63         done;
64
65 install:
66         install -d $(DESTDIR)/usr/bin \
67                 $(DESTDIR)/usr/share/debhelper/autoscripts \
68                 $(DESTDIR)$(PERLLIBDIR)/Sequence \
69                 $(DESTDIR)$(PERLLIBDIR)/Buildsystem
70         install $(shell find -maxdepth 1 -mindepth 1 -name dh\* |grep -v \.1\$$) $(DESTDIR)/usr/bin
71         install -m 0644 autoscripts/* $(DESTDIR)/usr/share/debhelper/autoscripts
72         install -m 0644 Debian/Debhelper/*.pm $(DESTDIR)$(PERLLIBDIR)
73         install -m 0644 Debian/Debhelper/Sequence/*.pm $(DESTDIR)$(PERLLIBDIR)/Sequence
74         install -m 0644 Debian/Debhelper/Buildsystem/*.pm $(DESTDIR)$(PERLLIBDIR)/Buildsystem
75
76 test: version
77         ./run perl -MTest::Harness -e 'runtests grep { ! /CVS/ && ! /\.svn/ && -f && -x } @ARGV' t/* t/buildsystems/*
78         # clean up log etc
79         ./run dh_clean