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
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
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 --with-experimental_eventsmtp
34 LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed
38 ifneq (,$(findstring threadoff,$(DEB_BUILD_OPTIONS)))
39 THREAD_ARGS=--without-threaded-client
40 CFLAGS += -D WITH_THREADLOG
46 ifneq (,$(findstring rss,$(DEB_BUILD_OPTIONS)))
47 CFLAGS += -D DEBUG_RSS
50 ifneq (,$(findstring iodbg,$(DEB_BUILD_OPTIONS)))
51 CFLAGS += -D BIGBAD_IODBG
54 ifneq (,$(findstring gcov,$(DEB_BUILD_OPTIONS)))
55 CFLAGS += -fprofile-arcs -ftest-coverage
56 LDFLAGS += -fprofile-arcs -ftest-coverage
59 configure: configure-stamp
63 CC=$(COMPILER); LDFLAGS="$(LDFLAGS)"; CFLAGS="$(CFLAGS)" ./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/ \
75 --with-localedir=/usr/share/ \
78 --enable-debug $(EXTRA_ARGS) $(PROFILE_ARGS) $(THREAD_ARGS)
83 build: build-arch build-indep
85 build-arch: build-arch-stamp
86 build-arch-stamp: configure-stamp
91 build-indep: build-indep-stamp
92 build-indep-stamp: configure-stamp
99 rm -f build-arch-stamp build-indep-stamp configure-stamp
103 rm -f config.status config.log
104 #[ ! -f Makefile ] || $(MAKE) distclean
106 install: install-indep install-arch
107 install-indep: build-indep
113 $(MAKE) DESTDIR=$(DEB_DESTDIR) install-doc-new
115 dh_install -i --sourcedir=debian/tmp
117 install-arch: build-arch
123 $(MAKE) install-locale DESTDIR=$(DEB_DESTDIR)
124 $(MAKE) DESTDIR=$(DEB_DESTDIR) install-exec-new install-data-new
126 install -D -p -m0755 database_cleanup.sh \
127 $(DEB_DESTDIR)/usr/share/doc/citadel-server/examples/database_cleanup.sh
129 install -D -p -m0644 docs/welcomemail.html \
130 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.html
132 install -D -p -m0644 docs/welcomemail.txt \
133 $(DEB_DESTDIR)/usr/share/doc/citadel-server/welcomemail.txt
135 dh_install -s --sourcedir=debian/tmp
143 dh_installinit --name=citadel
145 dh_strip --dbg-package=citadel-dbg
156 # Build architecture independant packages using the common target.
157 binary-indep: build-indep install-indep
158 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
160 # Build architecture dependant packages using the common target.
161 binary-arch: build-arch install-arch
162 $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
164 binary: binary-arch binary-indep
165 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure