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