forked from JanThorbecke/OpenSource
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMake_include_template
161 lines (138 loc) · 4 KB
/
Make_include_template
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
149
150
151
152
153
154
155
156
157
158
159
160
# Makefile for general rules
# To Change the compile environment to your current system you should set:
# -1- ROOT variable to the directory where you found this file
# -2- if needed use a different compiler (CC) if gcc is not available
# -3- on Solaris system use RANLIB=ranlib which is defined below
# the current directory (in vi ":r!pwd")
ROOT=REPLACE_WITH_PWD
#############################################################################
# Some convenient abbreviations
B = $(ROOT)/bin
I = $(ROOT)/include
L = $(ROOT)/lib
########################################################################
# C compiler; change this only if you are using a different C-compiler
#GNU
#CC = gcc-mp-5
CC = gcc
FC =
#FC = gfortran
# Linux gcc version 4.x
OPTC = -O3 -ffast-math
##to include parallelisation with OpenMP
OPTC += -fopenmp
# for better performing code you can try:
#OPTC = -O3 -fno-trapping-math -ffast-math -funroll-all-loops -mavx -fomit-frame-pointer -mfpmath=sse -ftree-vectorizer-verbose=1
# Linux gcc version 3.x
#OPTC = -O3 -ffast-math -funroll-all-loops -mfpmath=sse
#for double precision use FFTlib and emmod
#OPTC += -DDOUBLE
#OPTF += -fdefault-double-8 -fdefault-real-8
#Cray
#CC=cc
#FC=ftn
#OPTC = -O2
#OPTF = -O2
#Intel
#CC = icc
#FC = ifort
### Linux
##OPTC = -O3 -qopt-report-phase=vec,openmp
##OPTF = -O3 -qopt-report-phase=vec,openmp
#OPTC = -O3 -xCORE-AVX2
#OPTF = -O3 -xCORE-AVX2
###to include parallelisation with OpenMP
#OPTC += -qopenmp
## for static linking uncomment the following
#LDFLAGS = -static-intel -qopenmp-link=static
#PGI
#CC = pgcc
#FC = pgf90
#OPTC = -fast -Minfo=vect -Mvect=simd:256 -Msafeptr
#OPTC = -fast -Minfo=vect -Mvect=simd:256 -Msafeptr -Mprof=lines
#OPTF = -fast
#LDFLAGS = -fast -Minfo=vect -Mvect=simd:256 -Msafeptr
#Apple OSX clang/gcc (10.9) llvm
#CC = clang
#FC =
#OPTC = -Ofast
#LDFLAGS = -Ofast
#AMD Open64 this will be replaced with the latest AOCC compilers
#CC = opencc
#FC = openf95
#OPTC = -Ofast
#OPTF = -Ofast
#LDFLAGS = -static -Ofast
#############################################################################
# BLAS and LAPACK libraries
#MKLROOT=/opt/intel/mkl/
#MKLROOT=
ifneq ($(strip $(MKLROOT)),)
ifeq ($(CC),icc)
#for intel compilers
OPTC += -DMKL -I$(MKLROOT)/include -I$(MKLROOT)/include/fftw
BLAS = -mkl
else
#for GNU and other compilers
#on linux you want to use groups and MKL is in lib/intel64
MKLLIB=${MKLROOT}/lib/intel64
OPTC += -DMKL -I$(MKLROOT)/include -I$(MKLROOT)/include/fftw
BLAS = -Wl,-rpath ${MKLLIB} -Wl,--start-group -L${MKLLIB} -lmkl_gf_lp64 -lmkl_sequential -lmkl_core -Wl,--end-group -lpthread -lm -ldl
endif
else
BLAS = -llapack -lblas
endif
#LIBARIES
LIBS= -L$L -lgenfft
ifneq ($(strip $(MKLROOT)),)
LIBS += $(BLAS)
endif
ifeq ($(FC),ifort)
LIBS += -lifcore
# for static linking with Intel compiler
# LDFLAGS = -static-intel -qopenmp-link=static
endif
ifeq ($(FC),gfortran)
LIBS += -lgfortran
endif
#MATH library: on some linux distributions the math (cos, sin, ..) must be excluded explicitely
#if that's needed uncomment the following line
#LIBSM= -lm
########################################################################
# standard CFLAGS
CFLAGS = -I$I -I.
#############################################################################
# the archiver
AR = ar
#############################################################################
# ar FLAGS
ARFLAGS = rv
#############################################################################
# ranlib definition
RANLIB = ar -s
# on Sun SOLARIS use:
#RANLIB = ranlib
.SUFFIXES : .o .c .cc .f .a .F90
.c.o :
$(CC) -c $(CFLAGS) $(OPTC) $<
.c.a :
$(CC) -c $(CFLAGS) $(OPTC) $<
$(AR) $(ARFLAGS) $@ $*.o
rm -f $*.o
.o.a :
$(AR) $(ARFLAGS) $@ $*.o
rm -f $*.o
.f.o :
$(FC) -c $(FFLAGS) $(OPTF) $<
.F90.o :
$(FC) -c $(FFLAGS) $(OPTF) $<
.f.a :
$(FC) -c $(FFLAGS) -I$I $<
$(AR) $(ARFLAGS) $@ $*.o
rm -f $*.o
.cc.a :
$(C++) -c $(C++FLAGS) -I$I $<
$(AR) $(ARFLAGS) $@ $*.o
rm -f $*.o
.cc.o :
$(C++) -c $(C++FLAGS) $<