]> git.donarmstrong.com Git - debhelper.git/blob - Makefile
Merge branch 'master' into buildsystems
[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 -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                 cat $$dir/debhelper.pod | \
48                         $(MAKEMANLIST) `find $$dir -type f -maxdepth 1 -name "dh_*.pod" | sort` | \
49                         $(POD2MAN) --name="debhelper" --section=7 > debhelper.$$lang.7; \
50         done
51
52 version:
53         printf "package Debian::Debhelper::Dh_Version;\n\$$version='$(VERSION)';\n1" > \
54                 Debian/Debhelper/Dh_Version.pm
55
56 clean:
57         rm -f *.1 *.7 Debian/Debhelper/Dh_Version.pm
58         po4a --rm-translations --rm-backups man/po4a/po4a.cfg
59         for lang in $(LANGS); do \
60                 if [ -e man/$$lang ]; then rmdir man/$$lang; fi; \
61         done;
62
63 install:
64         install -d $(DESTDIR)/usr/bin \
65                 $(DESTDIR)/usr/share/debhelper/autoscripts \
66                 $(DESTDIR)$(PERLLIBDIR)/Sequence \
67                 $(DESTDIR)$(PERLLIBDIR)/Buildsystem
68         install $(shell find -maxdepth 1 -mindepth 1 -name dh\* |grep -v \.1\$$) $(DESTDIR)/usr/bin
69         install -m 0644 autoscripts/* $(DESTDIR)/usr/share/debhelper/autoscripts
70         install -m 0644 Debian/Debhelper/*.pm $(DESTDIR)$(PERLLIBDIR)
71         install -m 0644 Debian/Debhelper/Sequence/*.pm $(DESTDIR)$(PERLLIBDIR)/Sequence
72         install -m 0644 Debian/Debhelper/Buildsystem/*.pm $(DESTDIR)$(PERLLIBDIR)/Buildsystem
73
74 test: version
75         ./run perl -MTest::Harness -e 'runtests grep { ! /CVS/ && ! /\.svn/ && -f && -x } @ARGV' t/* t/buildsystems/*
76         # clean up log etc
77         ./run dh_clean