X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/883dd79c5d791f7b3d961917f8f2c3b58a1195ea..2679ec890199482014e671a9c41f19077abc0d60:/Makefile diff --git a/Makefile b/Makefile index 2d0c6ab..e23ac72 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,29 @@ +# Supported flags +# BUILD32=1 Target 32-bit x86 (Doesn't Work) +# TC=1 Stop after typchecking when building using mlton +# DEBUG=1 Keep debugging information when building using mlton + all: mlton bin/vmailpasswd elisp/domtool-tables.el bin/vmailpasswd: src/mail/vmailpasswd.c - $(CC) -lcrypt -o $@ $< + $(CC) $(CFLAGS) -lcrypt -o $@ $< + +ifeq ($(BUILD32), 1) + CFLAGS += -m32 +endif COMMON_DEPS := configDefault/config.sig configDefault/configDefault.sml \ openssl/openssl_sml.so pcre/pcre_sml.so config.sml EMACS_DIR := /usr/local/share/emacs/site-lisp/domtool-mode +clean: + rm -f bin/* + rm -f openssl/openssl_sml.so + rm -f openssl/openssl_sml.o + rm -f pcre/pcre_sml.so + rm -f pcre/pcre_sml.o + config.sml: /bin/echo -e 'structure Config :> CONFIG = struct\nopen ConfigDefault\nend' > $@ @@ -15,12 +31,14 @@ config.sml: mlton: bin/domtool-server bin/domtool-client bin/domtool-slave \ bin/domtool-admin bin/domtool-doc bin/dbtool bin/vmail \ - bin/smtplog bin/setsa bin/mysql-fixperms bin/webbw bin/domtool-tail + bin/smtplog bin/setsa bin/mysql-fixperms bin/webbw bin/domtool-tail \ + bin/fwtool smlnj: $(COMMON_DEPS) openssl/smlnj/FFI/libssl.h.cm pcre/smlnj/FFI/libpcre.h.cm \ src/domtool.cm + CFLAGS += -m32 -configDefault/config.sig: src/config.sig.header \ +configDefault/config.sig: config/core/core.sig src/config.sig.header \ configDefault/*.csg configDefault/*.cfs \ src/config.sig.footer cat configDefault/*.csg \ @@ -29,7 +47,7 @@ configDefault/config.sig: src/config.sig.header \ src/config.sig.footer \ >configDefault/config.sig -configDefault/configDefault.sml: src/configDefault.sml.header \ +configDefault/configDefault.sml: config/core/core.sml src/configDefault.sml.header \ configDefault/*.cfg src/configDefault.sml.footer cat src/configDefault.sml.header \ configDefault/*.cfg \ @@ -37,18 +55,18 @@ configDefault/configDefault.sml: src/configDefault.sml.header \ >configDefault/configDefault.sml openssl/openssl_sml.o: openssl/openssl_sml.c - gcc -fPIC -c openssl/openssl_sml.c -o openssl/openssl_sml.o + gcc $(CFLAGS) -fPIC -c openssl/openssl_sml.c -o openssl/openssl_sml.o openssl/openssl_sml.so: openssl/openssl_sml.o - gcc -shared -Wl,-soname,openssl_sml.so \ + gcc $(CFLAGS) -shared -Wl,-soname,openssl_sml.so \ -o openssl/openssl_sml.so \ openssl/openssl_sml.o -lssl pcre/pcre_sml.o: pcre/pcre_sml.c - gcc -fPIC -c pcre/pcre_sml.c -o pcre/pcre_sml.o + gcc $(CFLAGS) -fPIC -c pcre/pcre_sml.c -o pcre/pcre_sml.o pcre/pcre_sml.so: pcre/pcre_sml.o - gcc -shared -Wl,-soname,pcre_sml.so \ + gcc $(CFLAGS) -shared -Wl,-soname,pcre_sml.so \ -o pcre/pcre_sml.so \ pcre/pcre_sml.o -lpcre @@ -99,6 +117,10 @@ src/mysql-fixperms.mlb: src/prefix.mlb src/sources src/suffix.mlb $(MAKE_MLB_BASE) >src/mysql-fixperms.mlb echo "main-mysql-fixperms.sml" >>src/mysql-fixperms.mlb +src/fwtool.mlb: src/prefix.mlb src/sources src/suffix.mlb + $(MAKE_MLB_BASE) >src/fwtool.mlb + echo "main-fwtool.sml" >>src/fwtool.mlb + openssl/smlnj/FFI/libssl.h.cm: openssl/openssl_sml.h cd openssl/smlnj ; ml-nlffigen -d FFI -lh LibsslH.libh -include ../libssl-h.sml \ -cm libssl.h.cm -D__builtin_va_list="void*" \ @@ -135,10 +157,18 @@ COMMON_MLTON_DEPS := openssl/mlton/FFI/libssl.h.mlb \ MLTON := mlton -link-opt -ldl -ifdef DEBUG +ifeq ($(BUILD32),1) + MLTON += -codegen c -target i386 -cc-opt -m32 +endif + +ifeq ($(DEBUG), 1) MLTON += -const 'Exn.keepHistory true' endif +ifeq ($(TC), 1) + MLTON += -stop tc +endif + bin/domtool-server: $(COMMON_MLTON_DEPS) src/domtool-server.mlb $(MLTON) -output bin/domtool-server src/domtool-server.mlb @@ -169,6 +199,9 @@ bin/smtplog: $(COMMON_MLTON_DEPS) src/smtplog.mlb bin/mysql-fixperms: $(COMMON_MLTON_DEPS) src/mysql-fixperms.mlb $(MLTON) -output bin/mysql-fixperms src/mysql-fixperms.mlb +bin/fwtool: $(COMMON_MLTON_DEPS) src/fwtool.mlb + $(MLTON) -output bin/fwtool src/fwtool.mlb + bin/webbw: $(COMMON_MLTON_DEPS) src/stats/webbw.mlb src/stats/*.sml mlton -output bin/webbw src/stats/webbw.mlb @@ -202,6 +235,7 @@ install: install_sos -cp bin/domtool-admin /usr/local/bin/ -cp bin/domtool-doc /usr/local/bin/ -cp bin/dbtool /usr/local/bin/ + -cp bin/fwtool /usr/local/bin/ -cp bin/vmail /usr/local/bin/ -cp bin/setsa /usr/local/bin/ -cp bin/smtplog /usr/local/bin/