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 clang cares"
20 ifneq (,$(findstring clang,$(DEB_BUILD_OPTIONS)))
23 ifneq (,$(findstring profiling,$(DEB_BUILD_OPTIONS)))
24 PROFILE_ARGS= --with-gprof
27 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
28 CFLAGS += -O0 -ggdb -rdynamic -D_GNU_SOURCE -MD -MP -D TECH_PREVIEW -Wcast-align
29 LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed
30 EXTRA_ARGS = --with-backtrace
31 ifneq (,$(findstring event,$(DEB_BUILD_OPTIONS)))
32 EXTRA_ARGS = --with-backtrace --with-experimental_eventsmtp
35 LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed
39 ifneq (,$(findstring backtrace,$(DEB_BUILD_OPTIONS)))
40 CFLAGS+= -rdynamic -D_GNU_SOURCE -MD -MP
41 LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed
42 EXTRA_ARGS += --with-backtrace
45 ifneq (,$(findstring threadoff,$(DEB_BUILD_OPTIONS)))
46 THREAD_ARGS=--without-threaded-client
47 CFLAGS += -D WITH_THREADLOG
53 ifneq (,$(findstring rss,$(DEB_BUILD_OPTIONS)))
54 CFLAGS += -D DEBUG_RSS
57 ifneq (,$(findstring cares,$(DEB_BUILD_OPTIONS)))
58 CFLAGS += -D DEBUG_CARES
61 ifneq (,$(findstring iodbg,$(DEB_BUILD_OPTIONS)))
62 CFLAGS += -D BIGBAD_IODBG -D LDAP_INITIALIZE
65 ifneq (,$(findstring gcov,$(DEB_BUILD_OPTIONS)))
66 CFLAGS += -fprofile-arcs -ftest-coverage
67 LDFLAGS += -fprofile-arcs -ftest-coverage
70 configure: configure-stamp
74 export CC=$(COMPILER); export LDFLAGS="$(LDFLAGS)"; export CFLAGS="$(CFLAGS)"; ./configure \
75 --prefix=/var/lib/citadel/ \
76 --with-datadir=/var/lib/citadel/ \
77 --with-helpdir=/usr/share/citadel-server/ \
78 --with-staticdatadir=/etc/citadel/ \
79 --with-spooldir=/var/spool/citadel/ \
80 --with-sysconfdir=/etc/citadel/ \
81 --with-rundir=/var/run/citadel/ \
82 --with-docdir=/usr/share/doc/citadel-doc/ \
83 --with-ssldir=/etc/ssl/citadel/ \
84 --with-utility-bindir=/usr/lib/citadel-server/ \
85 --with-autosysconfdir=/var/lib/citadel/data/ \
86 --with-localedir=/usr/share/ \
89 --enable-debug $(EXTRA_ARGS) $(PROFILE_ARGS) $(THREAD_ARGS)
94 build: build-arch build-indep
96 build-arch: build-arch-stamp
97 build-arch-stamp: configure-stamp
102 build-indep: build-indep-stamp
103 build-indep-stamp: configure-stamp
110 rm -f build-arch-stamp build-indep-stamp configure-stamp
114 rm -f config.status config.log
115 #[ ! -f Makefile ] || $(MAKE) distclean
117 install: install-indep install-arch
118 install-indep: build-indep
124 $(MAKE) DESTDIR=$(DEB_DESTDIR) install-doc-new
126 dh_install -i --sourcedir=debian/tmp
128 install-arch: build-arch
134 $(MAKE) install-locale DESTDIR=$(DEB_DESTDIR)
135 $(MAKE) DESTDIR=$(DEB_DESTDIR) install-exec-new install-data-new
137 install -D -p -m0755 database_cleanup.sh \
138 $(DEB_DESTDIR)/usr/share/doc/citadel-server/examples/database_cleanup.sh
140 install -D -p -m0644 docs/welcomemail.html \
141 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.html
143 install -D -p -m0644 docs/welcomemail.txt \
144 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.txt
146 dh_install -s --sourcedir=debian/tmp
154 dh_installinit --name=citadel
156 dh_strip --dbg-package=citadel-dbg
167 # Build architecture independant packages using the common target.
168 binary-indep: build-indep install-indep
169 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
171 # Build architecture dependant packages using the common target.
172 binary-arch: build-arch install-arch
173 $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
175 binary: binary-arch binary-indep
176 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure