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 = `dpkg-buildflags --get CFLAGS`
17
LDFLAGS_DEF = `dpkg-buildflags --get LDFLAGS`
18
CPPFLAGS_DEF = `dpkg-buildflags --get CPPFLAGS`
22
#to enable debugging: export DEB_BUILD_OPTIONS="debug profiling threadoff"
23
ifneq (,$(findstring profiling,$(DEB_BUILD_OPTIONS)))
24
PROFILE_ARGS= --with-gprof
26
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
27
CFLAGS += -O0 -ggdb -rdynamic -D_GNU_SOURCE -MD -MP -D TECH_PREVIEW
28
LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed
29
EXTRA_ARGS = --with-backtrace
30
ifneq (,$(findstring event,$(DEB_BUILD_OPTIONS)))
31
EXTRA_ARGS = --with-backtrace
34
LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed
38
ifneq (,$(findstring backtrace,$(DEB_BUILD_OPTIONS)))
39
CFLAGS+= -rdynamic -D_GNU_SOURCE -MD -MP
40
LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed
41
EXTRA_ARGS += --with-backtrace
44
ifneq (,$(findstring threadoff,$(DEB_BUILD_OPTIONS)))
45
THREAD_ARGS=--without-threaded-client
46
CFLAGS += -D WITH_THREADLOG
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
override_dh_auto_configure:
63
CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS_DEF)" LDFLAGS="$(LDFLAGS_DEF)" ./configure \
64
--prefix=/var/lib/citadel \
65
--with-datadir=/var/lib/citadel \
66
--with-helpdir=/usr/share/citadel-server \
67
--with-staticdatadir=/etc/citadel \
68
--with-spooldir=/var/spool/citadel \
69
--with-sysconfdir=/etc/citadel \
70
--with-rundir=/var/run/citadel \
71
--with-docdir=/usr/share/doc/citadel-doc/ \
72
--with-ssldir=/etc/ssl/citadel/ \
73
--with-utility-bindir=/usr/lib/citadel-server/ \
74
--with-autosysconfdir=/var/lib/citadel/data/ \
76
$(EXTRA_ARGS) $(PROFILE_ARGS) $(THREAD_ARGS)
78
override_dh_auto_clean:
81
-rm -f build-arch-stamp build-indep-stamp configure-stamp
82
-rm -f config.status config.log src/*.o
84
override_dh_auto_install:
90
$(MAKE) DESTDIR=$(DEB_DESTDIR) install-doc-new install-exec-new install-data-new
92
override_dh_installinit:
93
dh_installinit --name=citadel --restart-after-upgrade