domtool-doc
[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
AC
8mlton: bin/domtool-server bin/domtool-client bin/domtool-slave \
9 bin/domtool-admin bin/domtool-doc
a49a9bfb
AC
10
11smlnj: $(COMMON_DEPS) openssl/smlnj/FFI/libssl.h.cm src/domtool.cm
0d2ce070
AC
12
13configDefault/config.sig: src/config.sig.header \
8df2e702
AC
14 configDefault/*.csg configDefault/*.cfs \
15 src/config.sig.footer
16 cat configDefault/*.csg \
17 src/config.sig.header \
0d2ce070
AC
18 configDefault/*.cfs \
19 src/config.sig.footer \
20 >configDefault/config.sig
21
22configDefault/configDefault.sml: src/configDefault.sml.header \
23 configDefault/*.cfg src/configDefault.sml.footer
24 cat src/configDefault.sml.header \
25 configDefault/*.cfg \
26 src/configDefault.sml.footer \
27 >configDefault/configDefault.sml
28
559e89e9
AC
29openssl/openssl_sml.o: openssl/openssl_sml.c
30 gcc -fPIC -c openssl/openssl_sml.c -o openssl/openssl_sml.o
31
32openssl/openssl_sml.so: openssl/openssl_sml.o
33 gcc -shared -Wl,-soname,openssl_sml.so \
34 -o openssl/openssl_sml.so \
35 openssl/openssl_sml.o -lssl
36
a49a9bfb
AC
37src/domtool.cm: Makefile src/prefix.cm src/sources
38 cat src/prefix.cm src/sources >src/domtool.cm
39
7a2b27f0
AC
40MAKE_MLB_BASE := cat src/prefix.mlb src/sources src/suffix.mlb \
41 | sed 's/^\(.*\).grm$$/\1.grm.sig\n\1.grm.sml/' \
42 | sed 's/^\(.*\).lex$$/\1.lex.sml/'
43
a49a9bfb 44src/domtool-server.mlb: Makefile src/prefix.mlb src/sources src/suffix.mlb
7a2b27f0 45 $(MAKE_MLB_BASE) >src/domtool-server.mlb
a49a9bfb
AC
46 echo "main-server.sml" >>src/domtool-server.mlb
47
361a1e7f 48src/domtool-client.mlb: Makefile src/prefix.mlb src/sources src/suffix.mlb
7a2b27f0 49 $(MAKE_MLB_BASE) >src/domtool-client.mlb
361a1e7f
AC
50 echo "main-client.sml" >>src/domtool-client.mlb
51
1c246434 52src/domtool-slave.mlb: Makefile src/prefix.mlb src/sources src/suffix.mlb
7a2b27f0 53 $(MAKE_MLB_BASE) >src/domtool-slave.mlb
1c246434
AC
54 echo "main-slave.sml" >>src/domtool-slave.mlb
55
5ee41dd0
AC
56src/domtool-admin.mlb: Makefile src/prefix.mlb src/sources src/suffix.mlb
57 $(MAKE_MLB_BASE) >src/domtool-admin.mlb
58 echo "main-admin.sml" >>src/domtool-admin.mlb
59
44a5ce2f
AC
60src/domtool-doc.mlb: Makefile src/prefix.mlb src/sources src/suffix.mlb
61 $(MAKE_MLB_BASE) >src/domtool-doc.mlb
62 echo "main-doc.sml" >>src/domtool-doc.mlb
63
559e89e9
AC
64openssl/smlnj/FFI/libssl.h.cm: openssl/openssl_sml.h
65 cd openssl/smlnj ; ml-nlffigen -d FFI -lh LibsslH.libh -include ../libssl-h.sml \
66 -cm libssl.h.cm -D__builtin_va_list="void*" \
67 ../openssl_sml.h
a49a9bfb
AC
68
69openssl/mlton/FFI/libssl.h.mlb: openssl/openssl_sml.h
70 cd openssl/mlton ; mlnlffigen -dir FFI -libhandle LibsslH.libh -include ../libssl-h.sml \
71 -mlbfile libssl.h.mlb -cppopt -D__builtin_va_list="void*" \
72 ../openssl_sml.h
73
74%.lex.sml: %.lex
a088cea6 75 mllex $<
a49a9bfb
AC
76
77%.grm.sig %.grm.sml: %.grm
a088cea6 78 mlyacc $<
a49a9bfb 79
7a2b27f0
AC
80COMMON_MLTON_DEPS := openssl/mlton/FFI/libssl.h.mlb \
81 src/domtool.lex.sml \
82 src/domtool.grm.sig src/domtool.grm.sml \
83 $(COMMON_DEPS) src/*.sig src/*.sml \
84 src/plugins/*.sig src/plugins/*.sml
85
86bin/domtool-server: $(COMMON_MLTON_DEPS) src/domtool-server.mlb
a49a9bfb 87 mlton -output bin/domtool-server -link-opt -ldl src/domtool-server.mlb
361a1e7f 88
7a2b27f0 89bin/domtool-client: $(COMMON_MLTON_DEPS) src/domtool-client.mlb
361a1e7f
AC
90 mlton -output bin/domtool-client -link-opt -ldl src/domtool-client.mlb
91
7a2b27f0 92bin/domtool-slave: $(COMMON_MLTON_DEPS) src/domtool-slave.mlb
1c246434
AC
93 mlton -output bin/domtool-slave -link-opt -ldl src/domtool-slave.mlb
94
5ee41dd0
AC
95bin/domtool-admin: $(COMMON_MLTON_DEPS) src/domtool-admin.mlb
96 mlton -output bin/domtool-admin -link-opt -ldl src/domtool-admin.mlb
97
44a5ce2f
AC
98bin/domtool-doc: $(COMMON_MLTON_DEPS) src/domtool-doc.mlb
99 mlton -output bin/domtool-doc -link-opt -ldl src/domtool-doc.mlb
100
361a1e7f 101install:
27e20924 102 cp scripts/domtool-publish /usr/local/sbin/
8ae99fef
AC
103 cp scripts/domtool-reset-global /usr/local/sbin/
104 cp scripts/domtool-reset-local /usr/local/sbin/
385c3534
AC
105 cp scripts/domtool-adduser /usr/local/bin/
106 cp scripts/domtool-addcert /usr/local/bin/
107 cp scripts/domtool-addacl /usr/local/bin/
108 cp scripts/domtool-rmuser /usr/local/bin/
27e20924
AC
109 cp openssl/openssl_sml.so /usr/local/lib/
110 cp bin/domtool-server /usr/local/sbin/
1c246434 111 cp bin/domtool-slave /usr/local/sbin/
27e20924 112 cp bin/domtool-client /usr/local/bin/domtool
5ee41dd0 113 cp bin/domtool-admin /usr/local/bin/
44a5ce2f 114 cp bin/domtool-doc /usr/local/bin/
15e529d6
AC
115
116.PHONY: grab_lib
117
118grab_lib:
119 rsync --delete /afs/hcoop.net/common/etc/domtool/lib/* lib/