domtool-mode standard library table changes performed automatically by Makefile
[hcoop/domtool2.git] / Makefile
1 all: mlton bin/vmailpasswd elisp/domtool-tables.el
2
3 bin/vmailpasswd: src/mail/vmailpasswd.c
4 $(CC) -lcrypt -o $@ $<
5
6 COMMON_DEPS := configDefault/config.sig configDefault/configDefault.sml \
7 openssl/openssl_sml.so config.sml
8
9 EMACS_DIR := /usr/local/share/emacs/site-lisp/domtool-mode
10
11 config.sml:
12 echo -e 'structure Config :> CONFIG = struct\nopen ConfigDefault\nend' > $@
13
14 .PHONY: all mlton smlnj install
15
16 mlton: bin/domtool-server bin/domtool-client bin/domtool-slave \
17 bin/domtool-admin bin/domtool-doc bin/dbtool bin/vmail \
18 bin/smtplog bin/setsa bin/mysql-fixperms
19
20 smlnj: $(COMMON_DEPS) openssl/smlnj/FFI/libssl.h.cm src/domtool.cm
21
22 configDefault/config.sig: src/config.sig.header \
23 configDefault/*.csg configDefault/*.cfs \
24 src/config.sig.footer
25 cat configDefault/*.csg \
26 src/config.sig.header \
27 configDefault/*.cfs \
28 src/config.sig.footer \
29 >configDefault/config.sig
30
31 configDefault/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
38 openssl/openssl_sml.o: openssl/openssl_sml.c
39 gcc -fPIC -c openssl/openssl_sml.c -o openssl/openssl_sml.o
40
41 openssl/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
46 src/domtool.cm: src/prefix.cm src/sources
47 cat src/prefix.cm src/sources >src/domtool.cm
48
49 MAKE_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
53 src/domtool-server.mlb: src/prefix.mlb src/sources src/suffix.mlb
54 $(MAKE_MLB_BASE) >src/domtool-server.mlb
55 echo "main-server.sml" >>src/domtool-server.mlb
56
57 src/domtool-client.mlb: src/prefix.mlb src/sources src/suffix.mlb
58 $(MAKE_MLB_BASE) >src/domtool-client.mlb
59 echo "main-client.sml" >>src/domtool-client.mlb
60
61 src/domtool-slave.mlb: src/prefix.mlb src/sources src/suffix.mlb
62 $(MAKE_MLB_BASE) >src/domtool-slave.mlb
63 echo "main-slave.sml" >>src/domtool-slave.mlb
64
65 src/domtool-admin.mlb: src/prefix.mlb src/sources src/suffix.mlb
66 $(MAKE_MLB_BASE) >src/domtool-admin.mlb
67 echo "main-admin.sml" >>src/domtool-admin.mlb
68
69 src/domtool-doc.mlb: src/prefix.mlb src/sources src/suffix.mlb
70 $(MAKE_MLB_BASE) >src/domtool-doc.mlb
71 echo "main-doc.sml" >>src/domtool-doc.mlb
72
73 src/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
77 src/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
81 src/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
85 src/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
89 src/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
93 openssl/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
97
98 openssl/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
104 mllex $<
105
106 %.grm.sig %.grm.sml: %.grm
107 mlyacc $<
108
109 COMMON_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 \
113 src/plugins/*.sig src/plugins/*.sml \
114 src/mail/*.sig src/mail/*.sml
115
116 MLTON := mlton -link-opt -ldl
117
118 ifdef DEBUG
119 MLTON += -const 'Exn.keepHistory true'
120 endif
121
122 bin/domtool-server: $(COMMON_MLTON_DEPS) src/domtool-server.mlb
123 $(MLTON) -output bin/domtool-server src/domtool-server.mlb
124
125 bin/domtool-client: $(COMMON_MLTON_DEPS) src/domtool-client.mlb
126 $(MLTON) -output bin/domtool-client src/domtool-client.mlb
127
128 bin/domtool-slave: $(COMMON_MLTON_DEPS) src/domtool-slave.mlb
129 $(MLTON) -output bin/domtool-slave src/domtool-slave.mlb
130
131 bin/domtool-admin: $(COMMON_MLTON_DEPS) src/domtool-admin.mlb
132 $(MLTON) -output bin/domtool-admin src/domtool-admin.mlb
133
134 bin/domtool-doc: $(COMMON_MLTON_DEPS) src/domtool-doc.mlb
135 $(MLTON) -output bin/domtool-doc src/domtool-doc.mlb
136
137 bin/dbtool: $(COMMON_MLTON_DEPS) src/dbtool.mlb
138 $(MLTON) -output bin/dbtool src/dbtool.mlb
139
140 bin/vmail: $(COMMON_MLTON_DEPS) src/vmail.mlb
141 $(MLTON) -output bin/vmail src/vmail.mlb
142
143 bin/setsa: $(COMMON_MLTON_DEPS) src/setsa.mlb
144 $(MLTON) -output bin/setsa src/setsa.mlb
145
146 bin/smtplog: $(COMMON_MLTON_DEPS) src/smtplog.mlb
147 $(MLTON) -output bin/smtplog src/smtplog.mlb
148
149 bin/mysql-fixperms: $(COMMON_MLTON_DEPS) src/mysql-fixperms.mlb
150 $(MLTON) -output bin/mysql-fixperms src/mysql-fixperms.mlb
151
152 elisp/domtool-tables.el: lib/*.dtl bin/domtool-doc
153 bin/domtool-doc -basis -emacs >$@
154
155 install:
156 cp scripts/domtool-publish /usr/local/sbin/
157 cp scripts/domtool-reset-global /usr/local/sbin/
158 cp scripts/domtool-reset-local /usr/local/sbin/
159 cp scripts/domtool-adduser /usr/local/bin/
160 cp scripts/domtool-addcert /usr/local/bin/
161 cp scripts/domtool-addcert-daemon /usr/local/bin/
162 cp scripts/domtool-addacl /usr/local/bin/
163 cp scripts/domtool-rmuser /usr/local/bin/
164 cp scripts/domtool-admin-sudo /usr/local/bin/
165 cp scripts/domtool-server-logged /usr/local/bin/
166 cp scripts/domtool-slave-logged /usr/local/bin/
167 cp scripts/domtool-server /etc/init.d/
168 cp scripts/domtool-slave /etc/init.d/
169 cp openssl/openssl_sml.so /usr/local/lib/
170 -cp bin/domtool-server /usr/local/sbin/
171 -cp bin/domtool-slave /usr/local/sbin/
172 -cp bin/domtool-client /usr/local/bin/domtool
173 -cp bin/domtool-admin /usr/local/bin/
174 -cp bin/domtool-doc /usr/local/bin/
175 -cp bin/dbtool /usr/local/bin/
176 -cp bin/vmail /usr/local/bin/
177 -cp bin/setsa /usr/local/bin/
178 -cp bin/smtplog /usr/local/bin/
179 -cp bin/mysql-fixperms /usr/local/bin/
180 -cp bin/vmailpasswd /usr/local/bin/
181 cp src/plugins/domtool-postgres /usr/local/sbin/
182 cp src/plugins/domtool-mysql /usr/local/sbin/
183 -mkdir $(EMACS_DIR)
184 cp elisp/*.el $(EMACS_DIR)/
185
186 .PHONY: grab_lib install_server install_slave
187
188 grab_lib:
189 rsync -r --delete /afs/hcoop.net/common/etc/domtool/lib/* lib/
190
191 install_server:
192 sudo /etc/init.d/domtool-server stop
193 sudo make install
194 sudo /etc/init.d/domtool-server start
195
196 install_slave:
197 sudo /etc/init.d/domtool-slave stop
198 sudo make install
199 sudo /etc/init.d/domtool-slave start