3 # Uncomment this to turn on verbose mode.
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)
12 DEB_DESTDIR = $(CURDIR)/debian/tmp
14 CFLAGS = -Wall -g -Werror=format-security
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
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
29 LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed
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
39 ifneq (,$(findstring threadoff,$(DEB_BUILD_OPTIONS)))
40 THREAD_ARGS=--without-threaded-client
41 CFLAGS += -D WITH_THREADLOG
47 ifneq (,$(findstring rss,$(DEB_BUILD_OPTIONS)))
48 CFLAGS += -D DEBUG_RSS
51 ifneq (,$(findstring iodbg,$(DEB_BUILD_OPTIONS)))
52 CFLAGS += -D BIGBAD_IODBG
55 ifneq (,$(findstring gcov,$(DEB_BUILD_OPTIONS)))
56 CFLAGS += -fprofile-arcs -ftest-coverage
57 LDFLAGS += -fprofile-arcs -ftest-coverage
60 configure: configure-stamp
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/ \
79 --enable-debug $(EXTRA_ARGS) $(PROFILE_ARGS) $(THREAD_ARGS)
84 build: build-arch build-indep
86 build-arch: build-arch-stamp
87 build-arch-stamp: configure-stamp
92 build-indep: build-indep-stamp
93 build-indep-stamp: configure-stamp
100 rm -f build-arch-stamp build-indep-stamp configure-stamp
104 rm -f config.status config.log
105 #[ ! -f Makefile ] || $(MAKE) distclean
107 install: install-indep install-arch
108 install-indep: build-indep
114 $(MAKE) DESTDIR=$(DEB_DESTDIR) install-doc-new
116 dh_install -i --sourcedir=debian/tmp
118 install-arch: build-arch
124 $(MAKE) install-locale DESTDIR=$(DEB_DESTDIR)
125 $(MAKE) DESTDIR=$(DEB_DESTDIR) install-exec-new install-data-new
127 install -D -p -m0755 database_cleanup.sh \
128 $(DEB_DESTDIR)/usr/share/doc/citadel-server/examples/database_cleanup.sh
130 install -D -p -m0644 docs/welcomemail.html \
131 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.html
133 install -D -p -m0644 docs/welcomemail.txt \
134 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.txt
136 dh_install -s --sourcedir=debian/tmp
144 dh_installinit --name=citadel
146 dh_strip --dbg-package=citadel-dbg
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
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
165 binary: binary-arch binary-indep
166 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure