Domain aliases support for Apache
[hcoop/domtool2.git] / Makefile
CommitLineData
a49a9bfb 1all: mlton
0d2ce070 2
a49a9bfb
AC
3COMMON_DEPS := configDefault/config.sig configDefault/configDefault.sml \
4 openssl/openssl_sml.so
5
361a1e7f 6.PHONY: all mlton smlnj install
a49a9bfb 7
44a5ce2f 8mlton: bin/domtool-server bin/domtool-client bin/domtool-slave \
2bc5ed22 9 bin/domtool-admin bin/domtool-doc bin/dbtool bin/vmail \
7b0b0440 10 bin/smtplog bin/setsa
a49a9bfb
AC
11
12smlnj: $(COMMON_DEPS) openssl/smlnj/FFI/libssl.h.cm src/domtool.cm
0d2ce070
AC
13
14configDefault/config.sig: src/config.sig.header \
8df2e702
AC
15 configDefault/*.csg configDefault/*.cfs \
16 src/config.sig.footer
17 cat configDefault/*.csg \
18 src/config.sig.header \
0d2ce070
AC
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
559e89e9
AC
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
d541c618 38src/domtool.cm: src/prefix.cm src/sources
a49a9bfb
AC
39 cat src/prefix.cm src/sources >src/domtool.cm
40
7a2b27f0
AC
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
d541c618 45src/domtool-server.mlb: src/prefix.mlb src/sources src/suffix.mlb
7a2b27f0 46 $(MAKE_MLB_BASE) >src/domtool-server.mlb
a49a9bfb
AC
47 echo "main-server.sml" >>src/domtool-server.mlb
48
d541c618 49src/domtool-client.mlb: src/prefix.mlb src/sources src/suffix.mlb
7a2b27f0 50 $(MAKE_MLB_BASE) >src/domtool-client.mlb
361a1e7f
AC
51 echo "main-client.sml" >>src/domtool-client.mlb
52
d541c618 53src/domtool-slave.mlb: src/prefix.mlb src/sources src/suffix.mlb
7a2b27f0 54 $(MAKE_MLB_BASE) >src/domtool-slave.mlb
1c246434
AC
55 echo "main-slave.sml" >>src/domtool-slave.mlb
56
d541c618 57src/domtool-admin.mlb: src/prefix.mlb src/sources src/suffix.mlb
5ee41dd0
AC
58 $(MAKE_MLB_BASE) >src/domtool-admin.mlb
59 echo "main-admin.sml" >>src/domtool-admin.mlb
60
d541c618 61src/domtool-doc.mlb: src/prefix.mlb src/sources src/suffix.mlb
44a5ce2f
AC
62 $(MAKE_MLB_BASE) >src/domtool-doc.mlb
63 echo "main-doc.sml" >>src/domtool-doc.mlb
64
d541c618
AC
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
08688401
AC
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
2e96b9d4
AC
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
2bc5ed22
AC
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
559e89e9
AC
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
a49a9bfb
AC
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
a088cea6 92 mllex $<
a49a9bfb
AC
93
94%.grm.sig %.grm.sml: %.grm
a088cea6 95 mlyacc $<
a49a9bfb 96
7a2b27f0
AC
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 \
9ffe2f0f
AC
101 src/plugins/*.sig src/plugins/*.sml \
102 src/mail/*.sig src/mail/*.sml
7a2b27f0 103
e0b80e65
AC
104MLTON := mlton -link-opt -ldl
105
106ifdef DEBUG
107 MLTON += -const 'Exn.keepHistory true'
108endif
109
7a2b27f0 110bin/domtool-server: $(COMMON_MLTON_DEPS) src/domtool-server.mlb
e0b80e65 111 $(MLTON) -output bin/domtool-server src/domtool-server.mlb
361a1e7f 112
7a2b27f0 113bin/domtool-client: $(COMMON_MLTON_DEPS) src/domtool-client.mlb
e0b80e65 114 $(MLTON) -output bin/domtool-client src/domtool-client.mlb
361a1e7f 115
7a2b27f0 116bin/domtool-slave: $(COMMON_MLTON_DEPS) src/domtool-slave.mlb
e0b80e65 117 $(MLTON) -output bin/domtool-slave src/domtool-slave.mlb
1c246434 118
5ee41dd0 119bin/domtool-admin: $(COMMON_MLTON_DEPS) src/domtool-admin.mlb
e0b80e65 120 $(MLTON) -output bin/domtool-admin src/domtool-admin.mlb
5ee41dd0 121
44a5ce2f 122bin/domtool-doc: $(COMMON_MLTON_DEPS) src/domtool-doc.mlb
e0b80e65 123 $(MLTON) -output bin/domtool-doc src/domtool-doc.mlb
44a5ce2f 124
d541c618 125bin/dbtool: $(COMMON_MLTON_DEPS) src/dbtool.mlb
e0b80e65 126 $(MLTON) -output bin/dbtool src/dbtool.mlb
d541c618 127
08688401 128bin/vmail: $(COMMON_MLTON_DEPS) src/vmail.mlb
e0b80e65 129 $(MLTON) -output bin/vmail src/vmail.mlb
08688401 130
2e96b9d4 131bin/setsa: $(COMMON_MLTON_DEPS) src/setsa.mlb
e0b80e65 132 $(MLTON) -output bin/setsa -ldl src/setsa.mlb
2e96b9d4 133
2bc5ed22 134bin/smtplog: $(COMMON_MLTON_DEPS) src/smtplog.mlb
e0b80e65 135 $(MLTON) -output bin/smtplog src/smtplog.mlb
2bc5ed22 136
361a1e7f 137install:
27e20924 138 cp scripts/domtool-publish /usr/local/sbin/
8ae99fef
AC
139 cp scripts/domtool-reset-global /usr/local/sbin/
140 cp scripts/domtool-reset-local /usr/local/sbin/
385c3534
AC
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/
62260c5f
AC
145 cp scripts/domtool-admin-sudo /usr/local/bin/
146 cp scripts/domtool-server-logged /usr/local/bin/
c9731b9b
AC
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/
27e20924 150 cp openssl/openssl_sml.so /usr/local/lib/
76bad1b2
AC
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/
d541c618 156 -cp bin/dbtool /usr/local/bin/
08688401 157 -cp bin/vmail /usr/local/bin/
2e96b9d4 158 -cp bin/setsa /usr/local/bin/
2bc5ed22 159 -cp bin/smtplog /usr/local/bin/
d541c618 160 cp src/plugins/domtool-postgres /usr/local/sbin/
ae147938 161 cp src/plugins/domtool-mysql /usr/local/sbin/
15e529d6
AC
162
163.PHONY: grab_lib
164
165grab_lib:
166 rsync --delete /afs/hcoop.net/common/etc/domtool/lib/* lib/