forked from nicojourdain/BUILD_CONFIG_NEMO
-
Notifications
You must be signed in to change notification settings - Fork 2
/
compile.sh
executable file
·56 lines (43 loc) · 1.6 KB
/
compile.sh
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
#!/bin/bash
##==============================================================================
## N. Jourdain, IGE-CNRS, Feb. 2017
##
## purpose : used to compile specified fortran routines
##
##==============================================================================
##==============================================================================
## User's setting :
#module list
#module unload netcdf
#module load netcdf/4.1.1-intel
# Fortran compiler :
FC='ftn'
# Netcdf libraries :
export NC_INC="-I /opt/cray/netcdf-hdf5parallel/4.4.1.1/INTEL/15.0/include" ## empty on adapp with modules 1) hdf5/seq/1.8.9(default); 2) netcdf/seq/4.1.3(default); 3) intel/2013.1
export NC_LIB="-L /opt/cray/netcdf-hdf5parallel/4.4.1.1/INTEL/15.0/lib -lnetcdf -lnetcdff" ## empty on adapp with modules 1) hdf5/seq/1.8.9(default); 2) netcdf/seq/4.1.3(default); 3) intel/2013.1
#export NC_INC="-I`nc-config --includedir`"
#export NC_LIB="`nc-config --libs` -lnetcdff"
export GSW_DIR="./GSW-Fortran"
##==============================================================================
echo "NC_INC=${NC_INC}"
echo "NC_LIB=${NC_LIB}"
if [ ! -n "$1" ]
then
echo "Usage: `basename $0` file1.f90 file2.f90 etc"
exit
fi
for file in $1
do
filobj=`basename $file | sed -e "s/\.f90/\.o/g"`
namexe=`basename $file | sed -e "s/\.f90//g"`
rm -f $namexe $filobj
$FC -c $NC_INC -I${GSW_DIR}/modules $file
$FC -o $namexe ${GSW_DIR}/modules/*.o ${GSW_DIR}/toolbox/*.o $filobj $NC_LIB
if [ -f $namexe ]; then
rm -f $filobj
echo "$namexe [oK]"
else
echo "~!@#%^&* ERROR : $namexe HAS NOT BEEN CREATED >>>>>>>> stop !!"
exit
fi
done