]> code.citadel.org Git - citadel.git/blob - citadel/debian/rules
fix source so that '-Wformat -Werror=format-security' doesn't stop us from compiling
[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 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
8 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
9
10 export DH_OPTIONS
11
12 DEB_DESTDIR = $(CURDIR)/debian/tmp
13
14 CFLAGS = -Wall -g -Werror=format-security 
15
16
17 EXTRA_ARGS=
18 PROFILE_ARGS=
19 #to enable debugging: export DEB_BUILD_OPTIONS="debug profiling threadoff rss gcov"
20 ifneq (,$(findstring profiling,$(DEB_BUILD_OPTIONS)))
21         PROFILE_ARGS= --with-gprof
22 endif
23
24 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
25         CFLAGS += -O0 -ggdb -rdynamic -D_GNU_SOURCE -MD -MP -D TECH_PREVIEW
26         LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed
27         EXTRA_ARGS = --with-backtrace
28 else
29         LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed
30         CFLAGS += -O2
31 endif
32
33 ifneq (,$(findstring backtrace,$(DEB_BUILD_OPTIONS)))
34         CFLAGS+= -rdynamic -D_GNU_SOURCE -MD -MP
35         LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed
36         EXTRA_ARGS += --with-backtrace
37 endif
38
39 ifneq (,$(findstring threadoff,$(DEB_BUILD_OPTIONS)))
40         THREAD_ARGS=--without-threaded-client
41         CFLAGS += -D WITH_THREADLOG
42 else
43         THREAD_ARGS=
44 endif
45
46
47 ifneq (,$(findstring rss,$(DEB_BUILD_OPTIONS)))
48         CFLAGS += -D DEBUG_RSS
49 endif
50
51 ifneq (,$(findstring iodbg,$(DEB_BUILD_OPTIONS)))
52         CFLAGS += -D BIGBAD_IODBG
53 endif
54
55 ifneq (,$(findstring gcov,$(DEB_BUILD_OPTIONS)))
56         CFLAGS += -fprofile-arcs -ftest-coverage
57         LDFLAGS += -fprofile-arcs -ftest-coverage
58 endif
59
60 configure: configure-stamp
61 configure-stamp:
62         dh_testdir
63
64         LDFLAGS="$(LDFLAGS)"; CFLAGS="$(CFLAGS)" ./configure \
65                 --prefix=/var/lib/citadel/ \
66                 --with-datadir=/var/lib/citadel/ \
67                 --with-helpdir=/usr/share/citadel-server/ \
68                 --with-staticdatadir=/etc/citadel/ \
69                 --with-spooldir=/var/spool/citadel/ \
70                 --with-sysconfdir=/etc/citadel/ \
71                 --with-rundir=/var/run/citadel/ \
72                 --with-docdir=/usr/share/doc/citadel-doc/ \
73                 --with-ssldir=/etc/ssl/citadel/ \
74                 --with-utility-bindir=/usr/lib/citadel-server/ \
75                 --with-autosysconfdir=/var/lib/citadel/data/ \
76                 --with-localedir=/usr/share/ \
77                 --with-pam \
78                 --with-db \
79                 --enable-debug $(EXTRA_ARGS) $(PROFILE_ARGS) $(THREAD_ARGS)
80
81         touch configure-stamp
82
83 #Architecture 
84 build: build-arch build-indep
85
86 build-arch: build-arch-stamp
87 build-arch-stamp: configure-stamp
88
89         $(MAKE)
90         touch $@
91
92 build-indep: build-indep-stamp
93 build-indep-stamp: configure-stamp
94
95         touch $@
96
97 clean:
98         dh_testdir
99         dh_testroot
100         rm -f build-arch-stamp build-indep-stamp configure-stamp
101
102
103         dh_clean 
104         rm -f config.status config.log
105 #[ ! -f Makefile ] || $(MAKE) distclean
106
107 install: install-indep install-arch
108 install-indep: build-indep
109         dh_testdir
110         dh_testroot
111         dh_clean -k -i 
112         dh_installdirs -i
113
114         $(MAKE) DESTDIR=$(DEB_DESTDIR) install-doc-new
115
116         dh_install -i --sourcedir=debian/tmp
117
118 install-arch: build-arch
119         dh_testdir
120         dh_testroot
121         dh_clean -k -s 
122         dh_installdirs -s
123
124         $(MAKE) install-locale DESTDIR=$(DEB_DESTDIR)
125         $(MAKE) DESTDIR=$(DEB_DESTDIR) install-exec-new install-data-new
126
127         install -D -p -m0755 database_cleanup.sh \
128                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/examples/database_cleanup.sh
129
130         install -D -p -m0644 docs/welcomemail.html \
131                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.html
132
133         install -D -p -m0644 docs/welcomemail.txt \
134                 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.txt
135
136         dh_install -s --sourcedir=debian/tmp
137
138 binary-common:
139         dh_testdir
140         dh_testroot
141         dh_installchangelogs
142         dh_installdocs
143         dh_installdebconf       
144         dh_installinit --name=citadel
145         dh_installman
146         dh_strip --dbg-package=citadel-dbg
147         dh_link
148         dh_compress 
149         dh_fixperms
150         dh_makeshlibs
151         dh_installdeb
152         dh_shlibdeps
153         dh_gencontrol
154         dh_md5sums
155         dh_builddeb
156
157 # Build architecture independant packages using the common target.
158 binary-indep: build-indep install-indep
159         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
160
161 # Build architecture dependant packages using the common target.
162 binary-arch: build-arch install-arch
163         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
164
165 binary: binary-arch binary-indep
166 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure