-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
111 lines (87 loc) · 2.47 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
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
#----------------------------------------------------------
# DEFAULT MAKE FLAGS
#----------------------------------------------------------
# Acceleration method? [none|numba|pycc|pythran]
ACC := pycc
# Use GNU or intel compilers? [GNU|intel]
COMP := GNU
# Target language
LANGUAGE := fortran
#PYTHRAN_FLAGS := -DUSE_XSIMD -fopenmp -march=native
PYTHRAN_FLAGS :=
#----------------------------------------------------------
# Compiler options
#----------------------------------------------------------
ifeq ($(COMP), GNU)
CC := gcc
FC := gfortran
FC_FLAGS := -Wall -O3 -fPIC -fstack-arrays
FF_COMP := gnu95
else \
ifeq ($(COMP), intel)
CC := icc
FC := ifort
FC_FLAGS := -O3 -xHost -ip -fpic
FF_COMP := intelem
endif
PYTHON := python3
SO_EXT := $(shell $(PYTHON) -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
#----------------------------------------------------------
# Defaut command:
# use pure python, pyccel, numba?
#----------------------------------------------------------
ifeq ($(ACC), pycc)
TOOL := pyccel
TOOL_FLAGS := --compiler=$(COMP) --flags ' $(FC_FLAGS)' --language=$(LANGUAGE)
NAME_PREFIX :=
else
ifeq ($(ACC), numba)
TOOL := $(PYTHON)
TOOL_FLAGS :=
NAME_PREFIX := numba_
else
ifeq ($(ACC), pythran)
TOOL := pythran
TOOL_FLAGS = $(PYTHRAN_FLAGS)
NAME_PREFIX := pythran_
else
TOOL := pyccel
TOOL_FLAGS := --flags ' $(FC_FLAGS)' --language= --language=$(LANGUAGE)
NAME_PREFIX :=
endif
endif
endif
#----------------------------------------------------------
# Export all relevant variables to children Makefiles
#----------------------------------------------------------
EXPORTED_VARS = CC FC FC_FLAGS FF_COMP PYCC_GEN PYTHON ACC PYTHRAN_FLAGS SO_EXT TOOL TOOL_FLAGS NAME_PREFIX
export EXPORTED_VARS $(EXPORTED_VARS)
#----------------------------------------------------------
# Make options
#----------------------------------------------------------
# Clear unfinished targets
.DELETE_ON_ERROR:
# Define the phony targets
.PHONY: all clean help
# List of main targets
ALL = \
splines \
initialisation \
advection
#----------------------------------------------------------
# Main targets
#----------------------------------------------------------
all:
$(MAKE) -C pygyro $(TYPE)
$(ALL):
$(MAKE) -C pygyro $@
pycc:
$(MAKE) -C pygyro $@
numba:
$(MAKE) -C pygyro $@
pythran:
$(MAKE) -C pygyro $@
clean:
$(MAKE) -C pygyro $@
help:
@echo "Available targets: $(ALL)"