Added a comma after each msgnum exported. The parser was globbing them all together...
[citadel.git] / textclient / debian / rules
1 #!/usr/bin/make -f
2
3 # Uncomment this to turn on verbose mode.
4 #export DH_VERBOSE=1
5
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)
9
10 export DH_OPTIONS
11
12 DEB_DESTDIR = $(CURDIR)/debian/tmp
13
14 CFLAGS = -Wall -g -Werror=format-security 
15
16 COMPILER=
17 EXTRA_ARGS=
18 PROFILE_ARGS=
19 #to enable debugging: export DEB_BUILD_OPTIONS="debug profiling threadoff rss gcov clang cares"
20 ifneq (,$(findstring clang,$(DEB_BUILD_OPTIONS)))
21         COMPILER="clang" 
22 endif
23 ifneq (,$(findstring profiling,$(DEB_BUILD_OPTIONS)))
24         PROFILE_ARGS= --with-gprof
25 endif
26
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
33         endif
34 else
35         LDFLAGS+=-Wl,--no-undefined -Wl,--as-needed
36         CFLAGS += -O2
37 endif
38
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
43 endif
44
45 ifneq (,$(findstring threadoff,$(DEB_BUILD_OPTIONS)))
46         THREAD_ARGS=--without-threaded-client
47         CFLAGS += -D WITH_THREADLOG
48 else
49         THREAD_ARGS=
50 endif
51
52 ifneq (,$(findstring iodbg,$(DEB_BUILD_OPTIONS)))
53         CFLAGS += -D BIGBAD_IODBG
54 endif
55
56 ifneq (,$(findstring gcov,$(DEB_BUILD_OPTIONS)))
57         CFLAGS += -fprofile-arcs -ftest-coverage
58         LDFLAGS += -fprofile-arcs -ftest-coverage
59 endif
60
61 configure: configure-stamp
62 configure-stamp:
63         dh_testdir
64
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/ \
78                 --with-pam \
79                 --with-db \
80                 --enable-debug $(EXTRA_ARGS) $(PROFILE_ARGS) $(THREAD_ARGS)
81
82         touch configure-stamp
83
84 #Architecture 
85 build: build-arch build-indep
86
87 build-arch: build-arch-stamp
88 build-arch-stamp: configure-stamp
89
90         $(MAKE)
91         touch $@
92
93 build-indep: build-indep-stamp
94 build-indep-stamp: configure-stamp
95
96         touch $@
97
98 clean:
99         dh_testdir
100         dh_testroot
101         rm -f build-arch-stamp build-indep-stamp configure-stamp
102
103
104         dh_clean 
105         rm -f config.status config.log
106 #[ ! -f Makefile ] || $(MAKE) distclean
107
108 install: install-indep install-arch
109 install-indep: build-indep
110         dh_testdir
111         dh_testroot
112         dh_clean -k -i 
113         dh_installdirs -i
114
115         $(MAKE) DESTDIR=$(DEB_DESTDIR) install-doc-new
116
117         dh_install -i --sourcedir=debian/tmp
118
119 install-arch: build-arch
120         dh_testdir
121         dh_testroot
122         dh_clean -k -s 
123         dh_installdirs -s
124
125         $(MAKE) install-locale DESTDIR=$(DEB_DESTDIR)
126         $(MAKE) DESTDIR=$(DEB_DESTDIR) install-exec-new install-data-new
127
128         dh_install -s --sourcedir=debian/tmp
129
130 binary-common:
131         dh_testdir
132         dh_testroot
133         dh_installchangelogs
134         dh_installdocs
135         dh_installdebconf       
136         dh_installinit --name=textclient
137         dh_installman
138         dh_strip --dbg-package=citadel-textclient-dbg
139         dh_link
140         dh_compress 
141         dh_fixperms
142         dh_makeshlibs
143         dh_installdeb
144         dh_shlibdeps
145         dh_gencontrol
146         dh_md5sums
147         dh_builddeb
148
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
152
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
156
157 binary: binary-arch binary-indep
158 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure