1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-20 10:07:45 +03:00
mal/ocaml/Makefile

39 lines
1.1 KiB
Makefile
Raw Normal View History

2015-01-24 04:05:03 +03:00
STEPS = step0_repl.ml step1_read_print.ml step2_eval.ml step3_env.ml \
2014-01-30 05:05:05 +04:00
step4_if_fn_do.ml step5_tco.ml step6_file.ml step7_quote.ml \
step8_macros.ml step9_try.ml stepA_mal.ml
2015-01-24 04:05:03 +03:00
MODULES = types.ml reader.ml printer.ml env.ml core.ml
2015-01-30 20:38:32 +03:00
LIBS = str.cmxa unix.cmxa
MAL_LIB = mal_lib.cmxa
STEP_BINS = $(STEPS:%.ml=%)
LAST_STEP_BIN = $(word $(words $(STEP_BINS)),$(STEP_BINS))
all: $(STEP_BINS) mal
mal: $(LAST_STEP_BIN)
cp $< $@
# ocaml repl apparently needs bytecode, not native, compilation.
# Just do it all right here:
repl:
ocamlc -c $(LIBS:%.cmxa=%.cma) $(MODULES) $(STEPS)
rlwrap ocaml $(LIBS:%.cmxa=%.cma) $(MODULES:%.ml=%.cmo)
2015-01-22 10:59:48 +03:00
$(MAL_LIB): $(MODULES)
ocamlopt -a $(MODULES) -o $@
$(STEP_BINS): %: %.ml $(MAL_LIB)
ocamlopt $(LIBS) $(MAL_LIB) $< -o $@
clean:
rm -f $(STEP_BINS) mal mal_lib.* *.cmo *.cmx *.cmi *.o
stats: $(MODULES) stepA_mal.ml
2015-01-30 22:26:00 +03:00
@wc $^
@printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*\(\*|^[[:space:]]*$$" $^ | wc` "[comments/blanks]"
stats-lisp: env.ml core.ml stepA_mal.ml
2015-01-30 22:26:00 +03:00
@wc $^
@printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*\(\*|^[[:space:]]*$$" $^ | wc` "[comments/blanks]"
2015-01-30 22:26:00 +03:00
.PHONY: all repl clean stats stats-lisp