c0ca8031ced686c11f5ed43d536e1bc607eec81e
[citadel.git] / citadel / debian / rules
1 #!/usr/bin/make -f
2
3 # Uncomment this to turn on verbose mode.
4 #export DH_VERBOSE=1
5
6 # This has to be exported to make some magic below work.
7 export DH_OPTIONS
8
9 DEB_DESTDIR = $(CURDIR)/debian/tmp
10
11 CFLAGS = -Wall -g
12
13
14 EXTRA_ARGS=
15 PROFILE_ARGS=
16 #to enable debugging: export DEB_BUILD_OPTIONS="debug profiling"
17 ifneq (,$(findstring profiling,$(DEB_BUILD_OPTIONS)))
18         PROFILE_ARGS= --with-gprof
19 endif
20 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
21         CFLAGS += -O0 -ggdb -rdynamic -D_GNU_SOURCE -MD -MP 
22         EXTRA_ARGS = --with-backtrace
23 else
24         CFLAGS += -O2
25 endif
26
27 configure: configure-stamp
28 configure-stamp:
29         dh_testdir
30
31         CFLAGS="$(CFLAGS)" ./configure \
32                 --with-prefix=/var/lib/citadel \
33                 --with-datadir=/var/lib/citadel \
34                 --with-staticdatadir=/usr/share/citadel-server \
35                 --with-spooldir=/var/spool/citadel \
36                 --with-sysconfdir=/etc/citadel \
37                 --with-rundir=/var/run/citadel \
38                 --with-docdir=/usr/share/doc/citadel-doc/ \
39                 --with-ssldir=/etc/ssl/citadel/ \
40                 --with-utility-bindir=/usr/lib/citadel-server/ \
41                 --with-pam \
42                 --with-db \
43                 --with-zlib \
44                 --with-ldap \
45                 --with-libical \
46                 --with-libsieve \
47                 --enable-debug $(EXTRA_ARGS) $(PROFILE_ARGS)
48
49         touch configure-stamp
50
51 #Architecture 
52 build: build-arch build-indep
53
54 build-arch: build-arch-stamp
55 build-arch-stamp: configure-stamp
56
57         $(MAKE)
58         touch $@
59
60 build-indep: build-indep-stamp
61 build-indep-stamp: configure-stamp
62
63         touch $@
64
65 clean:
66         dh_testdir
67         dh_testroot
68         rm -f build-arch-stamp build-indep-stamp configure-stamp
69
70         -$(MAKE) distclean
71
72         dh_clean 
73         rm -f config.status config.log
74
75 install: install-indep install-arch
76 install-indep:
77         dh_testdir
78         dh_testroot
79         dh_clean -k -i 
80         dh_installdirs -i
81
82         $(MAKE) DESTDIR=$(DEB_DESTDIR) install-doc-new
83
84         dh_install -i --sourcedir=debian/tmp
85
86 install-arch:
87         dh_testdir
88         dh_testroot
89         dh_clean -k -s 
90         dh_installdirs -s
91
92         $(MAKE) DESTDIR=$(DEB_DESTDIR) install-exec-new install-data-new
93
94         install -D -p -m0755 database_cleanup.sh \
95                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/examples/database_cleanup.sh
96
97         install -D -p -m0644 docs/welcomemail.html \
98                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.html
99
100         install -D -p -m0644 docs/welcomemail.txt \
101                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.txt
102
103         dh_install -s --sourcedir=debian/tmp
104
105 binary-common:
106         dh_testdir
107         dh_testroot
108         dh_installchangelogs
109         dh_installdocs
110         dh_installdebconf       
111         dh_installinit --name=citadel
112         dh_installman
113         dh_strip
114         dh_compress 
115         dh_fixperms
116         dh_makeshlibs
117         dh_installdeb
118         dh_shlibdeps
119         dh_gencontrol
120         dh_md5sums
121         dh_builddeb
122
123 # Build architecture independant packages using the common target.
124 binary-indep: build-indep install-indep
125         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
126
127 # Build architecture dependant packages using the common target.
128 binary-arch: build-arch install-arch
129         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
130
131 binary: binary-arch binary-indep
132 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure