* some cleanup and debian code beautification (tab/space/indentation)
[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         mkdir -p $(DEB_DESTDIR)/usr/lib/citadel-server
81         mv $(DEB_DESTDIR)/usr/sbin/setup \
82                 $(DEB_DESTDIR)/usr/lib/citadel-server/
83
84         mkdir -p $(DEB_DESTDIR)/usr/share/doc/citadel-server/
85         mv $(DEB_DESTDIR)/usr/share/doc/citadel-doc/database_cleanup.sh \
86                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/
87
88         dh_install -s --sourcedir=debian/tmp
89
90 binary-common:
91         dh_testdir
92         dh_testroot
93         dh_installchangelogs
94         dh_installdocs
95         dh_installdebconf       
96         dh_installinit --name=citadel
97         dh_installman
98         dh_strip
99         dh_compress 
100         dh_fixperms
101         dh_makeshlibs
102         dh_installdeb
103         dh_shlibdeps
104         dh_gencontrol
105         dh_md5sums
106         dh_builddeb
107
108 # Build architecture independant packages using the common target.
109 binary-indep: build-indep install-indep
110         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
111
112 # Build architecture dependant packages using the common target.
113 binary-arch: build-arch install-arch
114         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
115
116 binary: binary-arch binary-indep
117 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure