-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcompile_c_libs.sh
More file actions
executable file
·78 lines (60 loc) · 1.52 KB
/
compile_c_libs.sh
File metadata and controls
executable file
·78 lines (60 loc) · 1.52 KB
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
#!/bin/bash
set -ex
#set -o posix
#yaml includes
YAML_FLAGS+=""
#yaml libraries
YAML_LDFLAGS+=""
#fortran netcdf includes
NF_FLAGS+=$(nf-config --fflags)
#c netcdf includes
NC_FLAGS+=$(nc-config --cflags)
#netcdf libraries
NC_LDFLAGS=$(nc-config --libs | nf-config --flibs)
#fortran and c compiler
FC=mpif90
CC=mpicc
#fms fortran, c, library compiler flags
FMS_FCFLAGS+="$NF_FLAGS -fPIC"
FMS_CFLAGS+="$NC_FLAGS $YAML_FLAGS -fPIC"
FMS_LDFLAGS+="$NC_LDFLAGS $YAML_LDFLAGS"
#cfms fortran, c, library compiler flags
#cfms does not need the netcdf flags.
#these will be removed once cfms configure.ac is updated
cFMS_FCFLAGS+="-fPIC $NF_FLAGS"
cFMS_CFLAGS+="-fPIC $NC_FLAGS"
cFMS_LDFLAGS+=""
curr_dir=$PWD
#fms installation path
fms_install=$curr_dir/pyfms/lib/FMS
#cfms installation path
cfms_install=$curr_dir/pyfms/lib/cFMS
#cfms to compile
cfms_dir=$curr_dir/cFMS
#fms to compile
fms_dir=$cfms_dir/FMS
#compile fms with autotools
cd $fms_dir
autoreconf -iv
./configure --enable-portable-kinds \
--with-yaml \
--prefix=$fms_install \
FC=$FC \
CC=$CC \
FCFLAGS="$FMS_FCFLAGS" \
CFLAGS="$FMS_CFLAGS" \
LDFLAGS="$FMS_LDFLAGS"
make install
cd $currdir
#compile cFMS with autotools
cd $cfms_dir
autoreconf -iv
./configure --with-fms=$fms_install \
--prefix=$cfms_install \
FC=$FC \
CC=$CC \
FCFLAGS="$cFMS_FCFLAGS" \
CFLAGS="$cFMS_CFLAGS" \
LDFLAGS="$cFMS_LDFLAGS"
make install
cd $currdir