summaryrefslogtreecommitdiffstats
path: root/sqwebmail/Makefile.am
blob: 9cf514b9e781cf3bc3e8c9f0a20e37cbc3dcf9a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#
# Copyright 1998 - 2011 Double Precision, Inc.  See COPYING for
# distribution information.

@SET_MAKE@


AM_CPPFLAGS=@CPPAUTH@

CLEANFILES=htmllibdir.h ldapsearch webgpg ldapaddressbook.dist \
	cron.cmd sqwebmail.msg TIMEZONELIST
DISTCLEANFILES=webmail.authpam common.authpam

SUBDIRS=images html

scriptdir=@scriptdir@
script_SCRIPTS=sendit.sh cleancache.pl ldapsearch webgpg
sysconf_DATA=ldapaddressbook.dist sqwebmaild.dist
pkglibexecdir=@pkglibexecdir@
pkglibexec_PROGRAMS=sqwebpasswd

DOCS=SECURITY BUGS TODO SECURITY.html BUGS.html TODO.html
noinst_DATA=$(DOCS) TIMEZONELIST

#
#  Because cgibindir is not based on prefix, we must conditionally install
#  bin_PROGRAMS in install-exec-local, otherwise make distcheck will fail.
#

noinst_PROGRAMS=sqwebmail sqwebmaild showmsg2html testhtml testlogindomainlist

COMMONDEPENDENCIES=$(LIBOBJS) ../pcp/libpcp.la ../maildir/libmaildir.la \
	../rfc2045/librfc2045.la ../rfc822/librfc822.la \
	../rfc822/libencode.la \
	../liblock/liblock.la \
	../http11/libhttp11.la ../cgi/libcgi.la \
	../ldapaddressbook/libaddressbook.la \
	../gpglib/libgpg.la \
	../random128/librandom128.la ../md5/libmd5.la \
	../numlib/libnumlib.la \
	@dblibrary@
COMMONLDADD=$(COMMONDEPENDENCIES) `cat ../pcp/pcp.libs` -lcourier-unicode

noinst_LTLIBRARIES=libwebmail.la

libwebmail_la_SOURCES=filter.c filter.h msg2html.c msg2html.h html.c html.h \
			buf.c buf.h
libwebmail_la_DEPENDENCIES=$(COMMONDEPENDENCIES)
libwebmail_la_LIBADD=$(COMMONLDADD)
libwebmail_la_LDFLAGS=-static

showmsg2html_SOURCES=showmsg2html.c
showmsg2html_LDADD=libwebmail.la
showmsg2html_LDFLAGS=-static

ISPELLSOURCES=sqispell.c ispell.c ispell.h

BUILT_SOURCES=htmllibdir.h
if HAVE_SGML

GITFILES=sqwebmaild.dist.in

BUILT_SOURCES += $(GITFILES)

$(GITFILES): %: %.git
	perl -p -e 's/\$$Id:[^\$$]*/\$$Id: '"`git log --pretty=format:\"%H\" -n 1 -- $<`-`date +%Y%m%d%H%M%S`/" <$< >$@.tmp
	mv -f $@.tmp $@
endif

EXTRA_DIST=$(DOCS) sqwebmail.pamconf sqwebmail-system-auth.pamconf\
	 sqwebmail-common.pamconf sqwebmail-system-auth2.pamconf\
           strdup.c strcasecmp.c strncasecmp.c sv-make_timezonelist.pl\
           $(ISPELLSOURCES) \
	testhtml.tst testhtml.txt testlogindomainlist.sh testlogindomainlist.txt

testhtml_SOURCES=testhtml.c
testhtml_LDADD=libwebmail.la

#CFLAGS += -Dmalloc=my_malloc -Drealloc=my_realloc -Dfree=my_free -Dstrdup=my_strdup -Dcalloc=my_calloc

if ISPELL
SQISPELLSOURCES=$(ISPELLSOURCES)
endif


