609b58439f3b4256ca128eec45c9c55cf4876b41
[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
9 # These are used for cross-compiling and for saving the configure script
10 # from having to guess our platform (since we know it already)
11 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
12 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
13
14 CFLAGS = -Wall -g
15
16 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
17         CFLAGS += -O0 -ggdb
18 else
19         CFLAGS += -O2
20 endif
21
22 config.status: configure
23         dh_testdir
24         CFLAGS="$(CFLAGS)" ./configure \
25                 --host=$(DEB_HOST_GNU_TYPE) \
26                 --build=$(DEB_BUILD_GNU_TYPE) \
27                 --prefix=/usr/sbin \
28                 --with-sysconfdir=/etc/citadel \
29                 --with-spooldir=/var/spool/citadel \
30                 --with-datadir=/var/lib/citadel \
31                 --with-rundir=/var/run/citadel \
32                 --with-docdir=/usr/share/doc/citadel-doc/ \
33                 --with-pam \
34                 --with-libical \
35                 --with-libsieve \
36                 --with-db \
37                 --with-zlib \
38                 --with-ldap
39
40
41 #Architecture 
42 build: build-arch build-indep
43
44 build-arch: build-arch-stamp
45 build-arch-stamp:  config.status
46         touch build-arch-stamp
47
48 build-indep: build-indep-stamp
49 build-indep-stamp:  config.status
50         touch build-indep-stamp
51
52 clean:
53         dh_testdir
54         dh_testroot
55         rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#
56         -$(MAKE) distclean
57 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
58         cp -f /usr/share/misc/config.sub config.sub
59 endif
60 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
61         cp -f /usr/share/misc/config.guess config.guess
62 endif
63         dh_clean 
64
65 install: install-indep install-arch
66 install-indep:
67         dh_testdir
68         dh_testroot
69         dh_clean -k -i 
70         dh_installdirs -i
71         $(MAKE) -C . install-new DESTDIR="$(CURDIR)/debian/tmp" install-doc-new prefix=$(CURDIR)/debian/citadel-doc/
72
73
74 install-arch:
75         dh_testdir
76         dh_testroot
77         dh_clean -k -s 
78         dh_installdirs -s
79         mkdir -p  $(CURDIR)/debian/tmp/
80         $(MAKE) -C . install-new DESTDIR="$(CURDIR)/debian/tmp/" install-exec-new install-data-new
81
82         mkdir -p $(CURDIR)/debian/tmp/usr/lib/citadel-server
83         mv \
84                 $(CURDIR)/debian/tmp/usr/sbin/setup \
85                 $(CURDIR)/debian/tmp/usr/lib/citadel-server/
86         cp \
87                 $(CURDIR)/debian/tmp/usr/sbin/citmail \
88                 $(CURDIR)/debian/tmp/usr/sbin/sendmail
89
90         dh_install 
91
92 binary-common:
93         dh_testdir
94         dh_testroot
95         dh_installdocs
96         dh_installexamples
97         dh_installdebconf       
98         dh_installinit  --name=citadel
99         dh_installman
100         dh_strip
101         dh_compress 
102         dh_fixperms
103         dh_makeshlibs
104         dh_installdeb
105         dh_shlibdeps
106         dh_gencontrol
107         dh_md5sums
108         dh_builddeb
109
110 # Build architecture independant packages using the common target.
111 binary-indep: build-indep install-indep
112         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
113
114 # Build architecture dependant packages using the common target.
115 binary-arch: build-arch install-arch
116         $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
117
118 binary: binary-arch binary-indep
119 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch