All: swap step9,A. Fixes for bash, C, perl.
[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/stepA_interop/stepA_interop.go
9 SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
10
11 #####################
12
13 SRCS = step0_repl.go step1_read_print.go step2_eval.go step3_env.go \
14 step4_if_fn_do.go step5_tco.go step6_file.go step7_quote.go \
15 step8_macros.go step9_try.go stepA_interop.go
16 BINS = $(SRCS:%.go=%)
17
18 #####################
19
20 all: $(BINS) mal
21
22 mal: $(word $(words $(BINS)),$(BINS))
23 cp $< $@
24
25 define dep_template
26 $(1): $(SOURCES_BASE) src/$(1)/$(1).go
27 go build $$@
28 endef
29
30 $(foreach b,$(BINS),$(eval $(call dep_template,$(b))))
31
32 clean:
33 rm -f $(BINS) mal
34
35 .PHONY: stats stats-lisp
36
37 stats: $(SOURCES)
38 @wc $^
39 stats-lisp: $(SOURCES_LISP)
40 @wc $^