aboutsummaryrefslogtreecommitdiff
blob: e71d7d46d332eb9ec44997b6632c7430caf7dc70 (plain)
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
--- a/config/determine-cc.sh
+++ b/config/determine-cc.sh
@@ -1,7 +1,6 @@
 #!/bin/sh
 # determine what compiler is behind "cc" (and presumably "CC" and "ftn") wrapper
 
-CC=`which cc 2>/dev/null`
 COMP=
 if [ -z "$CC" ]; then
   echo "No 'cc' located!"
--- a/config/determine-compiler-version.sh
+++ b/config/determine-compiler-version.sh
@@ -24,8 +24,8 @@
          | cut -d\  -f 1`
        COMPVER="${CVER}/${FVER}"
        ;;
-  gnu) COMPVER=`gcc -dumpfullversion -dumpversion`
-       #COMPVER=`gcc -v 2>&1 | grep -i 'Version [0-9]' \
+  gnu) COMPVER=`${CC} -dumpfullversion -dumpversion`
+       #COMPVER=`${CC} -v 2>&1 | grep -i 'Version [0-9]' \
        #  | sed -e 's/^.*ersion \(.\..\..\).*$/\1/'`
        ;;
   *)   ErrorAndExit "Unknown compiler '${COMP}'"
--- a/config/select-compiler.sh
+++ b/config/select-compiler.sh
@@ -9,7 +9,7 @@
 CPS=""
 COMP=""
 
-GNU=`which gcc 2> /dev/null`
+GNU="${CC}"
 if [ -n "${GNU}" ]
 then
   NCPS=`expr ${NCPS} + 1`
--- a/config/select-mpi.sh
+++ b/config/select-mpi.sh
@@ -76,7 +76,6 @@
   if [ -z "${MPIS}" ]; then MPIS="${MPI}"; else MPIS="${MPIS}|${MPI}"; fi
 fi
 
-MPICC=`which mpicc 2> /dev/null`
 if [ -n "${MPICC}" ]
 then
   FMPI=""
@@ -86,7 +85,7 @@
   MPIROOTDIR1=`dirname ${MBINDIR}`
 
   echo "#include <mpi.h>" > conftest.c
-  mpicc -E conftest.c | grep '/mpi.h"' | head -1 > mpiconf.txt
+  "${MPICC}" -E conftest.c | grep '/mpi.h"' | head -1 > mpiconf.txt
   MINCDIR=`cat mpiconf.txt | sed -e 's#^.* "##' -e 's#/mpi.h".*##'`
   if [ -n "${MINCDIR}" ]
   then
--- a/mf/Makefile.defs.linux-gomp
+++ b/mf/Makefile.defs.linux-gomp
@@ -23,24 +23,19 @@
 #------------------------------------------------------------------------------
 # SIONlib General Settings
 #------------------------------------------------------------------------------
-OPTFLAGS = -g -O0 -Wall
+CFLAGS   += -std=c99 $(PFLAG) $(OPTFLAGS) -fPIC
 
-CC       = gcc
-CFLAGS   = -std=c99 $(PFLAG) $(OPTFLAGS) -fPIC
+CXXFLAGS += $(PFLAG) $(OPTFLAGS) -fPIC
 
-CXX      = g++
-CXXFLAGS = $(PFLAG) $(OPTFLAGS) -O3
-
-F77      = gfortran
-FFLAGS   = $(PFLAG) $(OPTFLAGS)
+FFLAGS   += $(PFLAG) $(OPTFLAGS) -fPIC
 
 F90      = $(F77)
-F90FLAGS = $(PFLAG) $(OPTFLAGS) -ffree-form
+F90FLAGS += $(PFLAG) $(OPTFLAGS) -ffree-form -fPIC $(FCFLAGS)
 
 FPP      =
 FDOPT    = -D
 
-LDFLAGS  = $(PFLAG) $(OPTFLAGS) $(HINTSLIB)
+LDFLAGS  += $(PFLAG) $(OPTFLAGS) $(HINTSLIB)
 UTILLIB  =
 FOBASE   = pomp_fwrapper_base.o
 
@@ -101,10 +96,6 @@
 #------------------------------------------------------------------------------
 
 MPIENABLE = 1
-MPICC     = mpicc
-MPICXX    = mpicxx
-MPIF77    = mpif77
-MPIF90    = mpif90
 MPILIB    = -lmpich
 PMPILIB   = -lpmpich
 #PMPILIB   = # MPICH2
@@ -139,8 +130,7 @@
 #------------------------------------------------------------------------------
 
 SZLIB          = szlib
-SZLIB_OPTFLAGS = -O3
-SZLIB_CFLAGS   = -I$(TOPDIR)/utils/szlib -DELG_COMPRESSED -DCUBE_COMPRESSED
+SZLIB_CFLAGS   = -I$(TOPDIR)/utils/szlib -DELG_COMPRESSED -DCUBE_COMPRESSED $(CFLAGS)
 SZLIB_LIBPATH  = -L$(TOPDIR)/utils/szlib
 SZLIB_LIB      = -lsc.z
 
--- a/mf/Makefile.defs.linux-gomp10
+++ b/mf/Makefile.defs.linux-gomp10
@@ -23,24 +23,19 @@
 #------------------------------------------------------------------------------
 # SIONlib General Settings
 #------------------------------------------------------------------------------
-OPTFLAGS = -g -O0 -Wall
+CFLAGS   += -std=c99 $(PFLAG) -fPIC
 
-CC       = gcc
-CFLAGS   = -std=c99 $(PFLAG) $(OPTFLAGS) -fPIC
+CXXFLAGS += $(PFLAG) -fPIC
 
-CXX      = g++
-CXXFLAGS = $(PFLAG) $(OPTFLAGS) -O3
-
-F77      = gfortran
-FFLAGS   = $(PFLAG) $(OPTFLAGS) -fallow-argument-mismatch
+FFLAGS   += $(PFLAG) -fallow-argument-mismatch -fPIC
 
 F90      = $(F77)
-F90FLAGS = $(PFLAG) $(OPTFLAGS) -ffree-form -fallow-argument-mismatch
+F90FLAGS += $(PFLAG) -ffree-form -fallow-argument-mismatch -fPIC $(FCFLAGS)
 
 FPP      =
 FDOPT    = -D
 
-LDFLAGS  = $(PFLAG) $(OPTFLAGS) $(HINTSLIB)
+LDFLAGS  += $(PFLAG) $(HINTSLIB)
 UTILLIB  =
 FOBASE   = pomp_fwrapper_base.o
 
@@ -101,10 +96,6 @@
 #------------------------------------------------------------------------------
 
 MPIENABLE = 1
-MPICC     = mpicc
-MPICXX    = mpicxx
-MPIF77    = mpif77
-MPIF90    = mpif90
 MPILIB    = -lmpich
 PMPILIB   = -lpmpich
 #PMPILIB   = # MPICH2
@@ -139,7 +130,7 @@
 #------------------------------------------------------------------------------
 
 SZLIB          = szlib
-SZLIB_OPTFLAGS = -O3
+SZLIB_OPTFLAGS = $(CFLAGS)
 SZLIB_CFLAGS   = -I$(TOPDIR)/utils/szlib -DELG_COMPRESSED -DCUBE_COMPRESSED
 SZLIB_LIBPATH  = -L$(TOPDIR)/utils/szlib
 SZLIB_LIB      = -lsc.z
--- a/src/fortraninterface/Makefile
+++ b/src/fortraninterface/Makefile
@@ -121,21 +121,21 @@
 	$(CPP) $(F90FLAGS) $(F90FLAGS_CPP) $(F90MPIFLAGS) -P -E -I ../lib sion_f90_mpi.F90 > sion_f90_mpi.f90
 sion_f90_mpi.mod : sion_f90_mpi.o
 sion_f90_mpi.o : sion_f90_mpi.f90 sion_f90.mod $(SION_HDRS)
-	$(MPIF90) $(F90FLAGS) -c sion_f90_mpi.f90
+	$(MPIF90) $(F90FLAGS) $(F90MPIFLAGS) -c sion_f90_mpi.f90
 
 # F90 Interface (OMP)
 sion_f90_omp.f90: sion_f90_omp.F90
 	$(CPP) $(F90OMPFLAGS) $(F90FLAGS) $(F90FLAGS_CPP) -P -E -I ../lib sion_f90_omp.F90 > sion_f90_omp.f90
 sion_f90_omp.mod : sion_f90_omp.o 
 sion_f90_omp.o : sion_f90_omp.f90 sion_f90.mod $(SION_HDRS)
-	$(OMPF90) $(F90FLAGS) -c sion_f90_omp.f90
+	$(OMPF90) $(F90FLAGS) $(F90OMPFLAGS) -c sion_f90_omp.f90
 
 # F90 Interface (OMPI)
 sion_f90_ompi.f90: sion_f90_ompi.F90 $(SION_HDRS)
 	$(CPP) $(F90MPIFLAGS) $(F90OMPFLAGS) $(F90FLAGS) $(F90FLAGS_CPP) -P -E -I ../lib sion_f90_ompi.F90 > sion_f90_ompi.f90
 sion_f90_ompi.mod : sion_f90_ompi.o
 sion_f90_ompi.o : sion_f90_ompi.f90 $(SION_HDRS)
-	$(MPIF90) $(F90FLAGS) -c sion_f90_ompi.f90
+	$(MPIF90) $(F90FLAGS) $(F90MPIFLAGS) -c sion_f90_ompi.f90