Step 4 of Make-a-Lisp for Erlang
[jackhill/mal.git] / erlang / Makefile
CommitLineData
2cc3804b
NF
1#####################
2
a61ea75a
NF
3SOURCES_BASE = src/step0_repl.erl src/step1_read_print.erl src/step2_eval.erl src/step3_env.erl \
4 src/step4_if_fn_do.erl
5SOURCES_LISP = src/core.erl src/env.erl src/printer.erl src/reader.erl src/types.erl
2cc3804b
NF
6SOURCES = $(SOURCES_BASE) $(word $(words $(SOURCES_LISP)),${SOURCES_LISP})
7
8#####################
9
a61ea75a 10SRCS = step0_repl.erl step1_read_print.erl step2_eval.erl step3_env.erl step4_if_fn_do.erl
2cc3804b
NF
11BINS = $(SRCS:%.erl=%)
12
13#####################
14
583a62df
NF
15.PHONY: all mal clean stats stats-lisp
16
2cc3804b
NF
17all: $(BINS) mal
18
19mal: $(word $(words $(BINS)),$(BINS))
20 cp $< $@
21
22define dep_template
583a62df 23.PHONY: $(1)
2cc3804b
NF
24$(1): $(SOURCES_BASE) src/$(1).erl
25 MAL_STEP=$(1) rebar compile escriptize
26endef
27
28$(foreach b,$(BINS),$(eval $(call dep_template,$(b))))
29
30clean:
583a62df 31 rebar clean
2cc3804b
NF
32
33stats: $(SOURCES)
34 @wc $^
35stats-lisp: $(SOURCES_LISP)
36 @wc $^