]> git.donarmstrong.com Git - debhelper.git/blob - Makefile
Drop deprecated programs from the list of commands in debhelper(7). Closes: #548382
[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                                 my $$item="=item $$1(1)\n\n$$2\n\n"; \
14                                 if ($$2!~/deprecated/) { \
15                                         $$list.=$$item; \
16                                 } \
17                                 else { \
18                                         $$list_deprecated.=$$item; \
19                                 } \
20                         } \
21                 } \
22                 END { \
23                         while (<STDIN>) { \
24                                 s/\#LIST\#/$$list/; \
25                                 s/\#LIST_DEPRECATED\#/$$list_deprecated/; \
26                                 print; \
27                         }; \
28                 }'
29
30 # Figure out the `current debhelper version.
31 VERSION=$(shell expr "`dpkg-parsechangelog |grep Version:`" : '.*Version: \(.*\)')
32
33 PERLLIBDIR=$(shell perl -MConfig -e 'print $$Config{vendorlib}')/Debian/Debhelper
34
35 POD2MAN=pod2man --utf8 -c Debhelper -r "$(VERSION)"
36
37 # l10n to be built is determined from .po files
38 LANGS=$(notdir $(basename $(wildcard man/po4a/po/*.po)))
39
40 build: version debhelper.7
41         find . -maxdepth 1 -type f -perm +100 -name "dh*" \
42                 -exec $(POD2MAN) {} {}.1 \;
43         po4a --previous -L UTF-8 man/po4a/po4a.cfg 
44         set -e; \
45         for lang in $(LANGS); do \
46                 dir=man/$$lang; \
47                 for file in $$dir/dh*.pod; do \
48                         prog=`basename $$file | sed 's/.pod//'`; \
49                         $(POD2MAN) $$file $$prog.$$lang.1; \
50                 done; \
51                 if [ -e $$dir/debhelper.pod ]; then \
52                         cat $$dir/debhelper.pod | \
53                                 $(MAKEMANLIST) `find $$dir -type f -maxdepth 1 -name "dh_*.pod" | sort` | \
54                                 $(POD2MAN) --name="debhelper" --section=7 > debhelper.$$lang.7; \
55                 fi; \
56         done
57
58 version:
59         printf "package Debian::Debhelper::Dh_Version;\n\$$version='$(VERSION)';\n1" > \
60                 Debian/Debhelper/Dh_Version.pm
61
62 debhelper.7: debhelper.pod
63         cat debhelper.pod | \
64                 $(MAKEMANLIST) `find . -maxdepth 1 -type f -perm +100 -name "dh_*" | sort` | \
65                 $(POD2MAN) --name="debhelper" --section=7  > debhelper.7
66
67 clean:
68         rm -f *.1 *.7 Debian/Debhelper/Dh_Version.pm
69         po4a --previous --rm-translations --rm-backups man/po4a/po4a.cfg
70         for lang in $(LANGS); do \
71                 if [ -e man/$$lang ]; then rmdir man/$$lang; fi; \
72         done;
73
74 install:
75         install -d $(DESTDIR)/usr/bin \
76                 $(DESTDIR)/usr/share/debhelper/autoscripts \
77                 $(DESTDIR)$(PERLLIBDIR)/Sequence \
78                 $(DESTDIR)$(PERLLIBDIR)/Buildsystem
79         install $(shell find -maxdepth 1 -mindepth 1 -name dh\* |grep -v \.1\$$) $(DESTDIR)/usr/bin
80         install -m 0644 autoscripts/* $(DESTDIR)/usr/share/debhelper/autoscripts
81         install -m 0644 Debian/Debhelper/*.pm $(DESTDIR)$(PERLLIBDIR)
82         install -m 0644 Debian/Debhelper/Sequence/*.pm $(DESTDIR)$(PERLLIBDIR)/Sequence
83         install -m 0644 Debian/Debhelper/Buildsystem/*.pm $(DESTDIR)$(PERLLIBDIR)/Buildsystem
84
85 test: version
86         ./run perl -MTest::Harness -e 'runtests grep { ! /CVS/ && ! /\.svn/ && -f && -x } @ARGV' t/* t/buildsystems/*
87         # clean up log etc
88         ./run dh_clean