Commit | Line | Data |
---|---|---|
1c358979 PS |
1 | ##################### |
2 | ||
6dcc04db | 3 | DEBUG = |
1c358979 PS |
4 | |
5 | TESTS = | |
6 | ||
224d2396 | 7 | SOURCES_BASE = types.fs error.fs node.fs printer.fs tokenizer.fs reader.fs \ |
fc4c7889 JM |
8 | readline.fs |
9 | SOURCES_LISP = core.fs env.fs stepA_mal.fs | |
ed3a12f5 PS |
10 | SOURCES = $(SOURCES_BASE) $(SOURCES_LISP) |
11 | ||
12 | TERMINAL_SOURCES = terminal.cs | |
1c358979 PS |
13 | |
14 | ##################### | |
15 | ||
a836d8f3 | 16 | SRCS = step0_repl.fs step1_read_print.fs step2_eval.fs step3_env.fs \ |
f0e1608b | 17 | step4_if_fn_do.fs step5_tco.fs step6_file.fs step7_quote.fs \ |
9a58a022 | 18 | step8_macros.fs step9_try.fs stepA_mal.fs |
fc4c7889 | 19 | DLL_SOURCES = $(filter-out stepA_mal.fs,$(SOURCES)) |
1c358979 | 20 | |
8862f80e | 21 | FSFLAGS = $(if $(strip $(DEBUG)),--debug+,--debug- --optimize+ --tailcalls+) |
6dcc04db | 22 | CSFLAGS = $(if $(strip $(DEBUG)),-debug+,) |
1c358979 PS |
23 | ##################### |
24 | ||
25 | all: $(patsubst %.fs,%.exe,$(SRCS)) | |
26 | ||
8e2d4a4c | 27 | dist: mal.exe mal |
5245b079 JM |
28 | |
29 | mal.exe: stepA_mal.exe | |
30 | cp $< $@ | |
31 | ||
8e2d4a4c JM |
32 | # NOTE/WARNING: static linking triggers mono libraries LGPL |
33 | # distribution requirements. | |
34 | # http://www.mono-project.com/archived/guiderunning_mono_applications/ | |
35 | mal: $(patsubst %.fs,%.exe,$(word $(words $(SOURCES)),$(SOURCES))) Mono.Terminal.dll mal.dll | |
36 | mkbundle --static -o $@ $+ --deps | |
37 | ||
ed3a12f5 | 38 | Mono.Terminal.dll: $(TERMINAL_SOURCES) |
6dcc04db | 39 | mcs $(CSFLAGS) -target:library $+ -out:$@ |
ed3a12f5 | 40 | |
fc4c7889 JM |
41 | mal.dll: $(DLL_SOURCES) Mono.Terminal.dll |
42 | fsharpc $(FSFLAGS) -o $@ -r Mono.Terminal.dll -a $(DLL_SOURCES) | |
ed3a12f5 PS |
43 | |
44 | %.exe: %.fs mal.dll | |
6dcc04db | 45 | fsharpc $(FSFLAGS) -o $@ -r mal.dll $< |
1c358979 PS |
46 | |
47 | clean: | |
8e2d4a4c | 48 | rm -f mal *.dll *.exe *.mdb |
1c358979 PS |
49 | |
50 | .PHONY: stats tests $(TESTS) | |
51 | ||
52 | stats: $(SOURCES) | |
53 | @wc $^ | |
f15b4021 | 54 | @printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*//|^[[:space:]]*$$" $^ | wc` "[comments/blanks]" |
1c358979 PS |
55 | stats-lisp: $(SOURCES_LISP) |
56 | @wc $^ | |
f15b4021 | 57 | @printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*//|^[[:space:]]*$$" $^ | wc` "[comments/blanks]" |
1c358979 PS |
58 | |
59 | tests: $(TESTS) | |
60 | ||
61 | $(TESTS): | |
62 | @echo "Running $@"; \ | |
63 | ./$@ || exit 1; \ |