-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (31 loc) · 1.03 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
TEST := go test
TEST_FLAGS := -v
TEST_TARGET := ./...
BUILD := go build
RUN := go run
RAGEL_COMPILE := ragel -n -Z
RAGEL_STATE_MACHINE_TYPE := -G2
RAGEL_DOT := ragel -n -V -p
RAGEL_OBJECT := src/parser/parser_internal.go
test: RAGEL_STATE_MACHINE_TYPE = -T0
test: ragel
$(TEST) $(TEST_FLAGS) $(TEST_TARGET) -args quiet stop-on-failure
.PHONY: lines
lines:
wc -l $(RAGEL_OBJECT)
coverage_markdown.out: TEST_TARGET := ./src/markdown/...
coverage_markdown.out: TEST_FLAGS += -covermode=count -coverprofile=coverage_markdown.out
coverage_markdown.out: $(RAGEL_OBJECT) test
coverage_parser.out: TEST_TARGET := ./src/parser/...
coverage_parser.out: TEST_FLAGS += -covermode=count -coverprofile=coverage_parser.out
coverage_parser.out: $(RAGEL_OBJECT) test
.PHONY: ragel
ragel: $(RAGEL_OBJECT)
$(RAGEL_OBJECT) : ragel/%.rl
ragel/%.rl:
$(RAGEL_COMPILE) $(RAGEL_STATE_MACHINE_TYPE) -o $(RAGEL_OBJECT) ./ragel/parser.rl
dot:
$(RAGEL_DOT) -o parser_internal.dot ragel/parser.rl
clean:
$(RM) -v src/parser/parser_internal.go
$(RM) -v coverage_*.out