Merge branch 'master' of https://github.com/kanaka/mal into fsharp
[jackhill/mal.git] / go / Makefile
1 export GOPATH := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
2
3 #####################
4
5 SOURCES_BASE = src/types/types.go src/readline/readline.go \
6 src/reader/reader.go src/printer/printer.go \
7 src/env/env.go src/core/core.go
8 SOURCES_LISP = src/env/env.go src/core/core.go \
9 src/stepA_mal/stepA_mal.go
10 SOURCES = $(SOURCES_BASE) $(word $(words $(SOURCES_LISP)),${SOURCES_LISP})
11
12 #####################
13
14 SRCS = step0_repl.go step1_read_print.go step2_eval.go step3_env.go \
15 step4_if_fn_do.go step5_tco.go step6_file.go step7_quote.go \
16 step8_macros.go step9_try.go stepA_mal.go
17 BINS = $(SRCS:%.go=%)
18
19 #####################
20
21 all: $(BINS) mal
22
23 mal: $(word $(words $(BINS)),$(BINS))
24 cp $< $@
25
26 define dep_template
27 $(1): $(SOURCES_BASE) src/$(1)/$(1).go
28 go build $$@
29 endef
30
31 $(foreach b,$(BINS),$(eval $(call dep_template,$(b))))
32
33 clean:
34 rm -f $(BINS) mal
35
36 .PHONY: stats stats-lisp
37
38 stats: $(SOURCES)
39 @wc $^
40 stats-lisp: $(SOURCES_LISP)
41 @wc $^