* more changes towards the debian.org packaging.
[citadel.git] / citadel / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
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 DEB_DESTDIR = $(CURDIR)/debian/tmp
9 CFLAGS = -Wall -g
10
11 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
12         CFLAGS += -O0 -ggdb
13 else
14         CFLAGS += -O2
15 endif
16
17 configure: configure-stamp
18 configure-stamp:
19         dh_testdir
20         CFLAGS="$(CFLAGS)" ./configure \
21                 --prefix=/usr/sbin \
22                 --with-datadir=/var/lib/citadel \
23                 --with-spooldir=/var/spool/citadel \
24                 --with-sysconfdir=/etc/citadel \
25                 --with-rundir=/var/run/citadel \
26                 --with-docdir=/usr/share/doc/citadel-doc/ \
27                 --with-pam \
28                 --with-db \
29                 --with-zlib \
30                 --with-ldap \
31                 --with-libical \
32                 --with-libsieve
33
34         touch configure-stamp
35
36 #Architecture 
37 build: build-arch build-indep
38
39 build-arch: build-arch-stamp
40 build-arch-stamp: configure-stamp
41
42         $(MAKE)
43         touch $@
44
45 build-indep: build-indep-stamp
46 build-indep-stamp: configure-stamp
47         touch $@
48
49 clean:
50         dh_testdir
51         dh_testroot
52         rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#
53         -$(MAKE) distclean
54
55         dh_clean 
56
57 install: install-indep install-arch
58 install-indep:
59         dh_testdir
60         dh_testroot
61         dh_clean -k -i 
62         dh_installdirs -i
63         $(MAKE) DESTDIR=$(DEB_DESTDIR) install-doc-new
64         dh_install -i --sourcedir=debian/tmp
65
66 install-arch:
67         dh_testdir
68         dh_testroot
69         dh_clean -k -s 
70         dh_installdirs -s
71         $(MAKE) DESTDIR=$(DEB_DESTDIR) install-exec-new install-data-new
72
73
74         mkdir -p $(DEB_DESTDIR)/usr/lib/citadel-server
75         mv $(DEB_DESTDIR)/usr/sbin/setup \
76            $(DEB_DESTDIR)/usr/lib/citadel-server/
77         cp $(DEB_DESTDIR)/usr/sbin/citmail \
78            $(DEB_DESTDIR)/usr/sbin/sendmail
79
80         mkdir -p $(DEB_DESTDIR)/usr/share/doc/citadel-server/
81         mv $(DEB_DESTDIR)/usr/share/doc/citadel-doc/database_cleanup.sh \
82                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/
83
84         dh_install -s --sourcedir=debian/tmp
85
86 binary-common:
87         dh_testdir
88         dh_testroot
89         dh_installchangelogs
90         dh_installdocs
91         dh_installdebconf       
92         dh_installinit --name=citadel
93         dh_installman
94         dh_strip
95         dh_compress 
96         dh_fixperms
97         dh_makeshlibs
98         dh_installdeb
99         dh_shlibdeps
100         dh_gencontrol
101         dh_md5sums
102         dh_builddeb
103
104 # Build architecture independant packages using the common target.
105 binary-indep: build-indep install-indep
106         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
107
108 # Build architecture dependant packages using the common target.
109 binary-arch: build-arch install-arch
110         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
111
112 binary: binary-arch binary-indep
113 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure