bind_patterns
[hcoop/domtool2.git] / Makefile
CommitLineData
6b718954 1all: mlton bin/vmailpasswd elisp/domtool-tables.el
7aa78013
AC
2
3bin/vmailpasswd: src/mail/vmailpasswd.c
4 $(CC) -lcrypt -o $@ $<
0d2ce070 5
a49a9bfb 6COMMON_DEPS := configDefault/config.sig configDefault/configDefault.sml \
931aae14 7 openssl/openssl_sml.so pcre/pcre_sml.so config.sml
9c8a9ef4 8
4542571e
AC
9EMACS_DIR := /usr/local/share/emacs/site-lisp/domtool-mode
10
9c8a9ef4
AM
11config.sml:
12 echo -e 'structure Config :> CONFIG = struct\nopen ConfigDefault\nend' > $@
a49a9bfb 13
690a19c3 14.PHONY: all mlton smlnj install install_sos
a49a9bfb 15
44a5ce2f 16mlton: bin/domtool-server bin/domtool-client bin/domtool-slave \
2bc5ed22 17 bin/domtool-admin bin/domtool-doc bin/dbtool bin/vmail \
3fbc6b4a 18 bin/smtplog bin/setsa bin/mysql-fixperms bin/webbw
a49a9bfb 19
931aae14
AC
20smlnj: $(COMMON_DEPS) openssl/smlnj/FFI/libssl.h.cm pcre/smlnj/FFI/libpcre.h.cm \
21 src/domtool.cm
0d2ce070
AC
22
23configDefault/config.sig: src/config.sig.header \
8df2e702
AC
24 configDefault/*.csg configDefault/*.cfs \
25 src/config.sig.footer
26 cat configDefault/*.csg \
27 src/config.sig.header \
0d2ce070
AC
28 configDefault/*.cfs \
29 src/config.sig.footer \
30 >configDefault/config.sig
31
32configDefault/configDefault.sml: src/configDefault.sml.header \
33 configDefault/*.cfg src/configDefault.sml.footer
34 cat src/configDefault.sml.header \
35 configDefault/*.cfg \
36 src/configDefault.sml.footer \
37 >configDefault/configDefault.sml
38
559e89e9
AC
39openssl/openssl_sml.o: openssl/openssl_sml.c
40 gcc -fPIC -c openssl/openssl_sml.c -o openssl/openssl_sml.o
41
42openssl/openssl_sml.so: openssl/openssl_sml.o
43 gcc -shared -Wl,-soname,openssl_sml.so \
44 -o openssl/openssl_sml.so \
45 openssl/openssl_sml.o -lssl
46
931aae14
AC
47pcre/pcre_sml.o: pcre/pcre_sml.c
48 gcc -fPIC -c pcre/pcre_sml.c -o pcre/pcre_sml.o
49
50pcre/pcre_sml.so: pcre/pcre_sml.o
51 gcc -shared -Wl,-soname,pcre_sml.so \
52 -o pcre/pcre_sml.so \
53 pcre/pcre_sml.o -lpcre
54
d541c618 55src/domtool.cm: src/prefix.cm src/sources
a49a9bfb
AC
56 cat src/prefix.cm src/sources >src/domtool.cm
57
7a2b27f0
AC
58MAKE_MLB_BASE := cat src/prefix.mlb src/sources src/suffix.mlb \
59 | sed 's/^\(.*\).grm$$/\1.grm.sig\n\1.grm.sml/' \
60 | sed 's/^\(.*\).lex$$/\1.lex.sml/'
61
d541c618 62src/domtool-server.mlb: src/prefix.mlb src/sources src/suffix.mlb
7a2b27f0 63 $(MAKE_MLB_BASE) >src/domtool-server.mlb
a49a9bfb
AC
64 echo "main-server.sml" >>src/domtool-server.mlb
65
d541c618 66src/domtool-client.mlb: src/prefix.mlb src/sources src/suffix.mlb
7a2b27f0 67 $(MAKE_MLB_BASE) >src/domtool-client.mlb
361a1e7f
AC
68 echo "main-client.sml" >>src/domtool-client.mlb
69
d541c618 70src/domtool-slave.mlb: src/prefix.mlb src/sources src/suffix.mlb
7a2b27f0 71 $(MAKE_MLB_BASE) >src/domtool-slave.mlb
1c246434
AC
72 echo "main-slave.sml" >>src/domtool-slave.mlb
73
d541c618 74src/domtool-admin.mlb: src/prefix.mlb src/sources src/suffix.mlb
5ee41dd0
AC
75 $(MAKE_MLB_BASE) >src/domtool-admin.mlb
76 echo "main-admin.sml" >>src/domtool-admin.mlb
77
d541c618 78src/domtool-doc.mlb: src/prefix.mlb src/sources src/suffix.mlb
44a5ce2f
AC
79 $(MAKE_MLB_BASE) >src/domtool-doc.mlb
80 echo "main-doc.sml" >>src/domtool-doc.mlb
81
d541c618
AC
82src/dbtool.mlb: src/prefix.mlb src/sources src/suffix.mlb
83 $(MAKE_MLB_BASE) >src/dbtool.mlb
84 echo "main-dbtool.sml" >>src/dbtool.mlb
85
08688401
AC
86src/vmail.mlb: src/prefix.mlb src/sources src/suffix.mlb
87 $(MAKE_MLB_BASE) >src/vmail.mlb
88 echo "main-vmail.sml" >>src/vmail.mlb
89
2e96b9d4
AC
90src/setsa.mlb: src/prefix.mlb src/sources src/suffix.mlb
91 $(MAKE_MLB_BASE) >src/setsa.mlb
92 echo "main-setsa.sml" >>src/setsa.mlb
93
2bc5ed22
AC
94src/smtplog.mlb: src/prefix.mlb src/sources src/suffix.mlb
95 $(MAKE_MLB_BASE) >src/smtplog.mlb
96 echo "main-smtplog.sml" >>src/smtplog.mlb
97
00a077ab
AC
98src/mysql-fixperms.mlb: src/prefix.mlb src/sources src/suffix.mlb
99 $(MAKE_MLB_BASE) >src/mysql-fixperms.mlb
100 echo "main-mysql-fixperms.sml" >>src/mysql-fixperms.mlb
101
559e89e9
AC
102openssl/smlnj/FFI/libssl.h.cm: openssl/openssl_sml.h
103 cd openssl/smlnj ; ml-nlffigen -d FFI -lh LibsslH.libh -include ../libssl-h.sml \
104 -cm libssl.h.cm -D__builtin_va_list="void*" \
105 ../openssl_sml.h
a49a9bfb
AC
106
107openssl/mlton/FFI/libssl.h.mlb: openssl/openssl_sml.h
108 cd openssl/mlton ; mlnlffigen -dir FFI -libhandle LibsslH.libh -include ../libssl-h.sml \
109 -mlbfile libssl.h.mlb -cppopt -D__builtin_va_list="void*" \
110 ../openssl_sml.h
111
931aae14
AC
112pcre/smlnj/FFI/libpcre.h.cm: pcre/pcre_sml.h
113 cd pcre/smlnj ; ml-nlffigen -d FFI -lh LibpcreH.libh -include ../libpcre-h.sml \
114 -cm libpcre.h.cm -D__builtin_va_list="void*" \
115 ../pcre_sml.h
116
117pcre/mlton/FFI/libpcre.h.mlb: pcre/pcre_sml.h
118 cd pcre/mlton ; mlnlffigen -dir FFI -libhandle LibpcreH.libh -include ../libpcre-h.sml \
119 -mlbfile libpcre.h.mlb -cppopt -D__builtin_va_list="void*" \
120 ../pcre_sml.h
121
a49a9bfb 122%.lex.sml: %.lex
a088cea6 123 mllex $<
a49a9bfb
AC
124
125%.grm.sig %.grm.sml: %.grm
a088cea6 126 mlyacc $<
a49a9bfb 127
7a2b27f0 128COMMON_MLTON_DEPS := openssl/mlton/FFI/libssl.h.mlb \
931aae14 129 pcre/mlton/FFI/libpcre.h.mlb \
7a2b27f0
AC
130 src/domtool.lex.sml \
131 src/domtool.grm.sig src/domtool.grm.sml \
132 $(COMMON_DEPS) src/*.sig src/*.sml \
9ffe2f0f
AC
133 src/plugins/*.sig src/plugins/*.sml \
134 src/mail/*.sig src/mail/*.sml
7a2b27f0 135
e0b80e65
AC
136MLTON := mlton -link-opt -ldl
137
138ifdef DEBUG
139 MLTON += -const 'Exn.keepHistory true'
140endif
141
7a2b27f0 142bin/domtool-server: $(COMMON_MLTON_DEPS) src/domtool-server.mlb
e0b80e65 143 $(MLTON) -output bin/domtool-server src/domtool-server.mlb
361a1e7f 144
7a2b27f0 145bin/domtool-client: $(COMMON_MLTON_DEPS) src/domtool-client.mlb
e0b80e65 146 $(MLTON) -output bin/domtool-client src/domtool-client.mlb
361a1e7f 147
7a2b27f0 148bin/domtool-slave: $(COMMON_MLTON_DEPS) src/domtool-slave.mlb
e0b80e65 149 $(MLTON) -output bin/domtool-slave src/domtool-slave.mlb
1c246434 150
5ee41dd0 151bin/domtool-admin: $(COMMON_MLTON_DEPS) src/domtool-admin.mlb
e0b80e65 152 $(MLTON) -output bin/domtool-admin src/domtool-admin.mlb
5ee41dd0 153
44a5ce2f 154bin/domtool-doc: $(COMMON_MLTON_DEPS) src/domtool-doc.mlb
e0b80e65 155 $(MLTON) -output bin/domtool-doc src/domtool-doc.mlb
44a5ce2f 156
d541c618 157bin/dbtool: $(COMMON_MLTON_DEPS) src/dbtool.mlb
e0b80e65 158 $(MLTON) -output bin/dbtool src/dbtool.mlb
d541c618 159
08688401 160bin/vmail: $(COMMON_MLTON_DEPS) src/vmail.mlb
e0b80e65 161 $(MLTON) -output bin/vmail src/vmail.mlb
08688401 162
2e96b9d4 163bin/setsa: $(COMMON_MLTON_DEPS) src/setsa.mlb
ac64d96d 164 $(MLTON) -output bin/setsa src/setsa.mlb
2e96b9d4 165
2bc5ed22 166bin/smtplog: $(COMMON_MLTON_DEPS) src/smtplog.mlb
e0b80e65 167 $(MLTON) -output bin/smtplog src/smtplog.mlb
2bc5ed22 168
00a077ab
AC
169bin/mysql-fixperms: $(COMMON_MLTON_DEPS) src/mysql-fixperms.mlb
170 $(MLTON) -output bin/mysql-fixperms src/mysql-fixperms.mlb
171
f086616f
AC
172bin/webbw: $(COMMON_MLTON_DEPS) src/stats/webbw.mlb
173 mlton -output bin/webbw src/stats/webbw.mlb
174
6b718954
AC
175elisp/domtool-tables.el: lib/*.dtl bin/domtool-doc
176 bin/domtool-doc -basis -emacs >$@
177
690a19c3
AC
178install_sos:
179 cp openssl/openssl_sml.so /usr/local/lib/
180 cp pcre/pcre_sml.so /usr/local/lib/
181
182install: install_sos
27e20924 183 cp scripts/domtool-publish /usr/local/sbin/
8ae99fef
AC
184 cp scripts/domtool-reset-global /usr/local/sbin/
185 cp scripts/domtool-reset-local /usr/local/sbin/
385c3534
AC
186 cp scripts/domtool-adduser /usr/local/bin/
187 cp scripts/domtool-addcert /usr/local/bin/
25c93232 188 cp scripts/domtool-addcert-daemon /usr/local/bin/
385c3534
AC
189 cp scripts/domtool-addacl /usr/local/bin/
190 cp scripts/domtool-rmuser /usr/local/bin/
62260c5f
AC
191 cp scripts/domtool-admin-sudo /usr/local/bin/
192 cp scripts/domtool-server-logged /usr/local/bin/
c9731b9b
AC
193 cp scripts/domtool-slave-logged /usr/local/bin/
194 cp scripts/domtool-server /etc/init.d/
195 cp scripts/domtool-slave /etc/init.d/
76bad1b2
AC
196 -cp bin/domtool-server /usr/local/sbin/
197 -cp bin/domtool-slave /usr/local/sbin/
198 -cp bin/domtool-client /usr/local/bin/domtool
199 -cp bin/domtool-admin /usr/local/bin/
200 -cp bin/domtool-doc /usr/local/bin/
d541c618 201 -cp bin/dbtool /usr/local/bin/
08688401 202 -cp bin/vmail /usr/local/bin/
2e96b9d4 203 -cp bin/setsa /usr/local/bin/
2bc5ed22 204 -cp bin/smtplog /usr/local/bin/
00a077ab 205 -cp bin/mysql-fixperms /usr/local/bin/
7aa78013 206 -cp bin/vmailpasswd /usr/local/bin/
f086616f 207 -cp bin/webbw /usr/local/sbin/
d541c618 208 cp src/plugins/domtool-postgres /usr/local/sbin/
ae147938 209 cp src/plugins/domtool-mysql /usr/local/sbin/
e903f398 210 -mkdir -p $(EMACS_DIR)
4542571e 211 cp elisp/*.el $(EMACS_DIR)/
15e529d6 212
5982c377 213.PHONY: grab_lib install_server install_slave
15e529d6
AC
214
215grab_lib:
728f7033 216 rsync -r --delete /afs/hcoop.net/common/etc/domtool/lib/* lib/
5982c377
AC
217
218install_server:
219 sudo /etc/init.d/domtool-server stop
220 sudo make install
221 sudo /etc/init.d/domtool-server start
29920c95
AC
222
223install_slave:
224 sudo /etc/init.d/domtool-slave stop
225 sudo make install
226 sudo /etc/init.d/domtool-slave start