web_apps: don't instantiate php5 in wordPress
[hcoop/domtool2.git] / Makefile
CommitLineData
2679ec89
CE
1# Supported flags
2# BUILD32=1 Target 32-bit x86 (Doesn't Work)
3# TC=1 Stop after typchecking when building using mlton
4# DEBUG=1 Keep debugging information when building using mlton
5
6b718954 6all: mlton bin/vmailpasswd elisp/domtool-tables.el
7aa78013
AC
7
8bin/vmailpasswd: src/mail/vmailpasswd.c
2679ec89
CE
9 $(CC) $(CFLAGS) -lcrypt -o $@ $<
10
11ifeq ($(BUILD32), 1)
12 CFLAGS += -m32
13endif
0d2ce070 14
a49a9bfb 15COMMON_DEPS := configDefault/config.sig configDefault/configDefault.sml \
931aae14 16 openssl/openssl_sml.so pcre/pcre_sml.so config.sml
9c8a9ef4 17
4542571e
AC
18EMACS_DIR := /usr/local/share/emacs/site-lisp/domtool-mode
19
2679ec89
CE
20clean:
21 rm -f bin/*
22 rm -f openssl/openssl_sml.so
23 rm -f openssl/openssl_sml.o
24 rm -f pcre/pcre_sml.so
25 rm -f pcre/pcre_sml.o
26
9c8a9ef4 27config.sml:
883dd79c 28 /bin/echo -e 'structure Config :> CONFIG = struct\nopen ConfigDefault\nend' > $@
a49a9bfb 29
690a19c3 30.PHONY: all mlton smlnj install install_sos
a49a9bfb 31
44a5ce2f 32mlton: bin/domtool-server bin/domtool-client bin/domtool-slave \
2bc5ed22 33 bin/domtool-admin bin/domtool-doc bin/dbtool bin/vmail \
a8e88df7 34 bin/smtplog bin/setsa bin/mysql-fixperms bin/webbw bin/domtool-tail \
0e0442b0 35 bin/fwtool bin/domtool-config bin/domtool-portal
a49a9bfb 36
931aae14
AC
37smlnj: $(COMMON_DEPS) openssl/smlnj/FFI/libssl.h.cm pcre/smlnj/FFI/libpcre.h.cm \
38 src/domtool.cm
979844d5 39 CFLAGS += -m32
0d2ce070 40
979844d5 41configDefault/config.sig: config/core/core.sig src/config.sig.header \
8df2e702
AC
42 configDefault/*.csg configDefault/*.cfs \
43 src/config.sig.footer
44 cat configDefault/*.csg \
45 src/config.sig.header \
0d2ce070
AC
46 configDefault/*.cfs \
47 src/config.sig.footer \
48 >configDefault/config.sig
49
979844d5 50configDefault/configDefault.sml: config/core/core.sml src/configDefault.sml.header \
0d2ce070
AC
51 configDefault/*.cfg src/configDefault.sml.footer
52 cat src/configDefault.sml.header \
53 configDefault/*.cfg \
54 src/configDefault.sml.footer \
55 >configDefault/configDefault.sml
56
559e89e9 57openssl/openssl_sml.o: openssl/openssl_sml.c
2679ec89 58 gcc $(CFLAGS) -fPIC -c openssl/openssl_sml.c -o openssl/openssl_sml.o
559e89e9
AC
59
60openssl/openssl_sml.so: openssl/openssl_sml.o
2679ec89 61 gcc $(CFLAGS) -shared -Wl,-soname,openssl_sml.so \
559e89e9
AC
62 -o openssl/openssl_sml.so \
63 openssl/openssl_sml.o -lssl
64
931aae14 65pcre/pcre_sml.o: pcre/pcre_sml.c
2679ec89 66 gcc $(CFLAGS) -fPIC -c pcre/pcre_sml.c -o pcre/pcre_sml.o
931aae14
AC
67
68pcre/pcre_sml.so: pcre/pcre_sml.o
2679ec89 69 gcc $(CFLAGS) -shared -Wl,-soname,pcre_sml.so \
931aae14
AC
70 -o pcre/pcre_sml.so \
71 pcre/pcre_sml.o -lpcre
72
d541c618 73src/domtool.cm: src/prefix.cm src/sources
a49a9bfb
AC
74 cat src/prefix.cm src/sources >src/domtool.cm
75
7a2b27f0
AC
76MAKE_MLB_BASE := cat src/prefix.mlb src/sources src/suffix.mlb \
77 | sed 's/^\(.*\).grm$$/\1.grm.sig\n\1.grm.sml/' \
78 | sed 's/^\(.*\).lex$$/\1.lex.sml/'
79
d541c618 80src/domtool-server.mlb: src/prefix.mlb src/sources src/suffix.mlb
7a2b27f0 81 $(MAKE_MLB_BASE) >src/domtool-server.mlb
a49a9bfb
AC
82 echo "main-server.sml" >>src/domtool-server.mlb
83
d541c618 84src/domtool-client.mlb: src/prefix.mlb src/sources src/suffix.mlb
7a2b27f0 85 $(MAKE_MLB_BASE) >src/domtool-client.mlb
361a1e7f
AC
86 echo "main-client.sml" >>src/domtool-client.mlb
87
d541c618 88src/domtool-slave.mlb: src/prefix.mlb src/sources src/suffix.mlb
7a2b27f0 89 $(MAKE_MLB_BASE) >src/domtool-slave.mlb
1c246434
AC
90 echo "main-slave.sml" >>src/domtool-slave.mlb
91
d541c618 92src/domtool-admin.mlb: src/prefix.mlb src/sources src/suffix.mlb
5ee41dd0
AC
93 $(MAKE_MLB_BASE) >src/domtool-admin.mlb
94 echo "main-admin.sml" >>src/domtool-admin.mlb
95
d541c618 96src/domtool-doc.mlb: src/prefix.mlb src/sources src/suffix.mlb
44a5ce2f
AC
97 $(MAKE_MLB_BASE) >src/domtool-doc.mlb
98 echo "main-doc.sml" >>src/domtool-doc.mlb
99
d541c618
AC
100src/dbtool.mlb: src/prefix.mlb src/sources src/suffix.mlb
101 $(MAKE_MLB_BASE) >src/dbtool.mlb
102 echo "main-dbtool.sml" >>src/dbtool.mlb
103
08688401
AC
104src/vmail.mlb: src/prefix.mlb src/sources src/suffix.mlb
105 $(MAKE_MLB_BASE) >src/vmail.mlb
106 echo "main-vmail.sml" >>src/vmail.mlb
107
2e96b9d4
AC
108src/setsa.mlb: src/prefix.mlb src/sources src/suffix.mlb
109 $(MAKE_MLB_BASE) >src/setsa.mlb
110 echo "main-setsa.sml" >>src/setsa.mlb
111
2bc5ed22
AC
112src/smtplog.mlb: src/prefix.mlb src/sources src/suffix.mlb
113 $(MAKE_MLB_BASE) >src/smtplog.mlb
114 echo "main-smtplog.sml" >>src/smtplog.mlb
115
00a077ab
AC
116src/mysql-fixperms.mlb: src/prefix.mlb src/sources src/suffix.mlb
117 $(MAKE_MLB_BASE) >src/mysql-fixperms.mlb
118 echo "main-mysql-fixperms.sml" >>src/mysql-fixperms.mlb
119
a8e88df7
CE
120src/fwtool.mlb: src/prefix.mlb src/sources src/suffix.mlb
121 $(MAKE_MLB_BASE) >src/fwtool.mlb
122 echo "main-fwtool.sml" >>src/fwtool.mlb
123
0d437aa6
CE
124src/domtool-config.mlb: src/prefix.mlb src/sources src/suffix.mlb
125 $(MAKE_MLB_BASE) >src/domtool-config.mlb
126 echo "main-config.sml" >>src/domtool-config.mlb
127
0e0442b0
CE
128src/domtool-portal.mlb: src/prefix.mlb src/sources src/suffix.mlb
129 $(MAKE_MLB_BASE) >src/domtool-portal.mlb
130 echo "main-portal.sml" >>src/domtool-portal.mlb
131
559e89e9
AC
132openssl/smlnj/FFI/libssl.h.cm: openssl/openssl_sml.h
133 cd openssl/smlnj ; ml-nlffigen -d FFI -lh LibsslH.libh -include ../libssl-h.sml \
134 -cm libssl.h.cm -D__builtin_va_list="void*" \
135 ../openssl_sml.h
a49a9bfb
AC
136
137openssl/mlton/FFI/libssl.h.mlb: openssl/openssl_sml.h
138 cd openssl/mlton ; mlnlffigen -dir FFI -libhandle LibsslH.libh -include ../libssl-h.sml \
139 -mlbfile libssl.h.mlb -cppopt -D__builtin_va_list="void*" \
140 ../openssl_sml.h
141
931aae14
AC
142pcre/smlnj/FFI/libpcre.h.cm: pcre/pcre_sml.h
143 cd pcre/smlnj ; ml-nlffigen -d FFI -lh LibpcreH.libh -include ../libpcre-h.sml \
144 -cm libpcre.h.cm -D__builtin_va_list="void*" \
145 ../pcre_sml.h
146
147pcre/mlton/FFI/libpcre.h.mlb: pcre/pcre_sml.h
148 cd pcre/mlton ; mlnlffigen -dir FFI -libhandle LibpcreH.libh -include ../libpcre-h.sml \
149 -mlbfile libpcre.h.mlb -cppopt -D__builtin_va_list="void*" \
150 ../pcre_sml.h
151
a49a9bfb 152%.lex.sml: %.lex
a088cea6 153 mllex $<
a49a9bfb
AC
154
155%.grm.sig %.grm.sml: %.grm
a088cea6 156 mlyacc $<
a49a9bfb 157
7a2b27f0 158COMMON_MLTON_DEPS := openssl/mlton/FFI/libssl.h.mlb \
931aae14 159 pcre/mlton/FFI/libpcre.h.mlb \
7a2b27f0
AC
160 src/domtool.lex.sml \
161 src/domtool.grm.sig src/domtool.grm.sml \
162 $(COMMON_DEPS) src/*.sig src/*.sml \
9ffe2f0f
AC
163 src/plugins/*.sig src/plugins/*.sml \
164 src/mail/*.sig src/mail/*.sml
7a2b27f0 165
e0b80e65
AC
166MLTON := mlton -link-opt -ldl
167
2679ec89
CE
168ifeq ($(BUILD32),1)
169 MLTON += -codegen c -target i386 -cc-opt -m32
170endif
171
172ifeq ($(DEBUG), 1)
e0b80e65
AC
173 MLTON += -const 'Exn.keepHistory true'
174endif
175
2679ec89
CE
176ifeq ($(TC), 1)
177 MLTON += -stop tc
178endif
179
7a2b27f0 180bin/domtool-server: $(COMMON_MLTON_DEPS) src/domtool-server.mlb
e0b80e65 181 $(MLTON) -output bin/domtool-server src/domtool-server.mlb
361a1e7f 182
7a2b27f0 183bin/domtool-client: $(COMMON_MLTON_DEPS) src/domtool-client.mlb
e0b80e65 184 $(MLTON) -output bin/domtool-client src/domtool-client.mlb
361a1e7f 185
7a2b27f0 186bin/domtool-slave: $(COMMON_MLTON_DEPS) src/domtool-slave.mlb
e0b80e65 187 $(MLTON) -output bin/domtool-slave src/domtool-slave.mlb
1c246434 188
5ee41dd0 189bin/domtool-admin: $(COMMON_MLTON_DEPS) src/domtool-admin.mlb
e0b80e65 190 $(MLTON) -output bin/domtool-admin src/domtool-admin.mlb
5ee41dd0 191
44a5ce2f 192bin/domtool-doc: $(COMMON_MLTON_DEPS) src/domtool-doc.mlb
e0b80e65 193 $(MLTON) -output bin/domtool-doc src/domtool-doc.mlb
44a5ce2f 194
d541c618 195bin/dbtool: $(COMMON_MLTON_DEPS) src/dbtool.mlb
e0b80e65 196 $(MLTON) -output bin/dbtool src/dbtool.mlb
d541c618 197
08688401 198bin/vmail: $(COMMON_MLTON_DEPS) src/vmail.mlb
e0b80e65 199 $(MLTON) -output bin/vmail src/vmail.mlb
08688401 200
2e96b9d4 201bin/setsa: $(COMMON_MLTON_DEPS) src/setsa.mlb
ac64d96d 202 $(MLTON) -output bin/setsa src/setsa.mlb
2e96b9d4 203
2bc5ed22 204bin/smtplog: $(COMMON_MLTON_DEPS) src/smtplog.mlb
e0b80e65 205 $(MLTON) -output bin/smtplog src/smtplog.mlb
2bc5ed22 206
00a077ab
AC
207bin/mysql-fixperms: $(COMMON_MLTON_DEPS) src/mysql-fixperms.mlb
208 $(MLTON) -output bin/mysql-fixperms src/mysql-fixperms.mlb
209
a8e88df7
CE
210bin/fwtool: $(COMMON_MLTON_DEPS) src/fwtool.mlb
211 $(MLTON) -output bin/fwtool src/fwtool.mlb
212
e7957d00 213bin/webbw: $(COMMON_MLTON_DEPS) src/stats/webbw.mlb src/stats/*.sml
f086616f
AC
214 mlton -output bin/webbw src/stats/webbw.mlb
215
e7957d00
AC
216bin/domtool-tail: $(COMMON_MLTON_DEPS) src/tail/tail.mlb src/tail/*.sml
217 mlton -output bin/domtool-tail src/tail/tail.mlb
218
0d437aa6
CE
219bin/domtool-config: $(COMMON_MLTON_DEPS) src/domtool-config.mlb src/main-config.sml
220 $(MLTON) -output bin/domtool-config src/domtool-config.mlb
221
0e0442b0
CE
222bin/domtool-portal: $(COMMON_MLTON_DEPS) src/domtool-portal.mlb src/main-portal.sml
223 $(MLTON) -output bin/domtool-portal src/domtool-portal.mlb
224
6b718954
AC
225elisp/domtool-tables.el: lib/*.dtl bin/domtool-doc
226 bin/domtool-doc -basis -emacs >$@
227
690a19c3
AC
228install_sos:
229 cp openssl/openssl_sml.so /usr/local/lib/
230 cp pcre/pcre_sml.so /usr/local/lib/
231
232install: install_sos
27e20924 233 cp scripts/domtool-publish /usr/local/sbin/
8ae99fef
AC
234 cp scripts/domtool-reset-global /usr/local/sbin/
235 cp scripts/domtool-reset-local /usr/local/sbin/
0e0442b0 236 cp scripts/domtool-vmailpasswd /usr/local/sbin/
385c3534
AC
237 cp scripts/domtool-adduser /usr/local/bin/
238 cp scripts/domtool-addcert /usr/local/bin/
c235081a 239 cp scripts/domtool-readdcerts /usr/local/bin/
385c3534
AC
240 cp scripts/domtool-addacl /usr/local/bin/
241 cp scripts/domtool-rmuser /usr/local/bin/
62260c5f
AC
242 cp scripts/domtool-admin-sudo /usr/local/bin/
243 cp scripts/domtool-server-logged /usr/local/bin/
c9731b9b
AC
244 cp scripts/domtool-slave-logged /usr/local/bin/
245 cp scripts/domtool-server /etc/init.d/
246 cp scripts/domtool-slave /etc/init.d/
76bad1b2
AC
247 -cp bin/domtool-server /usr/local/sbin/
248 -cp bin/domtool-slave /usr/local/sbin/
249 -cp bin/domtool-client /usr/local/bin/domtool
250 -cp bin/domtool-admin /usr/local/bin/
251 -cp bin/domtool-doc /usr/local/bin/
d541c618 252 -cp bin/dbtool /usr/local/bin/
a8e88df7 253 -cp bin/fwtool /usr/local/bin/
08688401 254 -cp bin/vmail /usr/local/bin/
2e96b9d4 255 -cp bin/setsa /usr/local/bin/
2bc5ed22 256 -cp bin/smtplog /usr/local/bin/
00a077ab 257 -cp bin/mysql-fixperms /usr/local/bin/
7aa78013 258 -cp bin/vmailpasswd /usr/local/bin/
f086616f 259 -cp bin/webbw /usr/local/sbin/
e7957d00
AC
260 -cp bin/domtool-tail /usr/local/bin/
261 -chmod +s /usr/local/bin/domtool-tail
0d437aa6 262 cp bin/domtool-config /usr/local/bin/
0e0442b0 263 cp bin/domtool-portal /usr/local/sbin/
d541c618 264 cp src/plugins/domtool-postgres /usr/local/sbin/
ae147938 265 cp src/plugins/domtool-mysql /usr/local/sbin/
e903f398 266 -mkdir -p $(EMACS_DIR)
4542571e 267 cp elisp/*.el $(EMACS_DIR)/
15e529d6 268
5982c377 269.PHONY: grab_lib install_server install_slave
15e529d6
AC
270
271grab_lib:
728f7033 272 rsync -r --delete /afs/hcoop.net/common/etc/domtool/lib/* lib/
5982c377 273
20a7e975
CE
274install_serverslave:
275 /etc/init.d/domtool-server stop
276 /etc/init.d/domtool-slave stop
277 make install
278 /etc/init.d/domtool-server start
279 /etc/init.d/domtool-slave start
280
5982c377 281install_server:
20a7e975
CE
282 /etc/init.d/domtool-server stop
283 make install
284 /etc/init.d/domtool-server start
29920c95
AC
285
286install_slave:
20a7e975
CE
287 /etc/init.d/domtool-slave stop
288 make install
289 /etc/init.d/domtool-slave start