forked from MLanguage/mlang
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
105 lines (77 loc) · 2.54 KB
/
Makefile
File metadata and controls
105 lines (77 loc) · 2.54 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Check Makefile.config.template if you want to override some of the flags
# in this Makefile.
include Makefile.include
ifeq ($(CODE_COVERAGE), 1)
CODE_COVERAGE_FLAG=--code_coverage
else
CODE_COVERAGE_FLAG=
endif
ifeq ($(TEST_FILTER), 1)
TEST_FILTER_FLAG=--dgfip_test_filter
else
TEST_FILTER_FLAG=
endif
TEST_ERROR_MARGIN?=0.
MLANG_INTERPRETER_OPTS=\
--test_error_margin=$(TEST_ERROR_MARGIN) \
--mpp_file=$(MPP_FILE) \
--mpp_function=$(MPP_FUNCTION)
MLANG=$(MLANG_BIN) $(MLANG_DEFAULT_OPTS) $(MLANG_INTERPRETER_OPTS) $(CODE_COVERAGE_FLAG)
default: build
##################################################
# Initializing the project
##################################################
# Workaround for Opam 2.0 bug. Empty switch creation then installation could be a one line
# "opam switch create . --deps-only" otherwise
create-switch:
opam switch create . --empty
init-without-switch:
opam install . --deps-only
git submodule update --init
init: create-switch init-without-switch
deps:
opam switch reinstall --deps-only
git submodule update
##################################################
# Building the compiler
##################################################
format:
dune build @fmt --auto-promote | true
build: format dune
dune:
dune build $(DUNE_OPTIONS)
# Run only in an opam switch with musl and static options activated
build-static: DUNE_OPTIONS+=--profile=static
build-static: build
##################################################
# Testing the compiler
##################################################
# use: TEST_FILE=bla make test
test: build
$(MLANG) --run_test=$(TEST_FILE) $(SOURCE_FILES)
# use: TESTS_DIR=bla make test
tests: build
$(MLANG) $(MLANGOPTS) --run_all_tests=$(TESTS_DIR) $(TEST_FILTER_FLAG) $(SOURCE_FILES)
test_java_backend: build
ifeq ($(OPTIMIZE), 0)
@echo "\033[0;31mWarning, non-optimized Java files cannot be executed for now (too many constants for the JVM)\033[0m"
else
endif
$(MAKE) -C examples/java/ run_tests
test_dgfip_c_backend: build
$(MAKE) -C examples/dgfip_c/ml_primitif backend_tests
quick_test: build
$(MLANG) --backend interpreter --function_spec $(M_SPEC_FILE) $(SOURCE_FILES)
all: tests test_java_backend test_dgfip_c_backend quick_test
##################################################
# Doc
##################################################
doc: FORCE build
dune build @doc
ln -fs $(shell pwd)/_build/default/_doc/_html/index.html doc/doc.html
clean:
$(MAKE) -C examples/dgfip_c/ml_primitif cleanall
$(MAKE) -C examples/java clean
rm -f doc/doc.html
dune clean
FORCE: