summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-04-23 15:51:42 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-04-23 15:51:42 -0400
commite55c32e8b1292342b443e204807460dc597bf939 (patch)
treee3d56f8c047637b462991f0b2679b5673881bfc9 /Makefile
parentcf04cbf2d5d3edf3d9e2ef7ef348b7bd7d5d5a15 (diff)
Add a Makefile and simplify this package's own rules file using all the new toys.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile72
1 files changed, 72 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..ec7e590e
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,72 @@
+# This generates a list of synopses of debhelper commands, and substitutes
+# it in to the #LIST# line on the man page fed to it on stdin. Must be passed
+# parameters of all the executables or pod files to get the synopses from.
+# For correct conversion of pod tags (like S< >) #LIST# must be substituted in
+# the pod file and not in the troff file.
+MAKEMANLIST=perl -e ' \
+ undef $$/; \
+ foreach (@ARGV) { \
+ open (IN, $$_) or die "$$_: $$!"; \
+ $$file=<IN>; \
+ close IN; \
+ if ($$file=~m/=head1 .*?\n\n(.*?) - (.*?)\n\n/s) { \
+ $$collect.="=item $$1(1)\n\n$$2\n\n"; \
+ } \
+ } \
+ END { \
+ while (<STDIN>) { \
+ s/\#LIST\#/$$collect/; \
+ print; \
+ }; \
+ }'
+
+# Figure out the `current debhelper version.
+VERSION=$(shell expr "`dpkg-parsechangelog |grep Version:`" : '.*Version: \(.*\)')
+
+PERLLIBDIR=$(shell perl -MConfig -e 'print $$Config{vendorlib}')/Debian/Debhelper
+
+POD2MAN=pod2man -c Debhelper -r "$(VERSION)"
+
+# l10n to be built is determined from .po files
+LANGS=$(notdir $(basename $(wildcard man/po4a/po/*.po)))
+
+build: version
+ find . -maxdepth 1 -type f -perm +100 -name "dh_*" \
+ -exec $(POD2MAN) {} {}.1 \;
+ cat debhelper.pod | \
+ $(MAKEMANLIST) `find . -maxdepth 1 -type f -perm +100 -name "dh_*" | sort` | \
+ $(POD2MAN) --name="debhelper" --section=7 > debhelper.7
+ po4a man/po4a/po4a.cfg
+ set -e; \
+ for lang in $(LANGS); do \
+ dir=man/$$lang; \
+ for file in $$dir/dh_*.pod; do \
+ prog=`basename $$file | sed 's/.pod//'`; \
+ $(POD2MAN) $$file $$prog.$$lang.1; \
+ done; \
+ cat $$dir/debhelper.pod | \
+ $(MAKEMANLIST) `find $$dir -type f -maxdepth 1 -name "dh_*.pod" | sort` | \
+ $(POD2MAN) --name="debhelper" --section=7 > debhelper.$$lang.7; \
+ done
+
+version:
+ printf "package Debian::Debhelper::Dh_Version;\n\$$version='$(VERSION)';\n1" > \
+ Debian/Debhelper/Dh_Version.pm
+
+clean:
+ rm -f *.1 *.7 Debian/Debhelper/Dh_Version.pm
+ po4a --rm-translations --rm-backups man/po4a/po4a.cfg
+ for lang in $(LANGS); do \
+ if [ -e man/$$lang ]; then rmdir man/$$lang; fi; \
+ done;
+
+install:
+ install -d $(DESTDIR)/usr/bin \
+ $(DESTDIR)/usr/share/debhelper/autoscripts \
+ $(DESTDIR)$(PERLLIBDIR)
+ install $(shell find -maxdepth 1 -mindepth 1 -name dh_\* |grep -v \.1\$) $(DESTDIR)/usr/bin
+ install autoscripts/* $(DESTDIR)/usr/share/debhelper/autoscripts
+ install Debian/Debhelper/*.pm $(DESTDIR)$(PERLLIBDIR)
+
+test: version
+ ./run perl -MTest::Harness -e 'runtests grep { ! /CVS/ && ! /\.svn/ } @ARGV' t/*