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