-
Notifications
You must be signed in to change notification settings - Fork 7
/
make_defs.inc
149 lines (138 loc) · 4.85 KB
/
make_defs.inc
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
###############################################################################
# #
# make_defs.inc - include file for making libaed. #
# #
# Developed by : #
# AquaticEcoDynamics (AED) Group #
# School of Agriculture and Environment #
# The University of Western Australia #
# #
# http://aquatic.science.uwa.edu.au/ #
# #
# Copyright 2013 - 2024 - The University of Western Australia #
# #
# AED is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# AED is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
###############################################################################
ifeq ($(shell uname),Linux)
OSTYPE=$(shell uname -s)
else ifeq ($(shell uname),Darwin)
OSTYPE=$(shell uname -s)
else ifeq ($(shell uname),FreeBSD)
OSTYPE=$(shell uname -s)
else
OSTYPE=$(shell uname -o)
endif
ifeq ($(VERSION),)
VERSION=$(shell grep AED_VERSION ../libaed-water/include/aed.h | head -1 | cut -f2 -d\")
endif
SOVERS=$(shell echo $(VERSION) | cut -f1 -d\.)
VERS=$(shell echo $(VERSION) | cut -f2- -d\.)
objdir=obj
srcdir=src
libdir=lib
moddir=mod
incdir=include
ifeq ($(F90),)
F90=gfortran
endif
#ifeq ($(MDEBUG),true)
# DEBUG=true
#endif
#INCLUDES+=-I${incdir}
MDBG_FFLAGS=""
ifeq ($(OSTYPE),Darwin)
SHARED=-dynamiclib -undefined dynamic_lookup
so_ext=dylib
else
SHARED=-shared -Wl,-soname,$(OUTLIB).so.$(SOVERS)
so_ext=so
endif
ifeq ($(F90),ifort)
INCLUDES+=-I/opt/intel/include
DEBUG_FFLAGS=-g -traceback
OMPFLAG=-qopenmp
OPT_FFLAGS=-O3
FFLAGS=-warn all -module ${moddir} -static-intel -mp1 -stand f08 -warn nounused
ifeq ($(WITH_CHECKS),true)
FFLAGS+=-check all -check noarg_temp_created
endif
FFLAGS+=-real-size 64
else ifeq ($(F90),ifx)
# INCLUDES+=-I/opt/intel/oneapi/compiler/latest/include
DEBUG_FFLAGS=-g -traceback -O0
OMPFLAG=-qopenmp
OPT_FFLAGS=-O3
FFLAGS=-warn all -module ${moddir} -static-intel -mp1 -stand f08 -warn nounused
ifeq ($(WITH_CHECKS),true)
FFLAGS+=-check all -check noarg_temp_created
endif
FFLAGS+=-real-size 64
else ifeq ($(F90),flang)
ifeq ($(OSTYPE),FreeBSD)
INCLUDES+=-I../ancillary/freebsd/mod
endif
DEBUG_FFLAGS=-g
OMPFLAG=-fopenmp
OPT_FFLAGS=-O3
FFLAGS=-module ${moddir}
ifeq ($(WITH_CHECKS),true)
FFLAGS+=-Mbounds
endif
FFLAGS+=-r8
else
DEBUG_FFLAGS=-g -fbacktrace
MDBG_FFLAGS=-fsanitize=address
OMPFLAG=-fopenmp
OPT_FFLAGS=-O3
# we use std=f2008ts rather than f2008 because ts removes some type checking
# restrictions on interoperabilty routines (which were wrong anyway...)
FFLAGS=-Wall -J ${moddir} -ffree-line-length-none -std=f2008ts
ifeq ($(OSTYPE),Msys)
FFLAGS+=-D_WIN32
endif
FFLAGS+=-fall-intrinsics -Wno-unused -Wno-unused-dummy-argument
FFLAGS+=-Wno-missing-include-dirs
ifeq ($(WITH_CHECKS),true)
FFLAGS+=-fcheck=all
else
FFLAGS+=-fno-range-check -Wno-integer-division
endif
FFLAGS+=-fdefault-real-8 -fdefault-double-8
endif
FFLAGS+=$(DEFINES) $(INCLUDES)
ifeq ($(EXTERNAL_LIBS),shared)
FFLAGS+=-fPIC
TARGET = ${libdir}/$(OUTLIB).${so_ext}
else
FFLAGS+=-fPIE
TARGET = ${libdir}/$(OUTLIB).a
endif
ifeq ($(DEBUG),true)
DEBUG_CFLAGS=-g
OPT_CFLAGS=
OPT_FFLAGS=
FFLAGS+=$(DEBUG_FFLAGS)
else
DEBUG_FFLAGS=
DEBUG_CFLAGS=
# OPT_CFLAGS=-O4 -Ofast -frounding-math
OPT_CFLAGS=-O3
# OPT_CFLAGS=
# OPT_FFLAGS=
FFLAGS+=$(OPT_FFLAGS)
endif
ifeq ($MDEBUG),true)
FFLAGS+=$(MDBG_FFLAGS)
endif