Update from master
[jackhill/mal.git] / erlang / Makefile
CommitLineData
2cc3804b
NF
1#####################
2
fc4c7889
JM
3SOURCES_BASE = src/atom.erl src/printer.erl src/reader.erl
4SOURCES_LISP = src/core.erl src/env.erl src/types.erl src/stepA_mal.erl
5SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
2cc3804b
NF
6
7#####################
8
77db07c9 9SRCS = step0_repl.erl step1_read_print.erl step2_eval.erl step3_env.erl step4_if_fn_do.erl \
78c05994 10 step5_tco.erl step6_file.erl step7_quote.erl step8_macros.erl step9_try.erl stepA_mal.erl
2cc3804b
NF
11BINS = $(SRCS:%.erl=%)
12
13#####################
14
5245b079 15.PHONY: all dist clean stats stats-lisp
583a62df 16
b6dc3e37
JM
17all: $(BINS)
18
19dist: mal
20
21mal: $(SOURCES)
22 sed 's/stepA_mal/mal/' src/stepA_mal.erl > src/mal.erl
23 MAL_STEP=mal rebar compile escriptize
24 rm src/mal.erl
2cc3804b 25
2cc3804b
NF
26
27define dep_template
583a62df 28.PHONY: $(1)
fc4c7889 29$(1): src/$(1).erl
2cc3804b
NF
30 MAL_STEP=$(1) rebar compile escriptize
31endef
32
33$(foreach b,$(BINS),$(eval $(call dep_template,$(b))))
34
35clean:
583a62df 36 rebar clean
5245b079 37 rm -f mal
2cc3804b
NF
38
39stats: $(SOURCES)
40 @wc $^
f15b4021 41 @printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*%|^[[:space:]]*$$" $^ | wc` "[comments/blanks]"
2cc3804b
NF
42stats-lisp: $(SOURCES_LISP)
43 @wc $^
f15b4021 44 @printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*%|^[[:space:]]*$$" $^ | wc` "[comments/blanks]"