]> git.donarmstrong.com Git - debhelper.git/blob - debian/rules
bc83ec50265210ce5ec7660714a502b49197ff6c
[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 25 lines 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 # Use most recent compatability level.
18 export DH_COMPAT=3
19
20 # Figure out the current debhelper version.
21 VERSION=$(shell expr "`dpkg-parsechangelog 2>/dev/null |grep Version:`" : '.*Version: \(.*\)')
22
23 PERLLIBDIR=$(shell perl -MConfig -e 'print $$Config{vendorlib}')
24
25 # Debug
26 #export DH_VERBOSE=1
27
28 build: test build-stamp
29 build-stamp:
30         # Generate the main man page. All the perl cruft is to get a list
31         # of debhelper commands with short descriptions into the man page.
32         pod2man -c Debhelper -r "$(VERSION)" debhelper.pod | \
33         perl -e ' \
34                 undef $$/; \
35                 foreach (@ARGV) { \
36                         open (IN, $$_) or die "$$_: $$!"; \
37                         $$file=<IN>; \
38                         close IN; \
39                         if ($$file=~m/=head1 NAME\n\n(.*?) - (.*?)\n/m) { \
40                                 $$collect.=".IP $$1(1)\n$$2\n"; \
41                         } \
42                 } \
43                 END { \
44                         while (<STDIN>) { \
45                                 s/#LIST#/$$collect/; \
46                                 print; \
47                         }; \
48                 }' `find . -type f -perm +1 -maxdepth 1 -name "dh_*" | sort` > debhelper.1
49         # Turn all executables into man pages.
50         find . -type f -perm +1 -maxdepth 1 -name "dh_*" \
51                 -exec pod2man -c Debhelper -r "$(VERSION)" {} {}.1 \;
52         touch build-stamp
53
54 clean:
55         ./dh_testdir
56         ./dh_testroot
57         -./dh_clean *.1 *-stamp
58
59 test: test-stamp
60 test-stamp:
61         ./dh_clean
62         DH_VERSION=10 perl -MTest::Harness -e 'runtests grep { ! /CVS/ } @ARGV' t/*
63         ./dh_clean
64         touch test-stamp
65
66 # Build architecture-dependent files here.
67 binary-arch: build
68 # Nothing to do.
69
70 # Build architecture-independent files here.
71 binary-indep: build
72         ./dh_testdir
73         ./dh_testroot
74         ./dh_clean -k
75         ./dh_installdirs usr/bin usr/share/debhelper \
76                 $(PERLLIBDIR)/Debian/Debhelper
77
78         printf "package Debian::Debhelper::Dh_Version;\n\$$version='$(VERSION)';" > \
79                 debian/debhelper/$(PERLLIBDIR)/Debian/Debhelper/Dh_Version.pm
80
81         find . -perm +111 -maxdepth 1 -type f -not -name "*.pl" \
82                 -exec install -p {} debian/debhelper/usr/bin \;
83         cp -a Debian/Debhelper/*.pm \
84                 debian/debhelper/$(PERLLIBDIR)/Debian/Debhelper/
85         cp -a autoscripts debian/debhelper/usr/share/debhelper
86         rm -rf debian/debhelper/usr/share/debhelper/autoscripts/CVS
87
88         ./dh_installdocs `find doc -type f | grep -v CVS`
89         ./dh_installexamples `find examples -type f | grep -v CVS`
90         ./dh_installmenu
91         ./dh_installman *.1
92         ./dh_installinfo
93         ./dh_installchangelogs
94         ./dh_link
95         ./dh_compress
96         ./dh_fixperms
97         ./dh_perl
98         ./dh_installdeb
99         ./dh_gencontrol
100         ./dh_md5sums
101         ./dh_builddeb
102
103 # Update the debhelper web page. Not intended for use by anyone except the
104 # author.
105 installhook:
106         cp debian/changelog /home/pub/programs/debhelper/CHANGES
107         echo -n $(VERSION) > /home/pub/programs/debhelper/LATEST-VERSION-IS
108
109 binary: binary-indep binary-arch
110 .PHONY: build clean binary-indep binary-arch binary dist
111