sqwebmaild_SOURCES=acl.c acl.h \
		addressbook.c addressbook.h args.c attachments.c \
		auth.c auth.h autoresponse.c autoresponse.h \
		changepw.c \
		folder.c folder.h gpg.c gpg.h \
		ldaplist.c logindomainlist.c logindomainlist.h \
		maildir.c maildir.h mailfilter.c \
		mailfilter.h mailinglist.c mailinglist.h newmsg.c newmsg.h \
		newmsg_create.c	newmsg_newdraft.c pcp.c pcp.h pref.c pref.h \
		sqconfig.c sqconfig.h sqwebmail.c \
		strftime.c strftime.h \
		sqwebmail.h token.c token.h $(SQISPELLSOURCES)

sqwebmaild_LDADD=libwebmail.la @NETLIBS@ @LDAUTH@ -lcourierauth `cat ../maildir/libmaildir.deps`
sqwebmaild_DEPENDENCIES=libwebmail.la ../maildir/libmaildir.deps

sqwebmail_SOURCES=sqwebmaild.c
sqwebmail_DEPENDENCIES= ../cgi/libcgi.la
sqwebmail_LDADD=@NETLIBS@ ../cgi/libcgi.la
sqwebmail_LDFLAGS=-static

sqwebpasswd_SOURCES=sqwebpasswd.c
sqwebpasswd_LDADD=@NETLIBS@ @LDAUTH@ -lcourierauth

SECURITY: SECURITY.html
	rm -f SECURITY
	elinks -dump -no-numbering $(srcdir)/SECURITY.html >SECURITY

BUGS: BUGS.html
	rm -f BUGS
	elinks -dump -no-numbering $(srcdir)/BUGS.html >BUGS

TODO: TODO.html
	rm -f TODO
	elinks -dump -no-numbering $(srcdir)/TODO.html >TODO

TIMEZONELIST: sv-make_timezonelist.pl
	rm -f TIMEZONELIST
	-@PERL@ $(srcdir)/sv-make_timezonelist.pl

install-perms:
	@$(MAKE) install-perms-recursive
	@$(MAKE) install-perms-local

install-perms-recursive:
	@>permissions.dat
	@SUBDIRS="$(SUBDIRS)" ; for f in $$SUBDIRS ; do ( cd $$f && $(MAKE) $(AM_MAKEFLAGS) install-perms ) ; cat /dev/null >>$$f/permissions.dat ; cat $$f/permissions.dat >>permissions.dat ; done

install-perms-local: install-perms-cache
	@echo "$(scriptdir)/webgpg 755 bin bin" >>permissions.dat
	@echo "$(scriptdir)/sendit.sh 755 bin bin" >>permissions.dat
	@echo "$(scriptdir)/ldapsearch 755 bin bin" >>permissions.dat
	@echo "$(sysconfdir)/ldapaddressbook.dist 644 root bin config" >>permissions.dat

htmllibdir.h: config.status
	echo '#define HTMLLIBDIR "@htmldir@"' >htmllibdir.h
	echo '#define SENDITSH "$(scriptdir)/sendit.sh"' >>htmllibdir.h
	echo '#define CALENDARMODE "$(sysconfdir)/calendarmode"' >>htmllibdir.h
	echo '#define LOGINDOMAINLIST "$(sysconfdir)/logindomainlist"' >>htmllibdir.h
	echo '#define MAXMSGSIZE @MAXMSGSIZE@' >>htmllibdir.h
	echo '#define IMGPATH "@imageurl@"' >>htmllibdir.h
	echo '#define SOCKDIR "$(localstatedir)"' >>htmllibdir.h
	echo '#define SHAREDINDEXFILE "$(sysconfdir)/shared/index"' >>htmllibdir.h
	echo '#define SQWEBPASSWD "$(pkglibexecdir)/sqwebpasswd"' >>htmllibdir.h
	if test -d $(srcdir)/../../courier \
		; then \
		echo '#define HOSTNAMEFILE "$(sysconfdir)/defaultdomain"' >>htmllibdir.h \
		; echo '#define MAKEMIME "$(bindir)/makemime"' >>htmllibdir.h \
		; else \
		echo '#define HOSTNAMEFILE "$(sysconfdir)/hostname"' >>htmllibdir.h \
		; echo '#define MAKEMIME "$(pkglibexecdir)/makemime"' >>htmllibdir.h \
		; fi
	echo '#define LDAPADDRESSBOOK "$(sysconfdir)/ldapaddressbook"' >>htmllibdir.h
	echo '#define LDAPSEARCH "$(scriptdir)/ldapsearch"' >>htmllibdir.h
	echo '#define AUTHCHARSET "$(sysconfdir)/authcharset"' >>htmllibdir.h

