]> git.donarmstrong.com Git - debhelper.git/blob - debian/rules
204cb5a15a4f84048e9d4d5fde3fe77eae14e226
[debhelper.git] / debian / rules
1 #!/usr/bin/make -f
2 # Note that I have to refer to debhelper programs with ./, to make sure
3 # I run the most current ones.
4 #
5 # This is _not_ a good example of a debhelper rules file, but I didn't need
6 # to tell you that; just see the chunk of inlined perl below.. 
7 # See examples/ for some good examples.
8
9 # Ensure that builds are self-hosting, which means I have to use the .pm
10 # files in this package, not any that may be on the system.
11 export PERL5LIB=.
12
13 # If any automatic script generation is done in building this package, 
14 # be sure to use the new templates from this package.
15 export DH_AUTOSCRIPTDIR=autoscripts
16
17 # Figure out the `current debhelper version.
18 VERSION=$(shell expr "`dpkg-parsechangelog 2>/dev/null |grep Version:`" : '.*Version: \(.*\)')
19
20 PERLLIBDIR=$(shell perl -MConfig -e 'print $$Config{vendorlib}')
21
22 build: test build-stamp
23 build-stamp:
24         # Generate the main man page. All the perl cruft is to get a list
25         # of debhelper commands with short descriptions into the man page.
26         pod2man --section=7 -c Debhelper -r "$(VERSION)" debhelper.pod | \
27         perl -e ' \
28                 undef $$/; \
29                 foreach (@ARGV) { \
30                         open (IN, $$_) or die "$$_: $$!"; \
31                         $$file=<IN>; \
32                         close IN; \
33                         if ($$file=~m/=head1 NAME\n\n(.*?) - (.*?)\n/m) { \
34                                 $$collect.=".IP $$1(1)\n$$2\n"; \
35                         } \
36                 } \
37                 END { \
38                         while (<STDIN>) { \
39                                 s/#LIST#/$$collect/; \
40                                 print; \
41                         }; \
42                 }' `find . -type f -perm +1 -maxdepth 1 -name "dh_*" | sort` > debhelper.7
43         # Turn all executables into man pages.
44         find . -type f -perm +1 -maxdepth 1 -name "dh_*" \
45                 -exec pod2man -c Debhelper -r "$(VERSION)" {} {}.1 \;
46         printf "package Debian::Debhelper::Dh_Version;\n\$$version='$(VERSION)';" > \
47                 Debian/Debhelper/Dh_Version.pm
48
49         touch build-stamp
50
51 clean:
52         ./dh_testdir
53         ./dh_testroot
54         -./dh_clean *.1 *.7 *-stamp Debian/Debhelper/Dh_Version.pm
55
56 test: test-stamp
57 test-stamp:
58         ./dh_clean
59         DH_VERSION=10 perl -MTest::Harness -e 'runtests grep { ! /CVS/ } @ARGV' t/*
60         ./dh_clean
61         touch test-stamp
62
63 # Build architecture-dependent files here.
64 binary-arch: build
65 # Nothing to do.
66
67 # Build architecture-independent files here.
68 binary-indep: build
69         ./dh_testdir
70         ./dh_testroot
71         ./dh_clean -k
72         ./dh_install -X .1 dh_* usr/bin
73         ./dh_install Debian/Debhelper/*.pm $(PERLLIBDIR)/Debian/Debhelper/
74         ./dh_install autoscripts usr/share/debhelper
75         ./dh_installdocs doc/*
76         ./dh_installexamples examples/*
77         ./dh_installman *.1 *.7
78         ./dh_installchangelogs
79         ./dh_shlibdeps
80         ./dh_link
81         ./dh_compress
82         ./dh_fixperms
83         ./dh_perl
84         ./dh_installdeb
85         ./dh_gencontrol
86         ./dh_md5sums
87         ./dh_builddeb
88
89 # Update the debhelper web page. Not intended for use by anyone except the
90 # author.
91 DIR=/home/web/kitenet.net/programs/debhelper
92 installhook:
93         cp debian/changelog $(DIR)/CHANGES
94         echo -n $(VERSION) > $(DIR)/LATEST-VERSION-IS
95
96 binary: binary-indep binary-arch
97 .PHONY: build clean binary-indep binary-arch binary dist
98