Initial domain aliases support
[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 install
7
8 mlton: 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
12 smlnj: $(COMMON_DEPS) openssl/smlnj/FFI/libssl.h.cm src/domtool.cm
13
14 configDefault/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
23 configDefault/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
30 openssl/openssl_sml.o: openssl/openssl_sml.c
31 gcc -fPIC -c openssl/openssl_sml.c -o openssl/openssl_sml.o
32
33 openssl/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
38 src/domtool.cm: src/prefix.cm src/sources
39 cat src/prefix.cm src/sources >src/domtool.cm
40
41 MAKE_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
45 src/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
49 src/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
53 src/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
57 src/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
61 src/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
65 src/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
69 src/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
73 src/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
77 src/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
81 openssl/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
86 openssl/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
97 COMMON_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
104 MLTON := mlton -link-opt -ldl
105
106 ifdef DEBUG
107 MLTON += -const 'Exn.keepHistory true'
108 endif
109
110 bin/domtool-server: $(COMMON_MLTON_DEPS) src/domtool-server.mlb
111 $(MLTON) -output bin/domtool-server src/domtool-server.mlb
112
113 bin/domtool-client: $(COMMON_MLTON_DEPS) src/domtool-client.mlb
114 $(MLTON) -output bin/domtool-client src/domtool-client.mlb
115
116 bin/domtool-slave: $(COMMON_MLTON_DEPS) src/domtool-slave.mlb
117 $(MLTON) -output bin/domtool-slave src/domtool-slave.mlb
118
119 bin/domtool-admin: $(COMMON_MLTON_DEPS) src/domtool-admin.mlb
120 $(MLTON) -output bin/domtool-admin src/domtool-admin.mlb
121
122 bin/domtool-doc: $(COMMON_MLTON_DEPS) src/domtool-doc.mlb
123 $(MLTON) -output bin/domtool-doc src/domtool-doc.mlb
124
125 bin/dbtool: $(COMMON_MLTON_DEPS) src/dbtool.mlb
126 $(MLTON) -output bin/dbtool src/dbtool.mlb
127
128 bin/vmail: $(COMMON_MLTON_DEPS) src/vmail.mlb
129 $(MLTON) -output bin/vmail src/vmail.mlb
130
131 bin/setsa: $(COMMON_MLTON_DEPS) src/setsa.mlb
132 $(MLTON) -output bin/setsa -ldl src/setsa.mlb
133
134 bin/smtplog: $(COMMON_MLTON_DEPS) src/smtplog.mlb
135 $(MLTON) -output bin/smtplog src/smtplog.mlb
136
137 install:
138 cp scripts/domtool-publish /usr/local/sbin/
139 cp scripts/domtool-reset-global /usr/local/sbin/
140 cp scripts/domtool-reset-local /usr/local/sbin/
141 cp scripts/domtool-adduser /usr/local/bin/
142 cp scripts/domtool-addcert /usr/local/bin/
143 cp scripts/domtool-addacl /usr/local/bin/
144 cp scripts/domtool-rmuser /usr/local/bin/
145 cp scripts/domtool-admin-sudo /usr/local/bin/
146 cp scripts/domtool-server-logged /usr/local/bin/
147 cp scripts/domtool-slave-logged /usr/local/bin/
148 cp scripts/domtool-server /etc/init.d/
149 cp scripts/domtool-slave /etc/init.d/
150 cp openssl/openssl_sml.so /usr/local/lib/
151 -cp bin/domtool-server /usr/local/sbin/
152 -cp bin/domtool-slave /usr/local/sbin/
153 -cp bin/domtool-client /usr/local/bin/domtool
154 -cp bin/domtool-admin /usr/local/bin/
155 -cp bin/domtool-doc /usr/local/bin/
156 -cp bin/dbtool /usr/local/bin/
157 -cp bin/vmail /usr/local/bin/
158 -cp bin/setsa /usr/local/bin/
159 -cp bin/smtplog /usr/local/bin/
160 cp src/plugins/domtool-postgres /usr/local/sbin/
161 cp src/plugins/domtool-mysql /usr/local/sbin/
162
163 .PHONY: grab_lib
164
165 grab_lib:
166 rsync --delete /afs/hcoop.net/common/etc/domtool/lib/* lib/