forked from commentjava/commentjava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (45 loc) · 1.51 KB
/
Makefile
File metadata and controls
63 lines (45 loc) · 1.51 KB
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
60
61
62
MENHIR := menhir
OCAMLBUILD := ocamlbuild
MENHIRFLAGS := --table --dump --explain
OCAMLFLAGS := -use-ocamlfind -use-menhir -menhir "$(MENHIR) $(MENHIRFLAGS)" -package menhirLib
EXT := native
MAIN_DIR := Main
MAIN := Main
TEST_DIR := Test
TEST_FILES = $(shell find $(TEST_DIR) -name '*Test.ml')
TESTS := $(basename $(notdir $(TEST_FILES)))
TEST_BINS := $(addsuffix .$(EXT), $(TESTS))
RUN_TESTS := $(addprefix test-, $(TEST_BINS))
TEST_JDK = TestJDK
MLY_FILES := $(shell find . -name '*.mly' )
MLL_FILES := $(shell find . -name '*.mll' )
ML_FILES := $(shell find . -name '*.ml' )
ERRORS_FILE := _build/errors.txt
.PHONY: all clean test-all $(RUN_TESTS) test-jdk
# Building receipes
all: $(MAIN).native
$(MAIN).native: $(ML_FILES) $(MLL_FILES) $(MLY_FILES) Makefile
$(OCAMLBUILD) $(OCAMLFLAGS) $(MAIN_DIR)/$(MAIN).$(EXT)
$(TEST_JDK).native: $(ML_FILES) $(MLL_FILES) $(MLY_FILES) Makefile
$(OCAMLBUILD) $(OCAMLFLAGS) $(TEST_DIR)/$(TEST_JDK).$(EXT)
$(TEST_BINS): $(ML_FILES) $(MLL_FILES) $(MLY_FILES) Makefile
$(OCAMLBUILD) $(OCAMLFLAGS) $(TEST_DIR)/$@
# Tests receipes
test-all: $(RUN_TESTS)
$(RUN_TESTS): $(TEST_BINS)
./$(subst test-,,$@)
test-list:
@for t in $(RUN_TESTS) ; do \
echo "$$t" ; \
done;
@echo "test-all"
@echo "test-jdk"
test-jdk: $(TEST_JDK).native
./_build/$(TEST_DIR)/$(TEST_JDK).native
# TODO: In the future the ERRORS_FILE should be commited
list-errors: $(MAIN).native
menhir --list-errors Parsing/*.mly --base result > $(ERRORS_FILE)
# Clean receipes
clean:
rm -f $(ERRORS_FILE)
$(OCAMLBUILD) -clean