-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
59 lines (40 loc) · 1.14 KB
/
Makefile
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
51
52
53
54
55
56
57
58
59
TOOL_NAME=peadae
BIN_PATH=${HOME}/.local/bin
SRCS := $(shell find . -name "*.mc" -a ! -name "peadae.mc" -a ! -name "ast_gen.mc" -a ! -wholename "./examples/*" ! -wholename "./legacy/*" ! -wholename "./.git/*")
TESTS := $(SRCS:.mc=.test)
TESTBINS := $(SRCS:.mc=.test.exe.run)
.PHONY: test test-examples watch-test clean
all: build/${TOOL_NAME}
build/${TOOL_NAME}: ${TOOL_NAME}.exe
mkdir -p build
mv ${TOOL_NAME}.exe build/${TOOL_NAME}
test: export PEADAE=$(shell pwd)
test: $(TESTS)
test-compiled: $(TESTBINS)
test-examples: export PEADAE=$(shell pwd)
test-examples:
$(MAKE) test -C examples
test-all: test test-examples
%.test: %.mc
mi --test $<
@echo ""
%.exe.run: %.exe
./$<
@echo ""
%.test.exe: %.mc
mi compile --test --output $@ $<
%.exe: %.mc
mi compile --output $@ $<
${TOOL_NAME}.exe: $(SRCS)
ast_gen.mc: ast.syn
mi syn ast.syn ast_gen.mc
watch:
find . "(" -name "*.mc" -o -name "*.syn" ")" -a ! -name "ast_gen.mc" | entr -rc make test
install: build/${TOOL_NAME}
cp build/${TOOL_NAME} ${BIN_PATH}
uninstall:
rm -f ${BIN_PATH}/${TOOL_NAME}
clean: clean-examples
rm -rf *.exe build
clean-examples:
$(MAKE) clean -C examples