Merge pull request #306 from kanaka/add-predicates
[jackhill/mal.git] / ocaml / Makefile
1 STEPS = step0_repl.ml step1_read_print.ml step2_eval.ml step3_env.ml \
2 step4_if_fn_do.ml step5_tco.ml step6_file.ml step7_quote.ml \
3 step8_macros.ml step9_try.ml stepA_mal.ml
4 MODULES = types.ml reader.ml printer.ml env.ml core.ml
5 LIBS = str.cmxa unix.cmxa
6 MAL_LIB = mal_lib.cmxa
7
8 STEP_BINS = $(STEPS:%.ml=%)
9 LAST_STEP_BIN = $(word $(words $(STEP_BINS)),$(STEP_BINS))
10
11 all: $(STEP_BINS)
12
13 dist: mal
14
15 mal: $(LAST_STEP_BIN)
16 cp $< $@
17
18 # ocaml repl apparently needs bytecode, not native, compilation.
19 # Just do it all right here:
20 repl:
21 ocamlc -c $(LIBS:%.cmxa=%.cma) $(MODULES) $(STEPS)
22 rlwrap ocaml $(LIBS:%.cmxa=%.cma) $(MODULES:%.ml=%.cmo)
23
24 $(MAL_LIB): $(MODULES)
25 ocamlopt -a $(MODULES) -o $@
26
27 $(STEP_BINS): %: %.ml $(MAL_LIB)
28 ocamlopt $(LIBS) $(MAL_LIB) $< -o $@
29
30 clean:
31 rm -f $(STEP_BINS) mal mal_lib.* *.cmo *.cmx *.cmi *.o
32
33 stats: $(MODULES) stepA_mal.ml
34 @wc $^
35 @printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*\(\*|^[[:space:]]*$$" $^ | wc` "[comments/blanks]"
36 stats-lisp: env.ml core.ml stepA_mal.ml
37 @wc $^
38 @printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*\(\*|^[[:space:]]*$$" $^ | wc` "[comments/blanks]"
39
40 .PHONY: all repl clean stats stats-lisp