ldapsearch: ../ldapaddressbook/ldapsearch
	cp ../ldapaddressbook/ldapsearch .

webgpg: ../gpglib/webgpg
	cp ../gpglib/webgpg .

ldapaddressbook.dist: ../ldapaddressbook/ldapaddressbook.dist
	cp $(srcdir)/../ldapaddressbook/ldapaddressbook.dist .

install-data-local: cache-reminder

install-data-hook:
	chmod 755 $(DESTDIR)@htmldir@
	chmod 755 $(DESTDIR)$(scriptdir)

install-exec-hook:
	-chown @mailuser@ $(DESTDIR)$(pkglibexecdir)/sqwebpasswd
	-chgrp @mailgroup@ $(DESTDIR)$(pkglibexecdir)/sqwebpasswd
	-chmod 755 $(DESTDIR)$(pkglibexecdir)/sqwebpasswd
	-chmod g+s $(DESTDIR)$(pkglibexecdir)/sqwebpasswd

configure-check:
	@echo "URL to the image directory is @imageurl@"

install-perms-cache:
	@echo "$(scriptdir)/cleancache.pl 755 bin bin" >>permissions.dat
	@echo "@cachedir@ 700 @cacheowner@ bin" >>permissions.dat

cache-reminder:
	-$(mkinstalldirs) $(DESTDIR)@cachedir@
	-$(mkinstalldirs) $(DESTDIR)$(piddir)
	test -w /etc || exit 0; chown @cacheowner@ $(DESTDIR)@cachedir@
	@rm -f cron.cmd
	@echo '#! @SHELL@' >cron.cmd
	@echo 'su -p -c "$(scriptdir)/cleancache.pl" @cacheowner@' >>cron.cmd
	@chmod 555 cron.cmd
	@cp /dev/null sqwebmail.msg
	@echo '-----------------------------------------------------------' >>sqwebmail.msg
	@echo 'You must now add the following command to your system startup script:' >>sqwebmail.msg
	@echo '' >>sqwebmail.msg
	@if test -d $(srcdir)/../../courier \
		; then \
	echo '$(sbindir)/webmaild start' >>sqwebmail.msg ; else \
	echo '$(libexecdir)/sqwebmaild.rc start' >>sqwebmail.msg ; fi
	@echo '' >>sqwebmail.msg
	@echo 'You must now create the following cron job that runs at' >>sqwebmail.msg
	@echo 'regular intervals:' >>sqwebmail.msg
	@echo '' >>sqwebmail.msg
	@echo 'su -c "$(scriptdir)/cleancache.pl" @cacheowner@' >>sqwebmail.msg
	@echo '' >>sqwebmail.msg
	@echo '-----------------------------------------------------------' >>sqwebmail.msg
	@echo '(note - your su command may use slightly different arguments)' >>sqwebmail.msg
	@echo '' >>sqwebmail.msg
	@echo '' >>sqwebmail.msg

testlogindomainlist_SOURCES=testlogindomainlist.c logindomainlist.c

check-am:
	./testhtml <$(srcdir)/testhtml.tst | diff -U 3 $(srcdir)/testhtml.txt -
	@SHELL@ $(srcdir)/testlogindomainlist.sh | diff -U 3 $(srcdir)/testlogindomainlist.txt -