forked from MLanguage/mlang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.include
112 lines (93 loc) · 4.07 KB
/
Makefile.include
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
106
107
108
109
110
111
112
##################################################
# Local customization
##################################################
# WARNING: Use of simple expansion here (":=" operator) is important to ensure the value of SELF_DIR
# is not evaluated again after inclusion of other makefiles. If these files are in
# another directory, this directory would have been the new SELF_DIR after them. You probably
# do not want that. Replace by "=" only if you understand this paragraph and know you need it.
SELF_DIR:=$(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
-include $(SELF_DIR)/Makefile.config
##################################################
# Tax computation configuration
##################################################
define source_dir
$(shell find $(1) -name \*.m ! -name err\*.m ! -name tgv\*.m | sort) $(1)errI.m $(1)tgvI.m
endef
SOURCE_DIR_2015:=$(call source_dir,$(SELF_DIR)/ir-calcul/sources2015m_4_6/)
SOURCE_DIR_2016:=$(call source_dir,$(SELF_DIR)/ir-calcul/sources2016m_4_5/)
SOURCE_DIR_2017:=$(call source_dir,$(SELF_DIR)/ir-calcul/sources2017m_6_10/)
SOURCE_DIR_2018:=$(call source_dir,$(SELF_DIR)/ir-calcul/sources2018m_6_7/)
SOURCE_DIR_2019:=$(call source_dir,$(SELF_DIR)/ir-calcul/sources2019m_8_0/)
SOURCE_DIR_2020:=$(call source_dir,$(SELF_DIR)/ir-calcul/sources2020m_6_5/)
YEAR?=2020
ifeq ($(YEAR), 2018)
SOURCE_FILES?=$(SOURCE_DIR_2018)
MPP_FILE?=$(SELF_DIR)/mpp_specs/2018_6_7.mpp
TESTS_DIR?=$(SELF_DIR)/tests/2018/fuzzing/
M_SPEC_FILE?=$(SELF_DIR)/m_specs/complex_case_with_ins_outs_2018.m_spec
MPP_FUNCTION?=compute_double_liquidation_pvro
else ifeq ($(YEAR), 2019)
SOURCE_FILES?=$(SOURCE_DIR_2019)
MPP_FILE?=$(SELF_DIR)/mpp_specs/2019_8_0.mpp
TESTS_DIR?=$(SELF_DIR)/tests/2019/fuzzing/
M_SPEC_FILE?=m_specs/complex_case_with_ins_outs_2019.m_spec
MPP_FUNCTION?=compute_double_liquidation_pvro
else ifeq ($(YEAR), 2020)
SOURCE_FILES?=$(SOURCE_DIR_2020)
MPP_FILE?=$(SELF_DIR)/mpp_specs/2020_6_5.mpp
TESTS_DIR?=$(SELF_DIR)/tests/2020/fuzzing/
M_SPEC_FILE?=$(SELF_DIR)/m_specs/complex_case_with_ins_outs_2020.m_spec
MPP_FUNCTION?=compute_double_liquidation_pvro
else
$(warning WARNING: there is no default configuration for year: $(YEAR))
$(warning WARNING: example specification files and fuzzer tests are not included for year: $(YEAR))
endif
##################################################
# Mlang configuration
##################################################
ifeq ($(OPTIMIZE), 0)
OPTIMIZE_FLAG=
else
OPTIMIZE_FLAG=-O
endif
MLANG_BIN=dune exec $(SELF_DIR)/_build/default/src/main.exe --
PRECISION?=double
MLANG_DEFAULT_OPTS=\
--display_time --debug \
--precision $(PRECISION) \
$(OPTIMIZE_FLAG)
##################################################
# C backend configuration
##################################################
# CC is a GNU make default variable defined to CC
# It so can't be overriden by conditional operator ?=
# We check the origin of CC value to not override CL argument or explicit environment.
ifeq ($(origin CC),default)
CC=clang
endif
# Options pour le compilateur C
# Attention, très long à compiler avec GCC en O2/O3
COMMON_CFLAGS?=-std=c89 -pedantic
ifeq ($(CC), clang)
COMPILER_SPECIFIC_CFLAGS=-O2
else ifeq ($(CC), gcc)
COMPILER_SPECIFIC_CFLAGS=-O1
endif
BACKEND_CFLAGS=$(COMMON_CFLAGS) $(COMPILER_SPECIFIC_CFLAGS)
# Directory of the static C sources for tax calculator interface
STATIC_DIR?=static/
# Directory of the driver sources for tax calculator
DRIVER_DIR?=ml_driver/
# Driver sources for tax calculator (must be manually ordered for OCaml compiler)
DRIVER_FILES?=stubs.c common.ml m.ml read_test.ml main.ml
# Flag to disable binary dump comparison
NO_BINARY_COMPARE?=0
##################################################
# Exports to call backends from main Makefile
##################################################
# common
export SOURCE_FILES TESTS_DIR MLANG_BIN MLANG_DEFAULT_OPTS
# for C backend (Java compilation is year-independent)
export YEAR CC BACKEND_CFLAGS STATIC_DIR DRIVER_DIR DRIVER_FILES NO_BINARY_COMPARE
# for Java backend (C overload these now)
export MPP_FUNCTION MPP_FILE