-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakeheader
107 lines (90 loc) · 3.51 KB
/
Makeheader
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
#
# The available CRAVA compiler directives are
# -DBIGENDIAN (needed for IRIX, SUNOS, etc...)
#
SHELL = sh
OS = $(shell uname -s)
FLAVOUR = $(shell lsb_release -si)
VERSION = $(shell lsb_release -r | sed 's/[^0-9\.]*//g')
CDIR = -DFLENS_FIRST_INDEX=0
CXX = g++
CC = gcc
GCCNEW = $(shell expr `gcc -dumpversion | sed s/\\.//` \>= 46)
GCCWARNING := -Wall -pedantic -Wno-long-long -Werror
#
# The directive -fno-strict-aliasing has been included to avoid a following compilator error:
# segy/traceheader.cpp: In member function ‘int NRLib::TraceHeader::GetInt32(int) const’:
# segy/traceheader.cpp:519: error: dereferencing type-punned pointer will break strict-aliasing rules
#
GXXWARNING = -Wall -pedantic -Werror -Woverloaded-virtual -Wno-long-long -fno-strict-aliasing -Wno-deprecated-declarations -Wno-unused-but-set-variable
PROGRAM = cravarun
GRAMMAR = grammar.exe
COMPARE = compare.exe
OPT = -O2
DEBUG =
PURIFY =
mode = all
#o======================================================o
#| Mode |
#o======================================================o
ifeq ($(mode),debug)
# Don't use -O2 (makes it impossible to set breakpoints)
DEBUG = -g
OPT = -O0
endif
ifeq ($(mode),profile)
# Don't use -ggdb here
DEBUG = -g
PROFILE = -pg
endif
ifeq ($(mode),purify)
# Don't use -ggdb here
DEBUG = -g
OPT = -O0
PROGRAM = cravarun.purify
PURIFY = purify -best-effort
endif
#o======================================================o
#| Parallelization |
#o======================================================o
#ifneq ($(parallel),no) # default = yes
ifeq ($(parallel),yes) # default = no
PARALLEL = -fopenmp -DPARALLEL
EXTRALFLAGS += -fopenmp
endif
#o======================================================o
#| RedHat vs. Ubuntu linking |
#o======================================================o
ifeq ($(FLAVOUR),RedHatEnterpriseServer)
ATLASLFLAGS = -L/usr/lib64/atlas -llapack -lblas -lsatlas -lgfortran # For RH6
ifeq ($(shell expr $(VERSION) \>= 7.0), 1)
ATLASLFLAGS = -L/usr/lib64/atlas -llapack -lblas -lsatlas -lgfortran # For RH7
endif
endif
ifeq ($(FLAVOUR),Ubuntu)
ATLASLFLAGS = -llapack -lblas -lcblas -latlas -lgfortran -lquadmath
endif
#o======================================================o
#| LAPACK vs. Intel MKL |
#o======================================================o
ifeq ($(lib),mkl)
ATLASLFLAGS =
MKLINCLUDE := /nr/prog/intel/Compiler/mkl/include
MKLPATH := /nr/prog/intel/Compiler/mkl/lib/intel64
MKLLFLAGS := -L$(MKLPATH) -I$(MKLINCLUDE) -Wl,--start-group $(MKLPATH)/libmkl_intel_lp64.a \
$(MKLPATH)/libmkl_sequential.a $(MKLPATH)/libmkl_core.a -Wl,--end-group \
-lpthread -ldl
endif
#o======================================================o
#| Remove blanks |
#o======================================================o
OPT := $(strip $(OPT))
PROFILE := $(strip $(PROFILE))
DEBUG := $(strip $(DEBUG))
CDIR := $(strip $(CDIR))
PURIFY := $(strip $(PURIFY))
EXTRAFLAGS = $(strip $(DEBUG) $(PROFILE) $(OPT) $(CDIR) $(PARALLEL))
CFLAGS = $(GCCWARNING)
CXXFLAGS = $(GXXWARNING)
CPPFLAGS = $(EXTRAFLAGS)
LFLAGS = $(EXTRALFLAGS) $(DEBUG) $(PROFILE) $(ATLASLFLAGS)$(MKLLFLAGS) -lm