1#
2# @configure_input@
3#
4# Copyright (c) 1994-2008 Carnegie Mellon University.  All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9#
10# 1. Redistributions of source code must retain the above copyright
11#    notice, this list of conditions and the following disclaimer.
12#
13# 2. Redistributions in binary form must reproduce the above copyright
14#    notice, this list of conditions and the following disclaimer in
15#    the documentation and/or other materials provided with the
16#    distribution.
17#
18# 3. The name "Carnegie Mellon University" must not be used to
19#    endorse or promote products derived from this software without
20#    prior written permission. For permission or any legal
21#    details, please contact
22#      Carnegie Mellon University
23#      Center for Technology Transfer and Enterprise Creation
24#      4615 Forbes Avenue
25#      Suite 302
26#      Pittsburgh, PA  15213
27#      (412) 268-7393, fax: (412) 268-7395
28#      innovation@andrew.cmu.edu
29#
30# 4. Redistributions of any form whatsoever must retain the following
31#    acknowledgment:
32#    "This product includes software developed by Computing Services
33#     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
34#
35# CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
36# THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
37# AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
38# FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
39# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
40# AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
41# OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
42#
43
44ACLOCAL_AMFLAGS = -I cmulocal
45AM_CFLAGS = @PERL_CCCDLFLAGS@ $(GCOV_CFLAGS)
46AM_CXXFLAGS = $(GCOV_CXXFLAGS)
47
48AM_CPPFLAGS = \
49	$(COM_ERR_CPPFLAGS) \
50	-I${top_builddir} \
51	-I${top_builddir}/lib \
52	-I${top_srcdir} \
53	-I${top_srcdir}/lib \
54	-DLIBEXEC_DIR=\"$(libexecdir)\" \
55	-DSBIN_DIR=\"$(sbindir)\" \
56	-DSYSCONF_DIR=\"$(sysconfdir)\" \
57	${DEFS} \
58	${LOCALDEFS} \
59	$(SASLFLAGS) \
60	$(SSL_CPPFLAGS) \
61	$(ICU_CFLAGS)
62
63if HAVE_LDAP
64AM_CPPFLAGS += $(LDAP_CPPFLAGS)
65endif # HAVE_LDAP
66
67AM_LDFLAGS = $(COV_LDFLAGS) $(ICU_LIBS)
68
69# have distcheck try to build with all optional components enabled, to aid
70# detection of missing files for these components
71AM_DISTCHECK_CONFIGURE_FLAGS = \
72    --enable-http \
73    --enable-calalarmd \
74    --enable-replication \
75    --with-openssl=yes \
76    --enable-nntp \
77    --enable-murder \
78    --enable-idled \
79    --enable-event-notification \
80    --enable-sieve \
81    --enable-autocreate \
82    --enable-backup \
83    --with-lmdb \
84    --enable-xapian \
85    --enable-jmap \
86    --with-ldap
87
88BUILT_SOURCES = \
89	imap/imap_err.c \
90	lib/imapopts.c \
91	lib/imapopts.h
92
93CLEANFILES = \
94	lib/chartable.c \
95	lib/imapopts.c \
96	lib/imapopts.h
97
98DISTCLEANFILES = \
99	imap/imap_err.c \
100	imap/imap_err.h \
101	imap/mupdate_err.c \
102	imap/mupdate_err.h \
103	imap/nntp_err.c \
104	imap/nntp_err.h \
105	imap/http_caldav_js.h \
106	imap/http_carddav_js.h \
107	imap/http_err.c \
108	imap/http_err.h \
109	imap/tz_err.c \
110	imap/tz_err.h \
111	com_err/et/compile_et \
112	perl/sieve/scripts/installsieve \
113	perl/sieve/scripts/sieveshell \
114	sieve/sieve_err.c \
115	sieve/sieve_err.h
116
117MAINTAINERCLEANFILES = \
118	doc/legacy/murder.png \
119	doc/legacy/netnews.png \
120	man/imapd.conf.5 \
121	man/sieveshell.1 \
122	imap/lmtpstats.h \
123	imap/pushstats.h \
124	sieve/addr.h \
125	sieve/sieve.h
126
127SUBDIRS = .
128DIST_SUBDIRS = . perl/annotator perl/imap perl/sieve/managesieve
129dist_sysconf_DATA =
130lib_LTLIBRARIES = lib/libcyrus_min.la lib/libcyrus.la
131EXTRA_PROGRAMS =
132check_PROGRAMS =
133libexec_PROGRAMS =
134sbin_PROGRAMS =
135noinst_HEADERS =
136noinst_LTLIBRARIES =
137noinst_PROGRAMS =
138EXTRA_DIST = \
139	$(wildcard tools/vzic/*) \
140	VERSION
141
142if COM_ERR
143COMPILE_ET_DEP = com_err/et/compile_et
144BUILT_SOURCES += com_err/et/compile_et com_err/et/libcyrus_com_err.la
145lib_LTLIBRARIES += com_err/et/libcyrus_com_err.la
146endif # COM_ERR
147
148bin_PROGRAMS = imtest/imtest
149
150if SERVER
151BUILT_SOURCES += \
152	imap/mupdate_err.c \
153	imap/nntp_err.c \
154	imap/lmtpstats.c \
155	imap/pushstats.c \
156	lib/htmlchar.c \
157	lib/htmlchar.h \
158	imap/rfc822_header.c \
159	imap/rfc822_header.h
160
161lib_LTLIBRARIES += imap/libcyrus_imap.la
162
163libexec_PROGRAMS += \
164	master/master \
165	imap/imapd \
166	imap/lmtpd \
167	imap/pop3d \
168	imap/smmapd
169
170sbin_PROGRAMS += \
171	imap/arbitron \
172	imap/chk_cyrus \
173	imap/ctl_conversationsdb \
174	imap/ctl_cyrusdb \
175	imap/ctl_deliver \
176	imap/ctl_mboxlist \
177	imap/cvt_cyrusdb \
178	imap/cyr_df \
179	imap/cyrdump \
180	imap/cyr_dbtool \
181	imap/cyr_deny \
182	imap/cyr_expire \
183	imap/cyr_info \
184	imap/cyr_buildinfo \
185	imap/cyr_sequence \
186	imap/cyr_synclog \
187	imap/cyr_userseen \
188	imap/cyr_virusscan \
189	imap/deliver \
190	imap/ipurge \
191	imap/mbexamine \
192	imap/mbpath \
193	imap/mbtool \
194	imap/quota \
195	imap/reconstruct \
196	imap/cvt_xlist_specialuse
197
198noinst_PROGRAMS += \
199	imap/message_test \
200	imap/search_test
201
202if USE_SPHINX
203sbin_PROGRAMS += imap/cyr_sphinxmgr
204endif
205
206if USE_SQUAT
207noinst_PROGRAMS += imap/squat_dump
208endif
209if SQUATTER
210# Despite the name, the squatter program handles any search engine
211sbin_PROGRAMS += imap/squatter
212endif
213
214if NNTPD
215libexec_PROGRAMS += imap/nntpd
216sbin_PROGRAMS += imap/fetchnews
217endif # NNTPD
218
219libexec_PROGRAMS += imap/fud
220
221if IDLED
222libexec_PROGRAMS += imap/idled
223endif # IDLED
224
225if MURDER
226libexec_PROGRAMS += imap/mupdate
227endif # MURDER
228
229if NNTPD
230libexec_PROGRAMS += imap/nntpd
231endif
232
233if CALALARMD
234libexec_PROGRAMS += imap/calalarmd
235endif
236
237if HTTPD
238AM_CPPFLAGS += $(HTTP_CPPFLAGS)
239AM_LDFLAGS += $(HTTP_LIBS)
240
241BUILT_SOURCES += \
242	imap/http_caldav_js.h \
243	imap/http_carddav_js.h \
244	imap/http_err.c \
245	imap/http_err.h \
246	imap/tz_err.c \
247	imap/tz_err.h
248
249libexec_PROGRAMS += imap/httpd
250sbin_PROGRAMS += \
251	imap/ctl_zoneinfo \
252	imap/dav_reconstruct
253endif # HTTPD
254
255if REPLICATION
256libexec_PROGRAMS += imap/sync_server
257sbin_PROGRAMS += imap/sync_client imap/sync_reset
258endif # REPLICATION
259
260if BACKUP
261noinst_LTLIBRARIES += backup/libcyrus_backup.la
262noinst_HEADERS += backup/backup.h
263libexec_PROGRAMS += backup/backupd
264sbin_PROGRAMS += backup/ctl_backups backup/cyr_backup backup/restore
265endif # BACKUP
266
267if HAVE_SSL
268sbin_PROGRAMS += imap/tls_prune
269endif # HAVE_SSL
270
271sbin_PROGRAMS += imap/unexpunge
272
273if SIEVE
274check_PROGRAMS += notifyd/notifytest
275libexec_PROGRAMS += notifyd/notifyd
276endif # SIEVE
277
278else # SERVER
279EXTRA_DIST += \
280    imap/mupdate_err.c \
281    imap/nntp_err.c \
282    imap/lmtpstats.c \
283    imap/pushstats.c \
284    imap/rfc822_header.c \
285    imap/rfc822_header.h
286
287if !HTTPD
288EXTRA_DIST += \
289	imap/http_err.c \
290	imap/http_err.h \
291	imap/tz_err.c \
292	imap/tz_err.h
293endif # HTTPD
294
295endif # SERVER
296
297if CMULOCAL
298dist_sysconf_DATA += depot/rc.local.imap depot/rc.local.ptclient
299sbin_PROGRAMS += netnews/remotepurge
300endif # CMULOCAL
301
302if PTCLIENT
303sbin_PROGRAMS += ptclient/ptdump ptclient/ptexpire
304libexec_PROGRAMS += \
305	ptclient/ptloader
306endif # PTCLIENT
307
308if PERL
309SUBDIRS += perl/annotator perl/imap
310noinst_LTLIBRARIES += perl/libcyrus.la perl/libcyrus_min.la
311endif # PERL
312
313if SIEVE
314
315if PERL
316SUBDIRS += perl/sieve/managesieve
317noinst_LTLIBRARIES += perl/sieve/lib/libisieve.la
318endif # PERL
319
320BUILT_SOURCES += sieve/addr.c sieve/sieve.c sieve/sieve_err.c
321noinst_LTLIBRARIES += sieve/libcyrus_sieve_lex.la
322lib_LTLIBRARIES += sieve/libcyrus_sieve.la
323check_PROGRAMS += sieve/test
324sbin_PROGRAMS += sieve/sievec sieve/sieved
325
326if SERVER
327libexec_PROGRAMS += timsieved/timsieved
328endif # SERVER
329
330endif # SIEVE
331
332EXTRA_DIST += \
333	COPYING \
334	README.md \
335	SMakefile \
336	com_err/et/et_c.awk \
337	com_err/et/et_h.awk \
338	com_err/et/test1.et \
339	com_err/et/test2.et \
340	com_err/et/test_et.c \
341	contrib/drac_auth.patch \
342	contrib/sieve-spamasssassin \
343	contrib/fud-client.c \
344	contrib/deliver-notify-zephyr.patch \
345	contrib/add-cyrus-user \
346	contrib/README \
347	contrib/cyrus-graphtools.1.0 \
348	contrib/cyrus-graphtools.1.0/cgi-bin/cyrus_master.pl \
349	contrib/cyrus-graphtools.1.0/cgi-bin/graph_cyrus_db.pl \
350	contrib/cyrus-graphtools.1.0/cgi-bin/graph_cyrus_db-sum.pl \
351	contrib/cyrus-graphtools.1.0/html \
352	contrib/cyrus-graphtools.1.0/html/index.html \
353	contrib/cyrus-graphtools.1.0/README \
354	contrib/cyrus-graphtools.1.0/script \
355	contrib/cyrus-graphtools.1.0/script/cyrus.pl \
356	contrib/cyrus-graphtools.1.0/script/run \
357	contrib/cyrus-graphtools.1.0/script/cyrusrc \
358	contrib/cyrusv2.mc \
359	contrib/dkim_canon_ischedule.patch \
360	contrib/notify_unix/notify \
361	contrib/notify_unix/net-server-prefork-0.01.tgz \
362	contrib/notify_unix/README \
363	contrib/notify_unix/sql_notify.pl \
364	contrib/notify_unix/simple_notify.pl \
365	contrib/squatrunner.pl \
366	contrib/mupdate-test.pl \
367	contrib/squatrunner.txt \
368	cunit/cacert.pem \
369	cunit/cert.pem \
370	cunit/cunit.pl \
371	cunit/cunit-to-junit.pl \
372	cunit/key.pem \
373	cunit/vg.supp \
374	doc/legacy/murder.png \
375	doc/legacy/netnews.png \
376	doc \
377	docsrc \
378	imap/dav_util.h \
379	imap/http_caldav_js.h \
380	imap/http_caldav.js \
381	imap/http_carddav_js.h \
382	imap/http_carddav.js \
383	imap/http_err.et \
384	imap/imap_err.et \
385	imap/mupdate_err.et \
386	imap/nntp_err.et \
387	imap/rfc822_header.st \
388	imap/tz_err.et \
389	lib/charset/aliases.txt \
390	lib/charset/UnicodeData.txt \
391	lib/charset/unifix.txt \
392	lib/charset/us-ascii.t \
393	lib/htmlchar.st \
394	lib/imapoptions \
395	lib/test/cyrusdb.c \
396	lib/test/cyrusdb.INPUT \
397	lib/test/cyrusdblong.INPUT \
398	lib/test/cyrusdblong.OUTPUT \
399	lib/test/cyrusdb.OUTPUT \
400	lib/test/cyrusdbtxn.INPUT \
401	lib/test/cyrusdbtxn.OUTPUT \
402	lib/test/pool.c \
403	lib/test/rnddb.c \
404	master/CYRUS-MASTER.mib \
405	master/README \
406	netnews/inn.diffs \
407	perl/annotator/Daemon.pm \
408	perl/annotator/Makefile.PL \
409	perl/annotator/Makefile.PL.in \
410	perl/annotator/MANIFEST \
411	perl/annotator/MANIFEST.in \
412	perl/annotator/Message.pm \
413	perl/annotator/README \
414	perl/imap/Changes \
415	perl/imap/cyradm.sh \
416	perl/imap/cyrperl.h \
417	perl/imap/examples/auditmbox.pl \
418	perl/imap/examples/imapcollate.pl \
419	perl/imap/examples/imapdu.pl \
420	perl/imap/examples/test-imsp.pl \
421	perl/imap/IMAP/Admin.pm \
422	perl/imap/IMAP/IMSP.pm \
423	perl/imap/IMAP/Shell.pm \
424	perl/imap/IMAP.pm \
425	perl/imap/IMAP.xs \
426	perl/imap/Makefile.PL \
427	perl/imap/Makefile.PL.in \
428	perl/imap/MANIFEST \
429	perl/imap/MANIFEST.in \
430	perl/imap/README \
431	perl/imap/t/01-imclient.t \
432	perl/imap/t/02-admin.t \
433	perl/imap/typemap \
434	perl/imap/xsutil.c \
435	perl/sieve/managesieve/Makefile.PL \
436	perl/sieve/managesieve/Makefile.PL.in \
437	perl/sieve/managesieve/managesieve.h \
438	perl/sieve/managesieve/managesieve.pm \
439	perl/sieve/managesieve/managesieve.xs \
440	perl/sieve/managesieve/MANIFEST \
441	perl/sieve/managesieve/MANIFEST.in \
442	perl/sieve/managesieve/typemap \
443	ptclient/README \
444	ptclient/test.c \
445	ptclient/test2.c \
446	sieve/addr.h \
447	sieve/sieve.h \
448	sieve/sieve_err.et \
449	sieve/tests/testExtension \
450	sieve/tests/testExtension/uberExtensionTestScript.key \
451	sieve/tests/testExtension/testm \
452	sieve/tests/testExtension/testm/uetest-envelope \
453	sieve/tests/testExtension/testm/uetest-asub \
454	sieve/tests/testExtension/testm/uetest-areg \
455	sieve/tests/testExtension/testm/uetest-count \
456	sieve/tests/testExtension/testm/uetest-value \
457	sieve/tests/testExtension/testm/uetest-hreg \
458	sieve/tests/testExtension/serverm \
459	sieve/tests/testExtension/serverm/uetmail-hreg \
460	sieve/tests/testExtension/serverm/uetmail-value \
461	sieve/tests/testExtension/serverm/uetmail-count2 \
462	sieve/tests/testExtension/serverm/uetmail-envelope \
463	sieve/tests/testExtension/serverm/uetmail-asub \
464	sieve/tests/testExtension/serverm/uetmail-value2 \
465	sieve/tests/testExtension/serverm/uetmail-areg \
466	sieve/tests/testExtension/serverm/uetmail-count \
467	sieve/tests/testExtension/uberExtensionTestScript.s \
468	sieve/tests/README \
469	sieve/tests/action \
470	sieve/tests/action/testm \
471	sieve/tests/action/testm/uatest-keep \
472	sieve/tests/action/testm/uatest-redirect \
473	sieve/tests/action/testm/uatest-discard \
474	sieve/tests/action/testm/uatest-stop2 \
475	sieve/tests/action/testm/uatest-stop \
476	sieve/tests/action/serverm \
477	sieve/tests/action/serverm/uamail-stop2 \
478	sieve/tests/action/serverm/uamail-redirect \
479	sieve/tests/action/serverm/uamail-stop \
480	sieve/tests/action/serverm/uamail-keep \
481	sieve/tests/action/serverm/uamail-discard \
482	sieve/tests/action/uberActionScript.key \
483	sieve/tests/action/uberActionScript.s \
484	sieve/tests/test \
485	sieve/tests/test/uberTestScript.key \
486	sieve/tests/test/testm \
487	sieve/tests/test/testm/utest-header \
488	sieve/tests/test/testm/utest-address \
489	sieve/tests/test/serverm \
490	sieve/tests/test/serverm/utmail-address \
491	sieve/tests/test/serverm/utmail-header \
492	sieve/tests/test/uberTestScript.s \
493	sieve/tests/actionExtensions \
494	sieve/tests/actionExtensions/uberExtensionActionScript.s \
495	sieve/tests/actionExtensions/testm \
496	sieve/tests/actionExtensions/testm/ueatest-flag4 \
497	sieve/tests/actionExtensions/testm/ueatest-flag2 \
498	sieve/tests/actionExtensions/testm/ueatest-fileinto \
499	sieve/tests/actionExtensions/testm/ueatest-denotify \
500	sieve/tests/actionExtensions/testm/ueatest-vacation \
501	sieve/tests/actionExtensions/testm/ueatest-reject \
502	sieve/tests/actionExtensions/testm/ueatest-mark \
503	sieve/tests/actionExtensions/testm/ueatest-denotify2 \
504	sieve/tests/actionExtensions/testm/ueatest-flag5 \
505	sieve/tests/actionExtensions/testm/ueatest-notify2 \
506	sieve/tests/actionExtensions/testm/ueatest-notify \
507	sieve/tests/actionExtensions/testm/ueatest-flag1 \
508	sieve/tests/actionExtensions/testm/ueatest-flag3 \
509	sieve/tests/actionExtensions/testm/ueatest-unmark \
510	sieve/tests/actionExtensions/uberExtensionActionScript.key \
511	sieve/tests/actionExtensions/serverm \
512	sieve/tests/actionExtensions/serverm/ueamail-flag4 \
513	sieve/tests/actionExtensions/serverm/ueamail-denotify \
514	sieve/tests/actionExtensions/serverm/ueamail-mark \
515	sieve/tests/actionExtensions/serverm/ueamail-denotify2 \
516	sieve/tests/actionExtensions/serverm/ueamail-flag2 \
517	sieve/tests/actionExtensions/serverm/ueamail-unmark \
518	sieve/tests/actionExtensions/serverm/ueamail-reject \
519	sieve/tests/actionExtensions/serverm/ueamail-flag3 \
520	sieve/tests/actionExtensions/serverm/ueamail-fileinto \
521	sieve/tests/actionExtensions/serverm/ueamail-flag1 \
522	sieve/tests/actionExtensions/serverm/ueamail-notify \
523	sieve/tests/actionExtensions/serverm/ueamail-flag5 \
524	sieve/tests/actionExtensions/serverm/ueamail-notify2 \
525	sieve/tests/actionExtensions/serverm/ueamail-vacation \
526	timsieved/TODO
527
528TEXINFO_TEX = com_err/et/texinfo.tex
529dist_noinst_SCRIPTS = \
530	com_err/et/compile_et.sh \
531	com_err/et/config_script \
532	imap/lmtpstats.snmp \
533	imap/pushstats.snmp \
534	lib/mkchartable.pl \
535	lib/test/run \
536	perl/sieve/scripts/installsieve.pl \
537	perl/sieve/scripts/sieveshell.pl \
538	tools/arbitronsort.pl \
539	tools/compile_st.pl \
540	tools/config2header \
541	tools/config2man \
542	tools/config2rst \
543	tools/config2sample \
544	tools/fixsearchpath.pl \
545	tools/git-version.sh \
546	tools/jenkins-build.sh \
547	tools/masssievec \
548	tools/mkimap \
549	tools/mknewsgroups \
550	tools/rehash \
551	tools/translatesieve \
552	snmp/snmpgen
553noinst_MAN = \
554	com_err/et/com_err.3 \
555	com_err/et/compile_et.1
556noinst_TEXINFOS = com_err/et/com_err.texinfo
557
558pkgconfigdir = $(libdir)/pkgconfig
559pkgconfig_DATA = libcyrus_min.pc libcyrus.pc libcyrus_sieve.pc libcyrus_imap.pc
560
561com_err_et_libcyrus_com_err_la_SOURCES = \
562	com_err/et/com_err.c \
563	com_err/et/com_err.h \
564	com_err/et/error_message.c \
565	com_err/et/error_table.h \
566	com_err/et/et_name.c \
567	com_err/et/init_et.c \
568	com_err/et/internal.h \
569	com_err/et/mit-sipb-copyright.h
570com_err_et_libcyrus_com_err_la_CFLAGS = $(AM_CFLAGS) $(CFLAG_VISIBILITY)
571
572com_err/et/compile_et: com_err/et/compile_et.sh com_err/et/config_script \
573	config.h
574	@${top_srcdir}/com_err/et/config_script ${top_srcdir}/com_err/et/compile_et.sh ${AWK} ${SED} > $@
575	@chmod 755 $@
576
577# ---- Libraries ----
578
579# BASIC is the libraries that every Cyrus program (except master) will
580# need to link with.
581#
582# Note that several places in the code use -lcrypto, e.g. for SHA1 or
583# MD5 algorithms, without needing SSL.  Currently we have no way of
584# minimally linking such code.
585LD_BASIC_ADD = lib/libcyrus.la lib/libcyrus_min.la ${LIBS} \
586	${LIB_SASL} $(SSL_LIBS) $(GCOV_LIBS)
587
588# UTILITY is the libraries that utility programs which use Cyrus'
589# mailbox and message handling code need to link with.
590
591LD_UTILITY_ADD = imap/libcyrus_imap.la $(LD_BASIC_ADD) $(COM_ERR_LIBS)
592
593# SERVER is the libraries that network-facing servers need to link with
594#
595# Note that the code is horribly intertwingled e.g. in imap/global.c
596# so that even utilities which never open a socket need to link against
597# the SASL library.
598LD_SERVER_ADD = $(LD_UTILITY_ADD) $(LIB_WRAP)
599
600# SIEVE is the libraries that sieve-using components need to link with
601#
602# This is empty if sieve is not enabled, so it can be used unconditionally
603# elsewhere.
604
605if SIEVE
606LD_SIEVE_ADD = sieve/libcyrus_sieve.la $(LD_BASIC_ADD)
607else
608LD_SIEVE_ADD =
609endif
610
611# ----
612
613if CUNIT
614
615CUNIT_PROJECT = cunit/default.cunit
616BUILT_SOURCES += cunit/registers.h $(CUNIT_PROJECT)
617CLEANFILES += cunit/registers.h $(CUNIT_PROJECT)
618check_PROGRAMS += cunit/unit
619
620cunit_FRAMEWORK = \
621	cunit/unit.c \
622	cunit/cunit.h \
623	cunit/syslog.c \
624	cunit/cunit-syslog.h \
625	cunit/timeout.c \
626	cunit/timeout.h \
627	cunit/timezones.c \
628	cunit/timezones.h \
629	cunit/timeofday.c \
630	cunit/timeofday.h
631
632cunit_TESTS = \
633	cunit/aaa-db.testc \
634	cunit/annotate.testc \
635	cunit/backend.testc \
636	cunit/binhex.testc \
637	cunit/bitvector.testc \
638	cunit/buf.testc \
639	cunit/byteorder64.testc \
640	cunit/charset.testc \
641	cunit/command.testc \
642	cunit/conversations.testc \
643	cunit/crc32.testc \
644	cunit/dlist.testc \
645	cunit/duplicate.testc \
646	cunit/getxstring.testc \
647	cunit/glob.testc \
648	cunit/guid.testc \
649	cunit/hash.testc \
650	cunit/imapurl.testc \
651	cunit/libconfig.testc \
652	cunit/mboxname.testc \
653	cunit/md5.testc \
654	cunit/message.testc \
655	cunit/msgid.testc \
656	cunit/parseaddr.testc \
657	cunit/parse.testc \
658	cunit/prot.testc \
659	cunit/ptrarray.testc \
660	cunit/quota.testc \
661	cunit/rfc822tok.testc \
662	cunit/search_expr.testc \
663	cunit/seqset.testc
664
665if SIEVE
666cunit_TESTS += cunit/sieve.testc
667endif
668
669cunit_TESTS += \
670	cunit/spool.testc \
671	cunit/squat.testc \
672	cunit/strarray.testc \
673	cunit/strconcat.testc \
674	cunit/strhash.testc \
675	cunit/times.testc \
676	cunit/tok.testc \
677	cunit/vparse.testc
678
679cunit_unit_SOURCES = $(cunit_FRAMEWORK) $(cunit_TESTS) \
680		imap/mutex_fake.c imap/spool.c
681cunit_unit_LDADD = $(LD_SIEVE_ADD) $(LD_UTILITY_ADD) -lcunit
682
683CUNIT_PL = $(top_srcdir)/cunit/cunit.pl --project $(CUNIT_PROJECT)
684
685# don't discard the temporary source file if building with coverage
686if HAVE_COVERAGE
687    CUNIT_RM = true
688else
689    CUNIT_RM = $(RM)
690endif
691
692.testc.o:
693	$(AM_V_at)$(CUNIT_PL) --generate-wrapper $<
694	$(AM_V_CC)$(COMPILE) -c -o $@ $<-cunit.c
695	$(AM_V_at)$(CUNIT_RM) $<-cunit.c
696
697$(CUNIT_PROJECT):
698	$(AM_V_at)$(RM) $@
699	$(AM_V_GEN)$(CUNIT_PL) --add-sources $(addprefix $(top_srcdir)/,$(cunit_TESTS))
700
701cunit/registers.h: $(CUNIT_PROJECT)
702	$(AM_V_GEN)$(CUNIT_PL) --generate-register-function $@
703
704# To run under Valgrind, do: make VG=1 check
705VALGRIND = libtool --mode=execute valgrind --tool=memcheck --leak-check=full --suppressions=vg.supp
706
707check-local:
708	@echo "Running unit tests"
709	@vg= ; \
710		test -z "$$VG" || vg="$(VALGRIND)" ; \
711		f="-v" ; \
712		test "x$$CUFORMAT" = xjunit && f="-x" ; \
713		cd cunit ; \
714		$$vg ./unit $$f ; \
715		retval=$$? ; \
716		if [ "x$$CUFORMAT" = xjunit ] ; then \
717			$(RM) -rf reports ; mkdir reports ; ./cunit-to-junit.pl ; \
718		fi ; \
719		exit $$retval
720
721check-%: cunit/unit
722	@echo "Running unit tests for $*"
723	@vg= ; \
724		test -z "$$VG" || vg="$(VALGRIND)" ; \
725		cd cunit ; \
726		$$vg ./unit -v $* ; \
727		retval=$$? ; \
728		exit $$retval
729
730endif
731
732includedir=@includedir@/cyrus
733
734include_HEADERS = \
735	lib/acl.h \
736	lib/arrayu64.h \
737	lib/assert.h \
738	lib/auth.h \
739	lib/auth_pts.h \
740	lib/bitvector.h \
741	lib/bloom.h \
742	lib/bsearch.h \
743	lib/bufarray.h \
744	lib/charset.h \
745	lib/chartable.h \
746	lib/command.h \
747	lib/crc32.h \
748	lib/crc32c.h \
749	lib/cyr_lock.h \
750	lib/cyrusdb.h \
751	lib/exitcodes.h \
752	lib/glob.h \
753	lib/gmtoff.h \
754	lib/hash.h \
755	lib/hashu64.h \
756	lib/imapurl.h \
757	lib/imclient.h \
758	lib/imparse.h \
759	lib/iostat.h \
760	lib/iptostring.h \
761	lib/libcyr_cfg.h \
762	lib/lsort.h \
763	lib/map.h \
764	lib/mappedfile.h \
765	lib/mkgmtime.h \
766	lib/mpool.h \
767	lib/murmurhash2.h \
768	lib/nonblock.h \
769	lib/parseaddr.h \
770	lib/retry.h \
771	lib/rfc822tok.h \
772	lib/signals.h \
773	lib/sqldb.h \
774	lib/strarray.h \
775	lib/strhash.h \
776	lib/stristr.h \
777	lib/sysexits.h \
778	lib/times.h \
779	lib/tok.h \
780	lib/vparse.h \
781	lib/wildmat.h \
782	lib/xmalloc.h
783
784nodist_include_HEADERS = \
785	lib/imapopts.h
786
787nobase_include_HEADERS = sieve/sieve_interface.h
788nobase_nodist_include_HEADERS = sieve/sieve_err.h
789
790noinst_HEADERS += \
791	lib/byteorder64.h \
792	lib/gai.h \
793	lib/libconfig.h \
794	lib/md5.h \
795	lib/prot.h \
796	lib/ptrarray.h \
797	lib/util.h \
798	lib/xsha1.h \
799	lib/xstrlcat.h \
800	lib/xstrlcpy.h \
801	lib/xstrnchr.h
802
803backup_libcyrus_backup_la_SOURCES = \
804    lib/gzuncat.c \
805    lib/gzuncat.h \
806    backup/lcb.c \
807    backup/lcb_append.c \
808    backup/lcb_backupdb.c \
809    backup/lcb_compact.c \
810    backup/lcb_indexr.c \
811    backup/lcb_indexw.c \
812    backup/lcb_internal.c \
813    backup/lcb_internal.h \
814    backup/lcb_partlist.c \
815    backup/lcb_read.c \
816    backup/lcb_sqlconsts.c \
817    backup/lcb_sqlconsts.h \
818    backup/lcb_verify.c
819backup_libcyrus_backup_la_LIBADD = $(LD_BASIC_ADD)
820
821backup_backupd_SOURCES = \
822    imap/mutex_fake.c \
823    imap/sync_support.c \
824    imap/sync_support.h \
825    master/service.c \
826    backup/backupd.c
827backup_backupd_LDADD = backup/libcyrus_backup.la $(LD_SIEVE_ADD) $(LD_SERVER_ADD)
828
829backup_ctl_backups_SOURCES = \
830    imap/mutex_fake.c \
831    imap/sync_support.c \
832    imap/sync_support.h \
833    backup/ctl_backups.c
834backup_ctl_backups_LDADD = backup/libcyrus_backup.la $(LD_SIEVE_ADD) $(LD_UTILITY_ADD)
835
836backup_cyr_backup_SOURCES = \
837    imap/mutex_fake.c \
838    backup/cyr_backup.c
839backup_cyr_backup_LDADD = backup/libcyrus_backup.la $(LD_UTILITY_ADD) $(JANSSON_LIBS)
840
841backup_restore_SOURCES = \
842    imap/mutex_fake.c \
843    imap/sync_support.c \
844    imap/sync_support.h \
845    backup/restore.c
846backup_restore_LDADD = backup/libcyrus_backup.la $(LD_SIEVE_ADD) $(LD_UTILITY_ADD)
847
848imap_arbitron_SOURCES = imap/arbitron.c imap/cli_fatal.c imap/mutex_fake.c
849imap_arbitron_LDADD = $(LD_UTILITY_ADD)
850
851imap_chk_cyrus_SOURCES = imap/chk_cyrus.c imap/cli_fatal.c imap/mutex_fake.c
852imap_chk_cyrus_LDADD = $(LD_UTILITY_ADD)
853
854imap_ctl_conversationsdb_SOURCES = imap/ctl_conversationsdb.c imap/mutex_fake.c
855imap_ctl_conversationsdb_LDADD = $(LD_UTILITY_ADD)
856
857imap_ctl_cyrusdb_SOURCES = imap/cli_fatal.c imap/ctl_cyrusdb.c imap/mutex_fake.c
858imap_ctl_cyrusdb_LDADD = $(LD_UTILITY_ADD)
859
860imap_ctl_deliver_SOURCES = imap/cli_fatal.c imap/ctl_deliver.c imap/mutex_fake.c
861imap_ctl_deliver_LDADD = $(LD_UTILITY_ADD)
862
863imap_ctl_mboxlist_SOURCES = imap/cli_fatal.c imap/ctl_mboxlist.c imap/mutex_fake.c
864imap_ctl_mboxlist_LDADD = $(LD_UTILITY_ADD)
865
866imap_cvt_cyrusdb_SOURCES = imap/cli_fatal.c imap/cvt_cyrusdb.c imap/mutex_fake.c
867imap_cvt_cyrusdb_LDADD = $(LD_UTILITY_ADD)
868
869imap_cyrdump_SOURCES = imap/cli_fatal.c imap/cyrdump.c imap/mutex_fake.c
870imap_cyrdump_LDADD = $(LD_UTILITY_ADD)
871
872imap_cyr_dbtool_SOURCES = imap/cli_fatal.c imap/cyr_dbtool.c imap/mutex_fake.c
873imap_cyr_dbtool_LDADD = $(LD_UTILITY_ADD)
874
875imap_cyr_deny_SOURCES = imap/cli_fatal.c imap/cyr_deny.c imap/mutex_fake.c
876imap_cyr_deny_LDADD = $(LD_UTILITY_ADD)
877
878imap_cyr_df_SOURCES = imap/cli_fatal.c imap/cyr_df.c imap/mutex_fake.c
879imap_cyr_df_LDADD = $(LD_UTILITY_ADD)
880
881imap_cyr_expire_SOURCES = imap/cli_fatal.c imap/cyr_expire.c imap/mutex_fake.c
882imap_cyr_expire_LDADD = $(LD_UTILITY_ADD)
883
884imap_cyr_info_SOURCES = imap/cli_fatal.c imap/cyr_info.c imap/mutex_fake.c master/masterconf.c
885imap_cyr_info_LDADD = $(LD_UTILITY_ADD)
886
887imap_cyr_buildinfo_SOURCES = imap/cli_fatal.c imap/cyr_buildinfo.c imap/mutex_fake.c master/masterconf.c
888imap_cyr_buildinfo_LDADD = $(LD_UTILITY_ADD) $(JANSSON_LIBS)
889
890imap_cyr_sequence_SOURCES = imap/cli_fatal.c imap/cyr_sequence.c imap/mutex_fake.c
891imap_cyr_sequence_LDADD = $(LD_UTILITY_ADD)
892
893imap_cyr_synclog_SOURCES = imap/cli_fatal.c imap/cyr_synclog.c imap/mutex_fake.c
894imap_cyr_synclog_LDADD = $(LD_UTILITY_ADD)
895
896imap_cyr_userseen_SOURCES = imap/cli_fatal.c imap/cyr_userseen.c imap/mutex_fake.c
897imap_cyr_userseen_LDADD = $(LD_UTILITY_ADD)
898
899imap_cyr_sphinxmgr_SOURCES = imap/cli_fatal.c imap/cyr_sphinxmgr.c imap/mutex_fake.c
900imap_cyr_sphinxmgr_LDADD = $(LD_UTILITY_ADD)
901
902imap_cyr_virusscan_SOURCES = imap/cli_fatal.c imap/cyr_virusscan.c imap/mutex_fake.c
903imap_cyr_virusscan_CFLAGS = $(AM_CFLAGS) $(CLAMAV_CFLAGS) $(CFLAG_VISIBILITY)
904imap_cyr_virusscan_LDADD = $(LD_UTILITY_ADD) $(CLAMAV_LIBS)
905
906imap_ctl_zoneinfo_SOURCES = imap/cli_fatal.c imap/ctl_zoneinfo.c imap/mutex_fake.c imap/zoneinfo_db.c
907imap_ctl_zoneinfo_LDADD = $(LD_UTILITY_ADD)
908
909imap_deliver_SOURCES = \
910	imap/deliver.c \
911	imap/lmtpengine.c \
912	imap/lmtpstats.c \
913	imap/mutex_fake.c \
914	imap/proxy.c \
915	imap/spool.c
916
917imap_deliver_LDADD = $(LD_UTILITY_ADD)
918
919imap_fetchnews_SOURCES = imap/cli_fatal.c imap/fetchnews.c imap/mutex_fake.c
920imap_fetchnews_LDADD = $(LD_UTILITY_ADD)
921
922imap_fud_SOURCES = imap/fud.c imap/mutex_fake.c master/service.c
923imap_fud_LDADD = $(LD_SERVER_ADD)
924
925imap_idled_SOURCES = imap/idled.c imap/mutex_fake.c
926imap_idled_LDADD = $(LD_UTILITY_ADD)
927
928imap_calalarmd_SOURCES = imap/calalarmd.c imap/mutex_fake.c
929imap_calalarmd_LDADD = $(LD_SERVER_ADD)
930
931imap_imapd_SOURCES = \
932	imap/imap_proxy.c \
933	imap/imap_proxy.h \
934	imap/imapd.c \
935	imap/imapd.h \
936	imap/mutex_fake.c \
937	imap/pushstats.c \
938	imap/pushstats.h \
939	imap/proxy.c \
940	imap/proxy.h \
941	imap/sync_support.c \
942	imap/sync_support.h \
943	master/service.c
944
945if AUTOCREATE
946imap_imapd_SOURCES += \
947	imap/autocreate.h \
948	imap/autocreate.c
949endif
950
951imap_imapd_LDADD = $(LD_SIEVE_ADD) $(LD_SERVER_ADD)
952
953imap_ipurge_SOURCES = imap/cli_fatal.c imap/ipurge.c imap/mutex_fake.c
954imap_ipurge_LDADD = $(LD_UTILITY_ADD)
955
956nodist_imap_libcyrus_imap_la_SOURCES = \
957	imap/imap_err.c \
958	imap/mupdate_err.c \
959	imap/mupdate_err.h
960
961dist_imap_libcyrus_imap_la_SOURCES =
962
963imap_libcyrus_imap_la_LIBADD = \
964    $(COM_ERR_LIBS) \
965    $(LIB_UUID) \
966    $(GCOV_LIBS) \
967    $(JANSSON_LIBS) \
968    lib/libcyrus_min.la \
969    lib/libcyrus.la
970
971imap_libcyrus_imap_la_CFLAGS = $(AM_CFLAGS) $(CFLAG_VISIBILITY) $(JANSSON_CFLAGS)
972imap_libcyrus_imap_la_CXXFLAGS = $(AM_CXXFLAGS)
973
974imap_libcyrus_imap_la_SOURCES = \
975	imap/annotate.c \
976	imap/annotate.h \
977	imap/append.c \
978	imap/append.h \
979	imap/backend.c \
980	imap/backend.h \
981	imap/conversations.c \
982	imap/conversations.h \
983	imap/convert_code.c \
984	imap/convert_code.h \
985	imap/dlist.c \
986	imap/dlist.h \
987	imap/duplicate.c \
988	imap/duplicate.h \
989	imap/global.c \
990	imap/global.h \
991	imap/idle.c \
992	imap/idle.h \
993	imap/idlemsg.c \
994	imap/idlemsg.h \
995	imap/imapparse.c \
996	imap/imapparse.h \
997	imap/index.c \
998	imap/index.h \
999	imap/mailbox.c \
1000	imap/mailbox.h \
1001	imap/mbdump.c \
1002	imap/mbdump.h \
1003	imap/mboxkey.c \
1004	imap/mboxkey.h \
1005	imap/mboxlist.c \
1006	imap/mboxlist.h \
1007	imap/mboxevent.c \
1008	imap/mboxevent.h \
1009	imap/mboxname.c \
1010	imap/mboxname.h \
1011	imap/message_guid.c \
1012	imap/message_guid.h \
1013	imap/message.c \
1014	imap/message.h \
1015	imap/message_priv.h \
1016	imap/mupdate-client.c \
1017	imap/mupdate-client.h \
1018	imap/mutex.h \
1019	imap/notify.c \
1020	imap/notify.h \
1021	imap/partlist.c \
1022	imap/partlist.h \
1023	imap/proc.c \
1024	imap/proc.h \
1025	imap/protocol.h \
1026	imap/quota_db.c \
1027	imap/rfc822_header.c \
1028	imap/rfc822_header.h \
1029	imap/saslclient.c \
1030	imap/saslclient.h \
1031	imap/saslserver.c \
1032	imap/search_engines.c \
1033	imap/search_engines.h \
1034	imap/search_expr.c \
1035	imap/search_expr.h \
1036	imap/search_query.c \
1037	imap/search_query.h \
1038	imap/search_part.h \
1039	imap/seen.h \
1040	imap/seen_db.c \
1041	imap/sequence.c \
1042	imap/sequence.h \
1043	imap/setproctitle.c \
1044	imap/statuscache.h \
1045	imap/statuscache_db.c \
1046	imap/sync_log.c \
1047	imap/sync_log.h \
1048	imap/telemetry.c \
1049	imap/telemetry.h \
1050	imap/tls.c \
1051	imap/tls.h \
1052	imap/tls_th-lock.c \
1053	imap/tls_th-lock.h \
1054	imap/user.c \
1055	imap/user.h \
1056	imap/userdeny_db.c \
1057	imap/userdeny.h \
1058	imap/version.c \
1059	imap/version.h \
1060	imap/xstats.c \
1061	imap/xstats.h \
1062	imap/xstats_metrics.h
1063
1064if OBJECTSTORE
1065imap_libcyrus_imap_la_SOURCES += \
1066    imap/objectstore_db.c \
1067    imap/objectstore_db.h \
1068    imap/objectstore.h
1069if WITH_OPENIO
1070imap_libcyrus_imap_la_SOURCES += imap/objectstore_openio.c
1071else
1072if WITH_CARINGO
1073imap_libcyrus_imap_la_SOURCES += imap/objectstore_caringo.c
1074else
1075if WITH_OBJSTR_DUMMY
1076imap_libcyrus_imap_la_SOURCES += imap/objectstore_dummy.c
1077endif
1078endif
1079endif
1080endif
1081
1082if USE_SQUAT
1083imap_libcyrus_imap_la_SOURCES += \
1084	imap/search_squat.c \
1085	imap/squat.c \
1086	imap/squat.h \
1087	imap/squat_build.c \
1088	imap/squat_internal.c \
1089	imap/squat_internal.h
1090endif
1091
1092if USE_SPHINX
1093imap_libcyrus_imap_la_SOURCES += \
1094	imap/search_sphinx.c \
1095	imap/sphinxmgr_client.c \
1096	imap/sphinxmgr_client.h
1097endif
1098
1099if HTTPD
1100imap_libcyrus_imap_la_SOURCES += \
1101	imap/caldav_alarm.c \
1102	imap/caldav_alarm.h \
1103	imap/caldav_db.c \
1104	imap/caldav_db.h \
1105	imap/carddav_db.c \
1106	imap/carddav_db.h \
1107	imap/dav_db.c \
1108	imap/dav_db.h \
1109	imap/dav_util.c \
1110	imap/dav_util.h \
1111	imap/ical_support.c \
1112	imap/ical_support.h \
1113	imap/vcard_support.c \
1114	imap/vcard_support.h \
1115	imap/webdav_db.c \
1116	imap/webdav_db.h
1117
1118endif # HTTPD
1119
1120if USE_XAPIAN
1121imap_libcyrus_imap_la_SOURCES += \
1122	imap/search_xapian.c \
1123	imap/xapian_wrap.h \
1124	imap/xapian_wrap.cpp
1125imap_libcyrus_imap_la_LIBADD += $(XAPIAN_LIBS)
1126imap_libcyrus_imap_la_CXXFLAGS += $(XAPIAN_CXXFLAGS)
1127endif
1128
1129imap_lmtpd_SOURCES = \
1130	imap/lmtpd.c \
1131	imap/lmtpd.h \
1132	imap/lmtpengine.c \
1133	imap/lmtpengine.h \
1134	imap/lmtpstats.c \
1135	imap/lmtpstats.h \
1136	imap/mutex_fake.c \
1137	imap/proxy.c \
1138	imap/spool.c \
1139	master/service.c
1140
1141if AUTOCREATE
1142imap_lmtpd_SOURCES += \
1143	imap/autocreate.c \
1144	imap/autocreate.h
1145endif # AUTOCREATE
1146
1147if SIEVE
1148imap_lmtpd_SOURCES += imap/lmtp_sieve.c imap/lmtp_sieve.h imap/smtpclient.c
1149endif # SIEVE
1150
1151imap_lmtpd_LDADD = $(LD_SIEVE_ADD) $(LD_SERVER_ADD)
1152
1153SNMPGEN = $(abs_top_srcdir)/snmp/snmpgen
1154
1155imap/lmtpstats.c: imap/lmtpstats.snmp $(SNMPGEN)
1156	$(AM_V_GEN)(cd $(@D) && $(SNMPGEN) $(realpath $<))
1157
1158imap/pushstats.c: imap/pushstats.snmp $(SNMPGEN)
1159	$(AM_V_GEN)(cd $(@D) && $(SNMPGEN) $(realpath $<))
1160
1161imap_mbexamine_SOURCES = imap/cli_fatal.c imap/mbexamine.c imap/mutex_fake.c
1162imap_mbexamine_LDADD = $(LD_UTILITY_ADD)
1163
1164imap_mbpath_SOURCES = imap/cli_fatal.c imap/mbpath.c imap/mutex_fake.c
1165imap_mbpath_LDADD = $(LD_UTILITY_ADD)
1166
1167imap_mbtool_SOURCES = imap/cli_fatal.c imap/mbtool.c imap/mutex_fake.c
1168imap_mbtool_LDADD = $(LD_UTILITY_ADD)
1169
1170imap_message_test_SOURCES = imap/message_test.c imap/mutex_fake.c
1171imap_message_test_LDADD = $(LD_UTILITY_ADD)
1172
1173imap_mupdate_SOURCES = \
1174	imap/mupdate.c \
1175	imap/mupdate.h \
1176	imap/mupdate-slave.c \
1177	imap/mutex_pthread.c \
1178	imap/tls_th-lock.c \
1179	master/service-thread.c
1180imap_mupdate_LDADD = $(LD_SERVER_ADD) -lpthread
1181imap_mupdate_CFLAGS =  $(AM_CFLAGS) -pthread
1182
1183nodist_imap_nntpd_SOURCES = \
1184	imap/nntp_err.c \
1185	imap/nntp_err.h
1186imap_nntpd_SOURCES = \
1187	imap/mutex_fake.c \
1188	imap/nntpd.c \
1189	imap/proxy.c \
1190	imap/smtpclient.c \
1191	imap/smtpclient.h \
1192	imap/spool.c \
1193	imap/spool.h \
1194	master/service.c
1195imap_nntpd_LDADD = $(LD_SERVER_ADD)
1196
1197nodist_imap_httpd_SOURCES = \
1198	imap/http_caldav_js.h \
1199	imap/http_carddav_js.h \
1200	imap/http_err.c \
1201	imap/http_err.h \
1202	imap/tz_err.c \
1203	imap/tz_err.h
1204
1205imap_httpd_SOURCES = \
1206	imap/caldav_db.c \
1207	imap/http_admin.c \
1208	imap/http_applepush.c \
1209	imap/http_caldav.c \
1210	imap/http_caldav.h \
1211	imap/http_caldav_sched.c \
1212	imap/http_caldav_sched.h \
1213	imap/http_carddav.c \
1214	imap/http_carddav.h \
1215	imap/http_client.c \
1216	imap/http_client.h \
1217	imap/http_dav.c \
1218	imap/http_dav.h \
1219	imap/http_dblookup.c \
1220	imap/http_ischedule.c \
1221	imap/http_proxy.c \
1222	imap/http_proxy.h \
1223	imap/http_rss.c \
1224	imap/http_tzdist.c \
1225	imap/http_webdav.c \
1226	imap/httpd.c \
1227	imap/httpd.h \
1228	imap/ical_support.c \
1229	imap/jcal.c \
1230	imap/jcal.h \
1231	imap/json_support.h \
1232	imap/mutex_fake.c \
1233	imap/proxy.c \
1234	imap/smtpclient.c \
1235	imap/spool.c \
1236	imap/vcard_support.c \
1237	imap/xcal.c \
1238	imap/xcal.h \
1239	imap/xml_support.c \
1240	imap/xml_support.h \
1241	imap/zoneinfo_db.c \
1242	imap/zoneinfo_db.h \
1243	master/masterconf.c \
1244	master/service.c
1245
1246imap_httpd_LDADD = $(LD_SERVER_ADD)
1247
1248imap_pop3d_SOURCES = \
1249	imap/mutex_fake.c \
1250	imap/pop3d.c \
1251	imap/proxy.c \
1252	master/service.c
1253
1254if AUTOCREATE
1255imap_pop3d_SOURCES += \
1256	imap/autocreate.c \
1257	imap/autocreate.h
1258endif # AUTOCREATE
1259
1260imap_pop3d_LDADD = $(LD_SIEVE_ADD) $(LD_SERVER_ADD)
1261
1262imap_quota_SOURCES = imap/cli_fatal.c imap/mutex_fake.c imap/quota.c imap/quota.h
1263imap_quota_LDADD = $(LD_UTILITY_ADD) $(JANSSON_LIBS)
1264
1265imap_reconstruct_SOURCES = imap/cli_fatal.c imap/mutex_fake.c imap/reconstruct.c
1266imap_reconstruct_LDADD = $(LD_UTILITY_ADD)
1267
1268imap_dav_reconstruct_SOURCES = imap/cli_fatal.c imap/mutex_fake.c imap/dav_reconstruct.c
1269imap_dav_reconstruct_LDADD = $(LD_UTILITY_ADD)
1270
1271imap_search_test_SOURCES = imap/search_test.c imap/mutex_fake.c
1272imap_search_test_LDADD = $(LD_UTILITY_ADD)
1273
1274imap_smmapd_SOURCES = imap/mutex_fake.c imap/proxy.c imap/smmapd.c master/service.c
1275imap_smmapd_LDADD = $(LD_SERVER_ADD)
1276
1277imap_squatter_SOURCES = imap/cli_fatal.c imap/mutex_fake.c imap/squatter.c
1278imap_squatter_LDADD = $(LD_UTILITY_ADD)
1279
1280imap_squat_dump_SOURCES = imap/cli_fatal.c imap/mutex_fake.c imap/squat_dump.c
1281imap_squat_dump_LDADD = $(LD_UTILITY_ADD)
1282
1283imap_sync_client_SOURCES = imap/mutex_fake.c imap/sync_client.c imap/sync_support.c imap/sync_support.h
1284imap_sync_client_LDADD = $(LD_SIEVE_ADD) $(LD_UTILITY_ADD)
1285
1286imap_sync_reset_SOURCES = imap/mutex_fake.c imap/sync_reset.c imap/sync_support.c imap/sync_support.h
1287imap_sync_reset_LDADD = $(LD_SIEVE_ADD) $(LD_UTILITY_ADD)
1288
1289imap_sync_server_SOURCES = imap/mutex_fake.c imap/sync_server.c imap/sync_support.c imap/sync_support.h master/service.c
1290imap_sync_server_LDADD = $(LD_SIEVE_ADD) $(LD_SERVER_ADD)
1291
1292imap_tls_prune_SOURCES = imap/cli_fatal.c imap/mutex_fake.c imap/tls_prune.c
1293imap_tls_prune_LDADD = $(LD_UTILITY_ADD)
1294
1295imap_unexpunge_SOURCES = imap/cli_fatal.c imap/mutex_fake.c imap/unexpunge.c
1296imap_unexpunge_LDADD = $(LD_UTILITY_ADD)
1297
1298# $(COMPILE_ET) creates its output files in the directory it's run from,
1299# so do a tricky directory change
1300imap/imap_err.h imap/imap_err.c: imap/imap_err.et $(COMPILE_ET_DEP)
1301	$(AM_V_GEN)(cd $(@D) && $(COMPILE_ET) $(realpath $<))
1302
1303imap/mupdate_err.h imap/mupdate_err.c: imap/mupdate_err.et $(COMPILE_ET_DEP)
1304	$(AM_V_GEN)(cd $(@D) && $(COMPILE_ET) $(realpath $<))
1305
1306imap/nntp_err.h imap/nntp_err.c: imap/nntp_err.et $(COMPILE_ET_DEP)
1307	$(AM_V_GEN)(cd $(@D) && $(COMPILE_ET) $(realpath $<))
1308
1309imap/http_err.h imap/http_err.c: imap/http_err.et $(COMPILE_ET_DEP)
1310	$(AM_V_GEN)(cd $(@D) && $(COMPILE_ET) $(realpath $<))
1311
1312imap/tz_err.h imap/tz_err.c: imap/tz_err.et $(COMPILE_ET_DEP)
1313	$(AM_V_GEN)(cd $(@D) && $(COMPILE_ET) $(realpath $<))
1314
1315# xxd cannot have path details in its input filename, otherwise it junks up
1316# the variable names in the output file.  so do a tricky directory change.
1317# the /dev/null redirection on cd is to prevent shell environments with
1318# CDPATH echoing the path change on stdout and consequently into the .h file
1319imap/http_caldav_js.h: imap/http_caldav.js
1320	$(AM_V_GEN)(cd $(<D) > /dev/null && xxd -i $(<F)) > $@
1321
1322imap/http_carddav_js.h: imap/http_carddav.js
1323	$(AM_V_GEN)(cd $(<D) > /dev/null && xxd -i $(<F)) > $@
1324
1325if MAINTAINER_MODE
1326imap/rfc822_header.c: imap/rfc822_header.st
1327	$(AM_V_GEN)${top_srcdir}/tools/compile_st.pl -c $< > $@.NEW && mv $@.NEW $@
1328
1329imap/rfc822_header.h: imap/rfc822_header.st
1330	$(AM_V_GEN)${top_srcdir}/tools/compile_st.pl -h $< > $@.NEW && mv $@.NEW $@
1331
1332lib/htmlchar.c: lib/htmlchar.st
1333	$(AM_V_GEN)${top_srcdir}/tools/compile_st.pl -c $< > $@.NEW && mv $@.NEW $@
1334
1335lib/htmlchar.h: lib/htmlchar.st
1336	$(AM_V_GEN)${top_srcdir}/tools/compile_st.pl -h $< > $@.NEW && mv $@.NEW $@
1337endif
1338
1339imtest_imtest_SOURCES = imtest/imtest.c
1340imtest_imtest_LDADD = $(LD_BASIC_ADD)
1341imtest_imtest_CFLAGS = $(AM_CFLAGS) $(CFLAG_VISIBILITY)
1342
1343nodist_lib_libcyrus_la_SOURCES = lib/chartable.c
1344lib_libcyrus_la_SOURCES = \
1345	lib/acl.c \
1346	lib/acl_afs.c \
1347	lib/auth.c \
1348	lib/auth_krb.c \
1349	lib/auth_krb5.c \
1350	lib/auth_pts.c \
1351	lib/auth_unix.c \
1352	lib/bitvector.c \
1353	lib/bloom.c \
1354	lib/bsearch.c \
1355	lib/charset.c \
1356	lib/command.c \
1357	lib/cyrusdb.c \
1358	lib/cyrusdb_flat.c \
1359	lib/cyrusdb_quotalegacy.c \
1360	lib/cyrusdb_skiplist.c \
1361	lib/cyrusdb_twoskip.c \
1362	lib/glob.c \
1363	lib/htmlchar.c \
1364	lib/htmlchar.h \
1365	lib/imapurl.c \
1366	lib/imclient.c \
1367	lib/imparse.c \
1368	lib/iostat.c \
1369	lib/iptostring.c \
1370	lib/libcyr_cfg.c \
1371	lib/lsort.c \
1372	lib/mappedfile.c \
1373	lib/murmurhash.c \
1374	lib/mkgmtime.c \
1375	lib/parseaddr.c \
1376	lib/prot.c \
1377	lib/ptrarray.c \
1378	lib/rfc822tok.c \
1379	lib/signals.c \
1380	lib/stristr.c \
1381	lib/times.c \
1382	lib/tok.c \
1383	lib/wildmat.c
1384if USE_CYRUSDB_SQL
1385lib_libcyrus_la_SOURCES += lib/cyrusdb_sql.c
1386endif
1387if USE_CYRUSDB_LMDB
1388lib_libcyrus_la_SOURCES += lib/cyrusdb_lmdb.c
1389endif
1390if USE_SQLITE
1391lib_libcyrus_la_SOURCES += lib/sqldb.c
1392endif
1393if GMTOFF_TM
1394lib_libcyrus_la_SOURCES += lib/gmtoff_tm.c
1395else
1396lib_libcyrus_la_SOURCES += lib/gmtoff_gmtime.c
1397endif
1398if NONBLOCK_FCNTL
1399lib_libcyrus_la_SOURCES += lib/nonblock_fcntl.c
1400else
1401lib_libcyrus_la_SOURCES += lib/nonblock_ioctl.c
1402endif
1403lib_libcyrus_la_LIBADD = libcrc32.la ${LIB_SASL} $(SSL_LIBS) $(GCOV_LIBS)
1404if USE_CYRUSDB_LMDB
1405lib_libcyrus_la_LIBADD += -llmdb
1406endif
1407lib_libcyrus_la_CFLAGS = $(AM_CFLAGS) $(CFLAG_VISIBILITY)
1408
1409noinst_LTLIBRARIES += libcrc32.la
1410libcrc32_la_SOURCES = lib/crc32.c lib/crc32c.c
1411libcrc32_la_CFLAGS = -O3 $(AM_CFLAGS) $(CFLAG_VISIBILITY)
1412
1413nodist_lib_libcyrus_min_la_SOURCES = \
1414	lib/imapopts.c
1415
1416lib_libcyrus_min_la_SOURCES = \
1417	lib/arrayu64.c \
1418	lib/assert.c \
1419	lib/bufarray.c \
1420	lib/byteorder64.c \
1421	lib/hash.c \
1422	lib/hashu64.c \
1423	lib/libconfig.c \
1424	lib/mpool.c \
1425	lib/retry.c \
1426	lib/strarray.c \
1427	lib/strhash.c \
1428	lib/util.c \
1429	lib/vparse.c \
1430	lib/xmalloc.c \
1431	lib/xstrlcat.c \
1432	lib/xstrlcpy.c \
1433	lib/xstrnchr.c
1434if !HAVE_SSL
1435lib_libcyrus_min_la_SOURCES += lib/xsha1.c
1436endif
1437if IPV6_noGETADDRINFO
1438lib_libcyrus_min_la_SOURCES += lib/getaddrinfo.c
1439endif
1440if IPV6_noGETNAMEINFO
1441lib_libcyrus_min_la_SOURCES += lib/getnameinfo.c
1442endif
1443if LOCK_FCNTL
1444lib_libcyrus_min_la_SOURCES += lib/lock_fcntl.c
1445else
1446lib_libcyrus_min_la_SOURCES += lib/lock_flock.c
1447endif
1448if MAP_SHARED
1449lib_libcyrus_min_la_SOURCES += lib/map_shared.c
1450else
1451if MAP_STUPIDSHARED
1452lib_libcyrus_min_la_SOURCES += lib/map_stupidshared.c
1453else
1454lib_libcyrus_min_la_SOURCES += lib/map_nommap.c
1455endif
1456endif
1457lib_libcyrus_min_la_LIBADD = $(LTLIBOBJS) $(LIB_UUID) $(GCOV_LIBS)
1458lib_libcyrus_min_la_CFLAGS = $(AM_CFLAGS) $(CFLAG_VISIBILITY)
1459
1460# n.b. the order of the -m arguments to mkchartable.pl is important,
1461# in particular ellie believes unifix.txt must be before UnicodeData.txt
1462lib/chartable.c: lib/mkchartable.pl lib/charset/unifix.txt \
1463	$(top_srcdir)/lib/charset/*.t \
1464	lib/charset/UnicodeData.txt lib/charset/aliases.txt
1465	@echo "### Building chartables..."
1466	$(AM_V_GEN)perl $(top_srcdir)/lib/mkchartable.pl -m $(top_srcdir)/lib/charset/unifix.txt -m $(top_srcdir)/lib/charset/UnicodeData.txt -a $(top_srcdir)/lib/charset/aliases.txt -o $@ $(top_srcdir)/lib/charset/*.t || (rm -f $@ && exit 1)
1467	@echo "### Done building chartables."
1468
1469lib/imapopts.h: lib/imapopts.c
1470
1471lib/imapopts.c: lib/imapoptions tools/config2header
1472	$(AM_V_GEN)$(top_srcdir)/tools/config2header CC="$(CC)" $(top_builddir)/lib/imapopts.c $(top_builddir)/lib/imapopts.h < $(top_srcdir)/lib/imapoptions
1473
1474imap_cvt_xlist_specialuse_SOURCES = imap/mutex_fake.c imap/cvt_xlist_specialuse.c
1475imap_cvt_xlist_specialuse_LDADD = $(LD_UTILITY_ADD)
1476
1477@SET_MAKE@
1478
1479dist_man1_MANS = \
1480	man/imtest.1 \
1481	man/installsieve.1 \
1482	man/httptest.1 \
1483	man/lmtptest.1 \
1484	man/mupdatetest.1 \
1485	man/nntptest.1 \
1486	man/pop3test.1 \
1487	man/sieveshell.1 \
1488	man/sivtest.1 \
1489	man/smtptest.1
1490
1491dist_man3_MANS = \
1492	man/imclient.3
1493
1494dist_man5_MANS = \
1495	man/cyrus.conf.5 \
1496	man/imapd.conf.5 \
1497	man/krb.equiv.5
1498
1499dist_man8_MANS = \
1500	man/arbitron.8 \
1501	man/backupd.8 \
1502	man/chk_cyrus.8 \
1503	man/ctl_backups.8 \
1504	man/ctl_conversationsdb.8 \
1505	man/ctl_cyrusdb.8 \
1506	man/ctl_deliver.8 \
1507	man/ctl_mboxlist.8 \
1508	man/cvt_cyrusdb.8 \
1509	man/cyr_backup.8 \
1510	man/cyr_buildinfo.8 \
1511	man/cyr_dbtool.8 \
1512	man/cyr_deny.8 \
1513	man/cyr_df.8 \
1514	man/cyr_expire.8 \
1515	man/cyr_info.8 \
1516	man/cyr_synclog.8 \
1517	man/cyr_virusscan.8 \
1518	man/deliver.8 \
1519	man/fud.8 \
1520	man/idled.8 \
1521	man/imapd.8 \
1522	man/ipurge.8 \
1523	man/lmtpd.8 \
1524	man/master.8 \
1525	man/mbexamine.8 \
1526	man/mbpath.8 \
1527	man/mbtool.8 \
1528	man/notifyd.8 \
1529	man/pop3d.8 \
1530	man/quota.8 \
1531	man/reconstruct.8 \
1532	man/restore.8 \
1533	man/smmapd.8 \
1534	man/timsieved.8 \
1535	man/tls_prune.8 \
1536	man/unexpunge.8
1537
1538if SQUATTER
1539dist_man8_MANS += \
1540	man/squatter.8
1541
1542else
1543EXTRA_DIST += \
1544	man/squatter.8
1545
1546endif # SQUATTER
1547
1548if NNTPD
1549dist_man8_MANS += \
1550	man/fetchnews.8 \
1551	man/nntpd.8
1552
1553else # NNTPD
1554EXTRA_DIST += \
1555	man/fetchnews.8 \
1556	man/nntpd.8
1557
1558endif # NNTPD
1559
1560if HTTPD
1561dist_man8_MANS += \
1562	man/ctl_zoneinfo.8 \
1563	man/httpd.8
1564
1565else # HTTPD
1566EXTRA_DIST += \
1567	man/ctl_zoneinfo.8 \
1568	man/httpd.8
1569
1570endif # HTTPD
1571
1572if REPLICATION
1573dist_man8_MANS += \
1574	man/sync_client.8 \
1575	man/sync_reset.8 \
1576	man/sync_server.8
1577
1578else
1579EXTRA_DIST += \
1580	man/sync_client.8 \
1581	man/sync_reset.8 \
1582	man/sync_server.8
1583
1584endif
1585
1586master_master_SOURCES = \
1587	master/cyrusMasterMIB.c \
1588	master/cyrusMasterMIB.h \
1589	master/master.c \
1590	master/master.h \
1591	master/masterconf.c \
1592	master/masterconf.h \
1593	master/service.h
1594master_master_LDADD = lib/libcyrus_min.la $(LIB_UCDSNMP) $(LIBS) $(GCOV_LIBS) -lm
1595
1596
1597netnews_remotepurge_SOURCES = \
1598	netnews/macros.h \
1599	netnews/readconfig.c \
1600	netnews/readconfig.h \
1601	netnews/remotepurge.c
1602netnews_remotepurge_LDADD = $(LD_BASIC_ADD)
1603
1604notifyd_notifyd_SOURCES = \
1605	imap/mutex_fake.c \
1606	master/service.c \
1607	notifyd/notify_external.c \
1608	notifyd/notify_external.h \
1609	notifyd/notify_log.c \
1610	notifyd/notify_log.h \
1611	notifyd/notify_mailto.c \
1612	notifyd/notify_mailto.h \
1613	notifyd/notify_null.c \
1614	notifyd/notify_null.h \
1615	notifyd/notifyd.c \
1616	notifyd/notifyd.h
1617if ZEPHYR
1618notifyd_notifyd_SOURCES += notifyd/notify_zephyr.c notifyd/notify_zephyr.h
1619endif
1620notifyd_notifyd_LDADD = $(LD_SERVER_ADD) $(ZEPHYR_LIBS)
1621
1622notifyd_notifytest_SOURCES = notifyd/notifytest.c imap/mutex_fake.c
1623notifyd_notifytest_LDADD = $(LD_BASIC_ADD)
1624
1625nodist_perl_libcyrus_la_SOURCES = $(nodist_lib_libcyrus_la_SOURCES)
1626perl_libcyrus_la_SOURCES = $(lib_libcyrus_la_SOURCES)
1627perl_libcyrus_la_LIBADD = $(lib_libcyrus_la_LIBADD)
1628nodist_perl_libcyrus_min_la_SOURCES = $(nodist_lib_libcyrus_min_la_SOURCES)
1629perl_libcyrus_min_la_SOURCES = $(lib_libcyrus_min_la_SOURCES)
1630perl_libcyrus_min_la_LIBADD = $(lib_libcyrus_min_la_LIBADD)
1631
1632perl_sieve_lib_libisieve_la_SOURCES = \
1633	perl/sieve/lib/codes.h \
1634	perl/sieve/lib/isieve.c \
1635	perl/sieve/lib/isieve.h \
1636	perl/sieve/lib/lex.c \
1637	perl/sieve/lib/lex.h \
1638	perl/sieve/lib/request.c \
1639	perl/sieve/lib/request.h
1640
1641ptclient_ptdump_SOURCES = imap/cli_fatal.c imap/mutex_fake.c ptclient/ptdump.c
1642ptclient_ptdump_LDADD = $(LD_UTILITY_ADD)
1643ptclient_ptexpire_SOURCES = imap/cli_fatal.c imap/mutex_fake.c ptclient/ptexpire.c
1644ptclient_ptexpire_LDADD = $(LD_UTILITY_ADD)
1645
1646ptclient_ptloader_SOURCES = \
1647	imap/mutex_fake.c \
1648	ptclient/ptloader.c \
1649	ptclient/ptloader.h \
1650	master/service-thread.c
1651ptclient_ptloader_LDFLAGS =
1652ptclient_ptloader_LDADD = $(LD_SERVER_ADD)
1653
1654if HAVE_LDAP
1655ptclient_ptloader_SOURCES += ptclient/ldap.c
1656ptclient_ptloader_LDADD += $(LDAP_LIBS)
1657ptclient_ptloader_LDFLAGS += $(LDAP_LDFLAGS)
1658endif
1659
1660if USE_AFSKRB
1661ptclient_ptloader_SOURCES += ptclient/afskrb.c
1662ptclient_ptloader_LDADD += $(AFS_LIBS)
1663ptclient_ptloader_LDFLAGS += $(AFS_LDFLAGS)
1664endif
1665
1666# Each new version of flex seems to generate new sign-comparison
1667# warnings, while they switch code around between int/yy_size_t.
1668#
1669# This is a pain because most of us Cyrus devs build with -Werror.
1670#
1671# Instead of continuing to maintain an ever-growing, increasingly
1672# precarious set of post-hoc fixes (see: the former lex-fix rule),
1673# let's just ignore sign-comparison warnings from flex-generated
1674# sources only.
1675sieve_libcyrus_sieve_lex_la_SOURCES = \
1676	sieve/addr-lex.l \
1677	sieve/sieve-lex.l
1678sieve_libcyrus_sieve_lex_la_LIBADD =
1679sieve_libcyrus_sieve_lex_la_CFLAGS = $(AM_CFLAGS) $(CFLAG_VISIBILITY) $(NOWARN_SIGN_COMPARE)
1680
1681nodist_sieve_libcyrus_sieve_la_SOURCES = \
1682	sieve/sieve_err.c \
1683	sieve/sieve_err.h
1684sieve_libcyrus_sieve_la_SOURCES = \
1685	sieve/bytecode.h \
1686	sieve/addr.y \
1687	sieve/bc_emit.c \
1688	sieve/bc_eval.c \
1689	sieve/bc_generate.c \
1690	sieve/comparator.c \
1691	sieve/comparator.h \
1692	sieve/flags.c \
1693	sieve/flags.h \
1694	sieve/grammar.c \
1695	sieve/grammar.h \
1696	sieve/interp.c \
1697	sieve/interp.h \
1698	sieve/message.c \
1699	sieve/message.h \
1700	sieve/rebuild.c \
1701	sieve/script.c \
1702	sieve/script.h \
1703	sieve/sieve.y \
1704	sieve/tree.c \
1705	sieve/tree.h \
1706	sieve/variables.c \
1707	sieve/variables.h \
1708	sieve/varlist.c \
1709	sieve/varlist.h
1710sieve_libcyrus_sieve_la_LIBADD = \
1711    sieve/libcyrus_sieve_lex.la \
1712    $(COM_ERR_LIBS) \
1713    lib/libcyrus_min.la \
1714    lib/libcyrus.la
1715sieve_libcyrus_sieve_la_CFLAGS = $(AM_CFLAGS) $(CFLAG_VISIBILITY)
1716
1717sieve_sievec_LDADD = $(LD_SIEVE_ADD)
1718sieve_sieved_LDADD = $(LD_SIEVE_ADD)
1719
1720sieve/sieve_err.h sieve/sieve_err.c: sieve/sieve_err.et $(COMPILE_ET_DEP)
1721	$(AM_V_GEN)(cd $(@D) && $(COMPILE_ET) $(realpath $<))
1722
1723sieve_test_SOURCES = sieve/test.c imap/mutex_fake.c
1724sieve_test_LDADD = $(LD_SIEVE_ADD) $(LD_UTILITY_ADD)
1725
1726timsieved_timsieved_SOURCES = \
1727	imap/mutex_fake.c \
1728	imap/proxy.c \
1729	master/service.c \
1730	timsieved/actions.c \
1731	timsieved/actions.h \
1732	timsieved/codes.h \
1733	timsieved/lex.c \
1734	timsieved/lex.h \
1735	timsieved/parser.c \
1736	timsieved/parser.h \
1737	timsieved/timsieved.c
1738
1739timsieved_timsieved_LDADD = $(LD_SIEVE_ADD) $(LD_SERVER_ADD)
1740
1741# The lex-fix rule is now obsolete, but let's leave a crumb here for a
1742# while so that custom build scripts that expect it to exist don't choke.
1743lex-fix:
1744
1745snapshot::
1746	@echo "Creating snapshot $(PACKAGE_NAME)-$(PACKAGE_VERSION)"
1747	@$(MKDIR_P) snapshot
1748	@git archive --format=tar --prefix=$(PACKAGE_NAME)-$(PACKAGE_VERSION)/ HEAD | tar -C snapshot/ -x -f -
1749	@echo "creating tarfile"
1750	tar -C snapshot -c -f - $(PACKAGE_NAME)-$(PACKAGE_VERSION) | gzip -9 > $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
1751	@rm -rf snapshot
1752
1753docsrc/imap/reference/manpages/systemcommands/cyradm.rst: $(top_srcdir)/perl/imap/IMAP/Shell.pm
1754	@$(MKDIR_P) $(@D)
1755	$(AM_V_GEN)$(top_srcdir)/tools/perl2rst cyradm < $< > $@
1756
1757docsrc/imap/reference/manpages/configs/imapd.conf.rst: $(top_srcdir)/tools/config2rst $(top_srcdir)/lib/imapoptions
1758	@$(MKDIR_P) $(@D)
1759	$(AM_V_GEN)$(top_srcdir)/tools/config2rst $(top_srcdir)/lib/imapoptions > $@
1760
1761doc/examples/imapd_conf/imapd.conf.sample: $(top_srcdir)/tools/config2sample $(top_srcdir)/lib/imapoptions
1762	@$(MKDIR_P) $(@D)
1763	$(AM_V_GEN)$(top_srcdir)/tools/config2sample $(top_srcdir)/lib/imapoptions > $@
1764
1765docsrc/imap/reference/manpages/usercommands/sieveshell.rst: $(top_srcdir)/perl/sieve/scripts/sieveshell.pl
1766	@$(MKDIR_P) $(@D)
1767	$(AM_V_GEN)$(top_srcdir)/tools/perl2rst sieveshell < $< > $@
1768
1769%.1: man/.sphinx-build.stamp
1770	@$(MKDIR_P) $(@D)
1771	$(AM_V_GEN)touch $@
1772
1773%.3: man/.sphinx-build.stamp
1774	@$(MKDIR_P) $(@D)
1775	$(AM_V_GEN)touch $@
1776
1777%.5: man/.sphinx-build.stamp
1778	@$(MKDIR_P) $(@D)
1779	$(AM_V_GEN)touch $@
1780
1781%.8: man/.sphinx-build.stamp
1782	@$(MKDIR_P) $(@D)
1783	$(AM_V_GEN)touch $@
1784
1785## define this unconditionally because dist-hook references it
1786SPHINX_CACHE = docsrc/.doctrees
1787
1788.PHONY: clean-sphinx-cache clean-docsrc
1789clean-sphinx-cache:
1790	@$(RM) -r $(SPHINX_CACHE)
1791
1792if HAVE_SPHINX_BUILD
1793GENERATED_RSTS = docsrc/imap/reference/manpages/configs/imapd.conf.rst \
1794                 docsrc/imap/reference/manpages/systemcommands/cyradm.rst \
1795                 docsrc/imap/reference/manpages/usercommands/sieveshell.rst
1796
1797SPHINX_OPTS = -d $(SPHINX_CACHE) -n -q
1798
1799## detect when source directory is not build directory (i.e. VPATH
1800## build), and clone the docsrc tree into the build directory, so
1801## that we have a single "source directory" for sphinx-build to use.
1802docsrc/.sphinx-build.stamp:
1803	$(AM_V_GEN)test x"$(top_srcdir)" = x"$(top_builddir)" || \
1804        (cd $(top_srcdir) && tar cf - --mode=gu+w docsrc doc/examples) | tar xf -
1805	@touch $@
1806
1807clean-docsrc:
1808	test x"$(top_srcdir)" = x"$(top_builddir)" || \
1809		$(RM) -r $(top_builddir)/docsrc $(top_builddir)/doc/examples
1810
1811## XXX doesn't detect if other rst sources are updated...
1812man/.sphinx-build.stamp: $(GENERATED_RSTS) docsrc/.sphinx-build.stamp
1813	$(AM_V_GEN)DOCSRC=$(top_builddir)/docsrc $(SPHINX_BUILD) $(SPHINX_OPTS) -b cyrman $(top_builddir)/docsrc $(top_builddir)/man
1814	@touch $@
1815
1816clean-man:
1817	@$(RM) -r man
1818
1819## XXX doesn't detect if other rst sources are updated...
1820doc/html/.sphinx-build.stamp: $(GENERATED_RSTS) docsrc/.sphinx-build.stamp
1821	$(AM_V_GEN)DOCSRC=$(top_builddir)/docsrc $(SPHINX_BUILD) $(SPHINX_OPTS) -b html $(top_builddir)/docsrc $(top_builddir)/doc/html
1822	@touch $@
1823
1824## XXX doesn't detect if other rst sources are updated...
1825doc/text/.sphinx-build.stamp: $(GENERATED_RSTS) docsrc/.sphinx-build.stamp
1826	$(AM_V_GEN)DOCSRC=$(top_builddir)/docsrc $(SPHINX_BUILD) $(SPHINX_OPTS) -b text $(top_builddir)/docsrc $(top_builddir)/doc/text
1827	@touch $@
1828else
1829clean-docsrc:
1830
1831man/.sphinx-build.stamp:
1832	@$(MKDIR_P) $(@D)
1833	$(AM_V_GEN)touch $@
1834	@echo "warning: missing documentation dependencies. man pages will be empty" 1>&2
1835
1836clean-man:
1837
1838doc/html/.sphinx-build.stamp:
1839	@echo "error: missing documentation dependencies. cannot build html documentation" 1>&2
1840	@false
1841
1842doc/text/.sphinx-build.stamp:
1843	@echo "error: missing documentation dependencies. cannot build text documentation" 1>&2
1844	@false
1845endif
1846
1847.PHONY: man man-force clean-man
1848man-force:
1849	## trash the timestamps, so we always re-run sphinx-build.
1850	## sphinx-build tracks source modifications itself, so forced
1851	## rebuilds will still be a lot quicker once it has run once.
1852	@$(RM) docsrc/.sphinx-build.stamp man/.sphinx-build.stamp
1853
1854man: man-force $(dist_man1_MANS) $(dist_man3_MANS) $(dist_man5_MANS) $(dist_man8_MANS)
1855
1856# clean-man is conditionally defined above. We do not want to remove
1857# man pages if the user is unable to rebuild them.
1858
1859.PHONY: doc-html doc-html-force clean-doc-html
1860doc-html-force:
1861	@$(RM) docsrc/.sphinx-build.stamp doc/html/.sphinx-build.stamp
1862
1863doc-html: doc-html-force doc/html/.sphinx-build.stamp
1864
1865clean-doc-html:
1866	@$(RM) -r doc/html
1867
1868.PHONY: doc-text doc-text-force clean-doc-text
1869doc-text-force:
1870	@$(RM) docsrc/.sphinx-build.stamp doc/text/.sphinx-build.stamp
1871
1872doc-text: doc-text-force doc/text/.sphinx-build.stamp
1873
1874clean-doc-text:
1875	@$(RM) -r doc/text
1876
1877.PHONY: doc clean-doc
1878doc: man doc-html doc-text
1879
1880clean-doc: clean-man clean-doc-html clean-doc-text
1881
1882.PHONY: clean-local
1883clean-local: clean-doc clean-sphinx-cache clean-docsrc
1884
1885dist-old:: distgit
1886	@echo "creating configure"
1887	@cd dist/cyrus-imapd-$(PACKAGE_VERSION) ; sh SMakefile
1888	@for d in $(DIST_SUBDIRS); \
1889	do \
1890	(cd dist/cyrus-imapd-$(PACKAGE_VERSION)/$$d; \
1891	if [ -f Makefile.dist ]; then \
1892	echo "### Making" dist "in" `pwd`; \
1893	$(MAKE) $(MFLAGS) YACC='$(YACC)' LEX='$(LEX)' \
1894	COMPILE_ET='$(COMPILE_ET)' -f Makefile.dist dist ; \
1895	fi) || exit 1; \
1896	done
1897	@echo "creating tarfile"
1898	@cd dist ; tar cf - cyrus-imapd-$(PACKAGE_VERSION) | \
1899	gzip -9 > ../cyrus-imapd-$(PACKAGE_VERSION).tar.gz
1900	rm -f distgit
1901	rm -rf dist
1902
1903distgit:
1904	$(MKDIR_P) dist
1905	@echo "checking out the distribution from tag $(PACKAGE_NAME)-$(PACKAGE_VERSION)"
1906	git archive --format=tar --prefix=$(PACKAGE_NAME)-$(PACKAGE_VERSION)/ $(PACKAGE_NAME)-$(PACKAGE_VERSION) | tar -C dist -x -f -
1907	touch distgit
1908
1909dist-hook:
1910	find $(top_distdir) -type f -name .sphinx-build.stamp -delete
1911	rm -rf $(top_distdir)/$(SPHINX_CACHE)
1912
1913VERSION: tools/git-version.sh
1914	$(AM_V_GEN)$< > $@.NEW && mv $@.NEW $@
1915
1916install-data-hook:
1917if CMULOCAL
1918	$(INSTALL) -m 644 $(top_srcdir)/depot/depot.conf $(DESTDIR)/
1919endif
1920
1921install-exec-hook:
1922if PERL
1923	for s in installsieve sieveshell; \
1924	do \
1925	  $(MKDIR_P) $(top_builddir)/perl/sieve/scripts ; \
1926	  $(PERL_PREINSTALL) < $(top_srcdir)/perl/sieve/scripts/$$s.pl > $(top_builddir)/perl/sieve/scripts/$$s ;\
1927	  $(INSTALL) -m 755 $(top_builddir)/perl/sieve/scripts/$$s $(DESTDIR)$(bindir)/$$s ; \
1928	done
1929endif
1930
1931## The @$(MKDIR_P) line is added due to a bug in Automake 1.10 and can be removed if using Automake 1.12.
1932	@$(MKDIR_P) $(DESTDIR)$(libexecdir)
1933if SERVER
1934	cd $(DESTDIR)$(libexecdir) && \
1935	  $(LN_S) -f pop3d pop3proxyd && \
1936	  $(LN_S) -f imapd proxyd && \
1937	  $(LN_S) -f lmtpd lmtpproxyd
1938endif
1939## The @$(MKDIR_P) line is added due to a bug in Automake 1.10 and can be removed if using Automake 1.12.
1940	@$(MKDIR_P) $(DESTDIR)$(bindir)
1941	cd $(DESTDIR)$(bindir) && \
1942	  $(LN_S) -f imtest httptest && \
1943	  $(LN_S) -f imtest lmtptest && \
1944	  $(LN_S) -f imtest mupdatetest && \
1945	  $(LN_S) -f imtest nntptest && \
1946	  $(LN_S) -f imtest pop3test && \
1947	  $(LN_S) -f imtest sivtest && \
1948	  $(LN_S) -f imtest smtptest && \
1949	  $(LN_S) -f imtest synctest
1950
1951uninstall-hook: cyrus-makemaker-uninstall-workaround
1952if PERL
1953	for s in installsieve sieveshell; do \
1954	    rm -f $(DESTDIR)$(bindir)/$$s; \
1955	done
1956endif
1957
1958.PHONY: cyrus-makemaker-uninstall-workaround
1959
1960# Workaround for deprecated no-op MakeMaker uninstall.
1961# Don't remove the packlists themselves, otherwise MakeMaker uninstall will
1962# crash.  Just remove the files MakeMaker uninstall won't remove itself.
1963#
1964# We have another layer of workaround in each module's Makefile that
1965# removes the packlist after MakeMaker uninstall has finished ignoring it.
1966cyrus-makemaker-uninstall-workaround:
1967if PERL
1968	( packlists=`find $(DESTDIR)$(libdir) -type f -name .packlist` && \
1969	  echo "uninstalling files from packlists: $$packlists" && \
1970	  rm -f `cat $$packlists` )
1971	( podfiles=`find $(DESTDIR)$(libdir) -type f -name perllocal.pod` && \
1972	  rm -f `echo $$podfiles` )
1973endif
1974
1975install-binsymlinks:
1976## Let's symlink everything else
1977	for prog in $(sbin_PROGRAMS); do $(LN_S) -f $(sbindir)/`basename $$prog` $(DESTDIR)$(bindir)/; done
1978	for prog in $(libexec_PROGRAMS); do $(LN_S) -f $(libexecdir)/`basename $$prog` $(DESTDIR)$(bindir)/; done
1979
1980SUFFIXES = .fig.png
1981
1982.fig.png:
1983	fig2dev -L png $< $@
1984
1985valgrind:
1986	$(MAKE) VG=yes check
1987
1988libtool: $(LIBTOOL_DEPS)
1989	$(SHELL) ./config.status libtool
1990
1991# Install for Cassandane
1992cassandane:
1993	$(MAKE) DESTDIR=`cd ../inst ; /bin/pwd` install
1994