-
Notifications
You must be signed in to change notification settings - Fork 28
/
Makefile_gnu
69 lines (60 loc) · 1.7 KB
/
Makefile_gnu
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
ifeq ($(MPI),1)
FC = mpifort
CC = mpicc
CXX = mpicxx
else
FC = gfortran
CC = gcc
CXX = g++
endif
LD = $(FC)
# Archive tool
AR = ar rv
# default flags
# --------------
# free-line-length-none : turn of line length limitation (why is this not a default??)
# cpp : perform preprocessing
# fPIC : for compiling a shared object library
FFLAGS += -ffree-line-length-none -cpp -fPIC -fno-stack-arrays
CXXFLAGS += -std=c++11 -fPIC
CFLAGS += -fPIC
# This is now needed for gfortran versions >=10
ifeq "$(shell expr `gfortran -dumpversion | cut -f1 -d.` \>= 10)" "1"
FFLAGS += -fallow-argument-mismatch
endif
# clang uses a different libstdc++ than GCC
ifneq (,$(findstring clang,$(shell '$(CXX)' -v 2>&1)))
LDLIBS += -lc++
else
LDLIBS += -lstdc++
endif
detected_OS := $(shell uname -s)
ifeq ($(detected_OS),Darwin)
RPATH=-install_name @loader_path/pypolychord/lib/libchord.so
else
RPATH=
endif
ifeq ($(DEBUG),1)
# Debugging mode
# --------------
# g : enable gnu debugger compatibility
# O0 : no optimisation
# Wall : all warnings
# Wextra : even more warnings
# pedantic : check for language features not part of f95 standard
# implicit-none : specify no implicit typing
# backtrace : produce backtrace of error
# fpe-trap : search for floating point exceptions (dividing by zero etc)
# fbounds-check : check array indices
FFLAGS += -g -O0 -Wall -Wextra -pedantic -fcheck=all -fimplicit-none -fbacktrace -ffpe-trap=zero,overflow
#
CXXFLAGS += -g -O0 -Wall -Wextra -Wshadow -Weffc++
CFLAGS += -g -O0 -Wall -Wextra -Wshadow -Weffc++
else
# Optimised mode
# --------------
# Ofast : maximum optimisation
FFLAGS += -Ofast
CXXFLAGS += -Ofast
CXFLAGS += -Ofast
endif