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