Merge pull request #120 from def-/master
[jackhill/mal.git] / nim / Makefile
1 #####################
2
3 SOURCES_BASE = types.nim reader.nim printer.nim
4 SOURCES_LISP = env.nim core.nim stepA_mal.nim
5 SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
6 SOURCES_REBUILD = $(SOURCES_BASE) env.nim core.nim
7
8 #####################
9
10 SRCS = step0_repl.nim step1_read_print.nim step2_eval.nim step3_env.nim \
11 step4_if_fn_do.nim step5_tco.nim step6_file.nim step7_quote.nim \
12 step8_macros.nim step9_try.nim stepA_mal.nim
13 BINS = $(SRCS:%.nim=%)
14
15 #####################
16
17 all: $(BINS) mal
18
19 mal: $(word $(words $(BINS)),$(BINS))
20 cp $< $@
21
22 $(BINS): %: %.nim $(SOURCES_REBUILD)
23 nim -d:release --nimcache:nimcache-$@ c $@
24
25 clean:
26 rm -rf nimcache-*/ $(BINS)
27 rm -f mal
28
29 .PHONY: stats stats-lisp
30
31 stats: $(SOURCES)
32 @wc $^
33 @printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*#|^[[:space:]]*$$" $^ | wc` "[comments/blanks]"
34 stats-lisp: $(SOURCES_LISP)
35 @wc $^
36 @printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*#|^[[:space:]]*$$" $^ | wc` "[comments/blanks]"