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
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
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
52 ifneq (,$(findstring iodbg,$(DEB_BUILD_OPTIONS)))
53 CFLAGS += -D BIGBAD_IODBG
56 ifneq (,$(findstring gcov,$(DEB_BUILD_OPTIONS)))
57 CFLAGS += -fprofile-arcs -ftest-coverage
58 LDFLAGS += -fprofile-arcs -ftest-coverage
61 configure: configure-stamp
65 export CC=$(COMPILER); export LDFLAGS="$(LDFLAGS)"; export CFLAGS="$(CFLAGS)"; ./configure \
66 --prefix=/var/lib/citadel/ \
67 --with-datadir=/var/lib/citadel/ \
68 --with-helpdir=/usr/share/citadel-server/ \
69 --with-staticdatadir=/etc/citadel/ \
70 --with-spooldir=/var/spool/citadel/ \
71 --with-sysconfdir=/etc/citadel/ \
72 --with-rundir=/var/run/citadel/ \
73 --with-docdir=/usr/share/doc/citadel-doc/ \
74 --with-ssldir=/etc/ssl/citadel/ \
75 --with-utility-bindir=/usr/lib/citadel-server/ \
76 --with-autosysconfdir=/var/lib/citadel/data/ \
77 --with-localedir=/usr/share/ \
80 --enable-debug $(EXTRA_ARGS) $(PROFILE_ARGS) $(THREAD_ARGS)
85 build: build-arch build-indep
87 build-arch: build-arch-stamp
88 build-arch-stamp: configure-stamp
93 build-indep: build-indep-stamp
94 build-indep-stamp: configure-stamp
101 rm -f build-arch-stamp build-indep-stamp configure-stamp
105 rm -f config.status config.log
106 #[ ! -f Makefile ] || $(MAKE) distclean
108 install: install-indep install-arch
109 install-indep: build-indep
115 $(MAKE) DESTDIR=$(DEB_DESTDIR) install-doc-new
117 dh_install -i --sourcedir=debian/tmp
119 install-arch: build-arch
125 $(MAKE) install-locale DESTDIR=$(DEB_DESTDIR)
126 $(MAKE) DESTDIR=$(DEB_DESTDIR) install-exec-new install-data-new
128 dh_install -s --sourcedir=debian/tmp
136 dh_installinit --name=textclient
138 dh_strip --dbg-package=citadel-textclient-dbg
149 # Build architecture independant packages using the common target.
150 binary-indep: build-indep install-indep
151 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
153 # Build architecture dependant packages using the common target.
154 binary-arch: build-arch install-arch
155 $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
157 binary: binary-arch binary-indep
158 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure