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