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