a3b46b041696631a06bac84cb76697ed0b5b7f77
[jackhill/mal.git] / objpascal / Makefile
1 STEPS = step0_repl.pas step1_read_print.pas step2_eval.pas \
2 step3_env.pas step4_if_fn_do.pas step5_tco.pas \
3 step6_file.pas step7_quote.pas step8_macros.pas \
4 step9_try.pas stepA_mal.pas
5
6 STEP0_DEPS = pas-readline/src/readline.pas regexpr/Source/RegExpr.pas
7 STEP1_DEPS = $(STEP0_DEPS) mal_types.pas reader.pas printer.pas
8 STEP3_DEPS = $(STEP1_DEPS) mal_env.pas
9 STEP4_DEPS = $(STEP3_DEPS) core.pas
10
11 SOURCES = mal_types.pas mal_func.pas reader.pas printer.pas \
12 mal_env.pas core.pas stepA_mal.pas
13 SOURCES_LISP = mal_env.pas core.pas stepA_mal.pas
14
15 #####################
16
17 DEBUG = -gl
18
19 FPC = fpc -MOBJFPC -ve $(DEBUG) -Fupas-readline/src -Furegexpr/Source
20
21 all: $(patsubst %.pas,%,$(STEPS))
22
23 # Downloaded units
24 pas-readline: pas-readline/src/readline.pas
25 pas-readline/src/readline.pas:
26 curl -L https://github.com/hansiglaser/pas-readline/archive/master.tar.gz | tar xzf -
27 mv pas-readline-master pas-readline
28
29 #regexpr: regexpr/Source/RegExpr.pas
30 #regexpr/Source/RegExpr.pas: regexpr-linux.patch
31 # mkdir -p regexpr
32 # curl -O http://regexpstudio.com/Downloads/regexpr.zip
33 # cd regexpr && unzip ../regexpr.zip
34 # rm regexpr.zip
35 # patch -p1 < regexpr-linux.patch
36
37 step%: step%.pas
38 $(FPC) $<
39
40 step0_repl: $(STEP0_DEPS)
41 step1_read_print step2_eval: $(STEP1_DEPS)
42 step3_env: $(STEP3_DEPS)
43 step4_if_fn_do step5_tco step6_file step7_quote step8_macros step9_try stepA_mal: $(STEP4_DEPS)
44
45 clean:
46 rm -f $(STEPS:%.pas=%) *.o *.ppu regexpr/Source/*.o regexpr/Source/*.ppu mal
47
48 .PHONY: stats stats-lisp
49
50 stats: $(SOURCES)
51 @wc $^
52 @printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*//|^[[:space:]]*$$" $^ | wc` "[comments/blanks]"
53 stats-lisp: $(SOURCES_LISP)
54 @wc $^
55 @printf "%5s %5s %5s %s\n" `grep -E "^[[:space:]]*//|^[[:space:]]*$$" $^ | wc` "[comments/blanks]"
56