Made doc-generation configuration automatic.
[privoxy.git] / debian / rules
1 #!/usr/bin/make -f
2 # Sample debian/rules that uses debhelper.
3 # GNU copyright 1997 to 1999 by Joey Hess.
4
5 # Uncomment this to turn on verbose mode.
6 #export DH_VERBOSE=1
7
8 # This is the debhelper compatibility version to use.
9 export DH_COMPAT=3
10
11 # These are used for cross-compiling and for saving the configure script
12 # from having to guess our platform (since we know it already)
13 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
14 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
15
16 DEBDIR=`pwd`/debian/privoxy
17
18 CFLAGS="-O2"
19 WITHDEBUG=""
20 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
21         CFLAGS += -g
22         WITHDEBUG="--with-debug"
23 endif
24
25 configure: configure-stamp
26 configure-stamp:
27         dh_testdir
28
29         autoheader
30         autoconf
31         env CFLAGS=$(CFLAGS) \
32                 ./configure --prefix=/usr --sysconfdir=/etc \
33                 --mandir=/usr/share/man $(WITHDEBUG)
34         touch configure-stamp
35
36 build: build-stamp
37 build-stamp: configure-stamp 
38         dh_testdir
39
40         $(MAKE)
41         touch build-stamp
42
43 clean:
44         dh_testdir
45         dh_testroot
46         rm -f build-stamp configure-stamp
47
48         -$(MAKE) clean
49         -$(MAKE) distclean
50         rm -f privoxy 
51         rm -f configure config.h GNUmakefile 
52         rm -f doc/source/ldp.dsl
53
54         dh_clean
55
56 install: build
57         dh_testdir
58         dh_testroot
59         dh_clean -k
60         dh_installdirs
61
62         install -m 0755 privoxy $(DEBDIR)/usr/sbin/privoxy
63
64         sed -e 's/^\(\(trust\|proxy\)-info-url\|admin-address\)/#\1/'  \
65             -e 's/^\(enable-\(edit-actions\|remote-toggle\)\)/#\1/' \
66             -e 's#^confdir \.#confdir /etc/privoxy#' \
67             -e 's#^logdir \.#logdir /var/log/privoxy#' \
68                 < config > $(DEBDIR)/etc/privoxy/config
69         install -m 0644 default.action $(DEBDIR)/etc/privoxy/default.action
70         install -m 0644 standard.action $(DEBDIR)/etc/privoxy/standard.action
71         install -m 0644 user.action $(DEBDIR)/etc/privoxy/user.action
72         install -m 0644 default.filter $(DEBDIR)/etc/privoxy/default.filter
73         install -m 0644 trust $(DEBDIR)/etc/privoxy/trust
74
75         cp -r templates $(DEBDIR)/etc/privoxy/
76         rm -f $(DEBDIR)/etc/privoxy/templates/*~
77         rm -rf $(DEBDIR)/etc/privoxy/templates/CVS
78
79
80 # Build architecture-independent files here.
81 binary-indep: build install
82 # We have nothing to do by default.
83
84 # Build architecture-dependent files here.
85 binary-arch: build install
86         dh_testdir
87         dh_testroot
88 #       dh_installdebconf       
89         dh_installdocs -XCVS
90         dh_installexamples
91         dh_installmenu
92         dh_installlogrotate
93 #       dh_installemacsen
94 #       dh_installpam
95 #       dh_installmime
96         dh_installinit
97         dh_installcron
98         dh_installman
99         dh_installinfo
100 #       dh_undocumented
101         dh_installchangelogs ChangeLog
102         dh_link
103         dh_strip
104         dh_compress
105         dh_fixperms
106 #       dh_makeshlibs
107         dh_installdeb
108 #       dh_perl
109         dh_shlibdeps
110         dh_gencontrol
111         dh_md5sums
112         dh_builddeb
113
114 # Single step doc building on debian
115 debian-dok: configure-stamp
116         $(MAKE) dok
117
118 binary: binary-indep binary-arch
119 .PHONY: build clean binary-indep binary-arch binary install configure debian-dok