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"
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
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 iodbg,$(DEB_BUILD_OPTIONS)))
58 CFLAGS += -D BIGBAD_IODBG
61 ifneq (,$(findstring gcov,$(DEB_BUILD_OPTIONS)))
62 CFLAGS += -fprofile-arcs -ftest-coverage
63 LDFLAGS += -fprofile-arcs -ftest-coverage
66 configure: configure-stamp
70 CC=$(COMPILER); LDFLAGS="$(LDFLAGS)"; CFLAGS="$(CFLAGS)" ./configure \
71 --prefix=/var/lib/citadel/ \
72 --with-datadir=/var/lib/citadel/ \
73 --with-helpdir=/usr/share/citadel-server/ \
74 --with-staticdatadir=/etc/citadel/ \
75 --with-spooldir=/var/spool/citadel/ \
76 --with-sysconfdir=/etc/citadel/ \
77 --with-rundir=/var/run/citadel/ \
78 --with-docdir=/usr/share/doc/citadel-doc/ \
79 --with-ssldir=/etc/ssl/citadel/ \
80 --with-utility-bindir=/usr/lib/citadel-server/ \
81 --with-autosysconfdir=/var/lib/citadel/data/ \
82 --with-localedir=/usr/share/ \
85 --enable-debug $(EXTRA_ARGS) $(PROFILE_ARGS) $(THREAD_ARGS)
90 build: build-arch build-indep
92 build-arch: build-arch-stamp
93 build-arch-stamp: configure-stamp
98 build-indep: build-indep-stamp
99 build-indep-stamp: configure-stamp
106 rm -f build-arch-stamp build-indep-stamp configure-stamp
110 rm -f config.status config.log
111 #[ ! -f Makefile ] || $(MAKE) distclean
113 install: install-indep install-arch
114 install-indep: build-indep
120 $(MAKE) DESTDIR=$(DEB_DESTDIR) install-doc-new
122 dh_install -i --sourcedir=debian/tmp
124 install-arch: build-arch
130 $(MAKE) install-locale DESTDIR=$(DEB_DESTDIR)
131 $(MAKE) DESTDIR=$(DEB_DESTDIR) install-exec-new install-data-new
133 install -D -p -m0755 database_cleanup.sh \
134 $(DEB_DESTDIR)/usr/share/doc/citadel-server/examples/database_cleanup.sh
136 install -D -p -m0644 docs/welcomemail.html \
137 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.html
139 install -D -p -m0644 docs/welcomemail.txt \
140 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.txt
142 dh_install -s --sourcedir=debian/tmp
150 dh_installinit --name=citadel
152 dh_strip --dbg-package=citadel-dbg
163 # Build architecture independant packages using the common target.
164 binary-indep: build-indep install-indep
165 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
167 # Build architecture dependant packages using the common target.
168 binary-arch: build-arch install-arch
169 $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
171 binary: binary-arch binary-indep
172 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure