aboutsummaryrefslogtreecommitdiff
path: root/cs/Makefile
blob: 70d54ad04892224db939477a10f14cc3a850aa57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#####################

DEBUG =

TESTS =

SOURCES_BASE = readline.cs types.cs reader.cs printer.cs
SOURCES_LISP = env.cs core.cs stepA_mal.cs
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)

OTHER_SOURCES = getline.cs

#####################

SRCS = step0_repl.cs step1_read_print.cs step2_eval.cs step3_env.cs \
       step4_if_fn_do.cs step5_tco.cs step6_file.cs step7_quote.cs \
       step8_macros.cs step9_try.cs stepA_mal.cs

LIB_SRCS = $(filter-out step%,$(OTHER_SOURCES) $(SOURCES))

FLAGS = $(if $(strip $(DEBUG)),-debug+,)

#####################

all: mal.exe $(patsubst %.cs,%.exe,$(SRCS))

mal.exe: $(patsubst %.cs,%.exe,$(word $(words $(SOURCES)),$(SOURCES)))
	cp $< $@

mal.dll: $(LIB_SRCS)
	mcs $(FLAGS) -target:library $+ -out:$@

%.exe: %.cs mal.dll
	mcs $(FLAGS) -r:mal.dll $<

clean:
	rm -f *.dll *.exe *.mdb

.PHONY: stats tests $(TESTS)

stats: $(SOURCES)
	@wc $^
stats-lisp: $(SOURCES_LISP)
	@wc $^

tests: $(TESTS)

$(TESTS):
	@echo "Running $@"; \
	./$@ || exit 1; \