Now builds with MLton
[hcoop/domtool2.git] / Makefile
1 all: mlton
2
3 COMMON_DEPS := configDefault/config.sig configDefault/configDefault.sml \
4 openssl/openssl_sml.so
5
6 .PHONY: all mlton smlnj
7
8 mlton: bin/domtool-server
9
10 smlnj: $(COMMON_DEPS) openssl/smlnj/FFI/libssl.h.cm src/domtool.cm
11
12 configDefault/config.sig: src/config.sig.header \
13 configDefault/*.csg configDefault/*.cfs \
14 src/config.sig.footer
15 cat configDefault/*.csg \
16 src/config.sig.header \
17 configDefault/*.cfs \
18 src/config.sig.footer \
19 >configDefault/config.sig
20
21 configDefault/configDefault.sml: src/configDefault.sml.header \
22 configDefault/*.cfg src/configDefault.sml.footer
23 cat src/configDefault.sml.header \
24 configDefault/*.cfg \
25 src/configDefault.sml.footer \
26 >configDefault/configDefault.sml
27
28 openssl/openssl_sml.o: openssl/openssl_sml.c
29 gcc -fPIC -c openssl/openssl_sml.c -o openssl/openssl_sml.o
30
31 openssl/openssl_sml.so: openssl/openssl_sml.o
32 gcc -shared -Wl,-soname,openssl_sml.so \
33 -o openssl/openssl_sml.so \
34 openssl/openssl_sml.o -lssl
35
36 src/domtool.cm: Makefile src/prefix.cm src/sources
37 cat src/prefix.cm src/sources >src/domtool.cm
38
39 src/domtool-server.mlb: Makefile src/prefix.mlb src/sources src/suffix.mlb
40 cat src/prefix.mlb src/sources src/suffix.mlb \
41 | sed 's/^\(.*\).grm$$/\1.grm.sig\n\1.grm.sml/' \
42 | sed 's/^\(.*\).lex$$/\1.lex.sml/' >src/domtool-server.mlb
43 echo "main-server.sml" >>src/domtool-server.mlb
44
45 openssl/smlnj/FFI/libssl.h.cm: openssl/openssl_sml.h
46 cd openssl/smlnj ; ml-nlffigen -d FFI -lh LibsslH.libh -include ../libssl-h.sml \
47 -cm libssl.h.cm -D__builtin_va_list="void*" \
48 ../openssl_sml.h
49
50 openssl/mlton/FFI/libssl.h.mlb: openssl/openssl_sml.h
51 cd openssl/mlton ; mlnlffigen -dir FFI -libhandle LibsslH.libh -include ../libssl-h.sml \
52 -mlbfile libssl.h.mlb -cppopt -D__builtin_va_list="void*" \
53 ../openssl_sml.h
54
55 %.lex.sml: %.lex
56 ml-lex $<
57
58 %.grm.sig %.grm.sml: %.grm
59 ml-yacc $<
60
61 bin/domtool-server: openssl/mlton/FFI/libssl.h.mlb \
62 src/domtool-server.mlb src/domtool.lex.sml \
63 src/domtool.grm.sig src/domtool.grm.sml \
64 $(COMMON_DEPS)
65 mlton -output bin/domtool-server -link-opt -ldl src/domtool-server.mlb