Allow extra semicolon at end of where clause
[hcoop/domtool2.git] / Makefile
... / ...
CommitLineData
1all: mlton
2
3COMMON_DEPS := configDefault/config.sig configDefault/configDefault.sml \
4 openssl/openssl_sml.so
5
6.PHONY: all mlton smlnj install
7
8mlton: bin/domtool-server bin/domtool-client bin/domtool-slave \
9 bin/domtool-admin bin/domtool-doc bin/dbtool bin/vmail \
10 bin/smtplog bin/setsa
11
12smlnj: $(COMMON_DEPS) openssl/smlnj/FFI/libssl.h.cm src/domtool.cm
13
14configDefault/config.sig: src/config.sig.header \
15 configDefault/*.csg configDefault/*.cfs \
16 src/config.sig.footer
17 cat configDefault/*.csg \
18 src/config.sig.header \
19 configDefault/*.cfs \
20 src/config.sig.footer \
21 >configDefault/config.sig
22
23configDefault/configDefault.sml: src/configDefault.sml.header \
24 configDefault/*.cfg src/configDefault.sml.footer
25 cat src/configDefault.sml.header \
26 configDefault/*.cfg \
27 src/configDefault.sml.footer \
28 >configDefault/configDefault.sml
29
30openssl/openssl_sml.o: openssl/openssl_sml.c
31 gcc -fPIC -c openssl/openssl_sml.c -o openssl/openssl_sml.o
32
33openssl/openssl_sml.so: openssl/openssl_sml.o
34 gcc -shared -Wl,-soname,openssl_sml.so \
35 -o openssl/openssl_sml.so \
36 openssl/openssl_sml.o -lssl
37
38src/domtool.cm: src/prefix.cm src/sources
39 cat src/prefix.cm src/sources >src/domtool.cm
40
41MAKE_MLB_BASE := cat src/prefix.mlb src/sources src/suffix.mlb \
42 | sed 's/^\(.*\).grm$$/\1.grm.sig\n\1.grm.sml/' \
43 | sed 's/^\(.*\).lex$$/\1.lex.sml/'
44
45src/domtool-server.mlb: src/prefix.mlb src/sources src/suffix.mlb
46 $(MAKE_MLB_BASE) >src/domtool-server.mlb
47 echo "main-server.sml" >>src/domtool-server.mlb
48
49src/domtool-client.mlb: src/prefix.mlb src/sources src/suffix.mlb
50 $(MAKE_MLB_BASE) >src/domtool-client.mlb
51 echo "main-client.sml" >>src/domtool-client.mlb
52
53src/domtool-slave.mlb: src/prefix.mlb src/sources src/suffix.mlb
54 $(MAKE_MLB_BASE) >src/domtool-slave.mlb
55 echo "main-slave.sml" >>src/domtool-slave.mlb
56
57src/domtool-admin.mlb: src/prefix.mlb src/sources src/suffix.mlb
58 $(MAKE_MLB_BASE) >src/domtool-admin.mlb
59 echo "main-admin.sml" >>src/domtool-admin.mlb
60
61src/domtool-doc.mlb: src/prefix.mlb src/sources src/suffix.mlb
62 $(MAKE_MLB_BASE) >src/domtool-doc.mlb
63 echo "main-doc.sml" >>src/domtool-doc.mlb
64
65src/dbtool.mlb: src/prefix.mlb src/sources src/suffix.mlb
66 $(MAKE_MLB_BASE) >src/dbtool.mlb
67 echo "main-dbtool.sml" >>src/dbtool.mlb
68
69src/vmail.mlb: src/prefix.mlb src/sources src/suffix.mlb
70 $(MAKE_MLB_BASE) >src/vmail.mlb
71 echo "main-vmail.sml" >>src/vmail.mlb
72
73src/setsa.mlb: src/prefix.mlb src/sources src/suffix.mlb
74 $(MAKE_MLB_BASE) >src/setsa.mlb
75 echo "main-setsa.sml" >>src/setsa.mlb
76
77src/smtplog.mlb: src/prefix.mlb src/sources src/suffix.mlb
78 $(MAKE_MLB_BASE) >src/smtplog.mlb
79 echo "main-smtplog.sml" >>src/smtplog.mlb
80
81openssl/smlnj/FFI/libssl.h.cm: openssl/openssl_sml.h
82 cd openssl/smlnj ; ml-nlffigen -d FFI -lh LibsslH.libh -include ../libssl-h.sml \
83 -cm libssl.h.cm -D__builtin_va_list="void*" \
84 ../openssl_sml.h
85
86openssl/mlton/FFI/libssl.h.mlb: openssl/openssl_sml.h
87 cd openssl/mlton ; mlnlffigen -dir FFI -libhandle LibsslH.libh -include ../libssl-h.sml \
88 -mlbfile libssl.h.mlb -cppopt -D__builtin_va_list="void*" \
89 ../openssl_sml.h
90
91%.lex.sml: %.lex
92 mllex $<
93
94%.grm.sig %.grm.sml: %.grm
95 mlyacc $<
96
97COMMON_MLTON_DEPS := openssl/mlton/FFI/libssl.h.mlb \
98 src/domtool.lex.sml \
99 src/domtool.grm.sig src/domtool.grm.sml \
100 $(COMMON_DEPS) src/*.sig src/*.sml \
101 src/plugins/*.sig src/plugins/*.sml \
102 src/mail/*.sig src/mail/*.sml
103
104bin/domtool-server: $(COMMON_MLTON_DEPS) src/domtool-server.mlb
105 mlton -output bin/domtool-server -link-opt -ldl src/domtool-server.mlb
106
107bin/domtool-client: $(COMMON_MLTON_DEPS) src/domtool-client.mlb
108 mlton -output bin/domtool-client -link-opt -ldl src/domtool-client.mlb
109
110bin/domtool-slave: $(COMMON_MLTON_DEPS) src/domtool-slave.mlb
111 mlton -output bin/domtool-slave -link-opt -ldl src/domtool-slave.mlb
112
113bin/domtool-admin: $(COMMON_MLTON_DEPS) src/domtool-admin.mlb
114 mlton -output bin/domtool-admin -link-opt -ldl src/domtool-admin.mlb
115
116bin/domtool-doc: $(COMMON_MLTON_DEPS) src/domtool-doc.mlb
117 mlton -output bin/domtool-doc -link-opt -ldl src/domtool-doc.mlb
118
119bin/dbtool: $(COMMON_MLTON_DEPS) src/dbtool.mlb
120 mlton -output bin/dbtool -link-opt -ldl src/dbtool.mlb
121
122bin/vmail: $(COMMON_MLTON_DEPS) src/vmail.mlb
123 mlton -output bin/vmail -link-opt -ldl src/vmail.mlb
124
125bin/setsa: $(COMMON_MLTON_DEPS) src/setsa.mlb
126 mlton -output bin/setsa -link-opt -ldl src/setsa.mlb
127
128bin/smtplog: $(COMMON_MLTON_DEPS) src/smtplog.mlb
129 mlton -output bin/smtplog -link-opt -ldl src/smtplog.mlb
130
131install:
132 cp scripts/domtool-publish /usr/local/sbin/
133 cp scripts/domtool-reset-global /usr/local/sbin/
134 cp scripts/domtool-reset-local /usr/local/sbin/
135 cp scripts/domtool-adduser /usr/local/bin/
136 cp scripts/domtool-addcert /usr/local/bin/
137 cp scripts/domtool-addacl /usr/local/bin/
138 cp scripts/domtool-rmuser /usr/local/bin/
139 cp scripts/domtool-admin-sudo /usr/local/bin/
140 cp scripts/domtool-server-logged /usr/local/bin/
141 cp scripts/domtool-slave-logged /usr/local/bin/
142 cp scripts/domtool-server /etc/init.d/
143 cp scripts/domtool-slave /etc/init.d/
144 cp openssl/openssl_sml.so /usr/local/lib/
145 -cp bin/domtool-server /usr/local/sbin/
146 -cp bin/domtool-slave /usr/local/sbin/
147 -cp bin/domtool-client /usr/local/bin/domtool
148 -cp bin/domtool-admin /usr/local/bin/
149 -cp bin/domtool-doc /usr/local/bin/
150 -cp bin/dbtool /usr/local/bin/
151 -cp bin/vmail /usr/local/bin/
152 -cp bin/setsa /usr/local/bin/
153 -cp bin/smtplog /usr/local/bin/
154 cp src/plugins/domtool-postgres /usr/local/sbin/
155 cp src/plugins/domtool-mysql /usr/local/sbin/
156
157.PHONY: grab_lib
158
159grab_lib:
160 rsync --delete /afs/hcoop.net/common/etc/domtool/lib/* lib/