Add gensym and clean `or` macro to stepA of 19 implementations (part 3)
[jackhill/mal.git] / cs / Makefile
1 #####################
2
3 DEBUG =
4
5 TESTS =
6
7 SOURCES_BASE = readline.cs types.cs reader.cs printer.cs
8 SOURCES_LISP = env.cs core.cs stepA_mal.cs
9 SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
10
11 OTHER_SOURCES = getline.cs
12
13 #####################
14
15 SRCS = step0_repl.cs step1_read_print.cs step2_eval.cs step3_env.cs \
16 step4_if_fn_do.cs step5_tco.cs step6_file.cs step7_quote.cs \
17 step8_macros.cs step9_try.cs stepA_mal.cs
18
19 LIB_SRCS = $(filter-out step%,$(OTHER_SOURCES) $(SOURCES))
20
21 FLAGS = $(if $(strip $(DEBUG)),-debug+,)
22
23 #####################
24
25 all: mal.exe $(patsubst %.cs,%.exe,$(SRCS))
26
27 mal.exe: $(patsubst %.cs,%.exe,$(word $(words $(SOURCES)),$(SOURCES)))
28 cp $< $@
29
30 mal.dll: $(LIB_SRCS)
31 mcs $(FLAGS) -target:library $+ -out:$@
32
33 %.exe: %.cs mal.dll
34 mcs $(FLAGS) -r:mal.dll $<
35
36 clean:
37 rm -f *.dll *.exe *.mdb
38
39 .PHONY: stats tests $(TESTS)
40
41 stats: $(SOURCES)
42 @wc $^
43 @printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*//|^[[:space:]]*$$" $^ | wc` "[comments/blanks]"
44 stats-lisp: $(SOURCES_LISP)
45 @wc $^
46 @printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*//|^[[:space:]]*$$" $^ | wc` "[comments/blanks]"
47
48 tests: $(TESTS)
49
50 $(TESTS):
51 @echo "Running $@"; \
52 ./$@ || exit 1; \