This repository has been archived by the owner on Sep 2, 2024. It is now read-only.
forked from nichollsh/SOCRATES
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_code
executable file
·124 lines (110 loc) · 3.05 KB
/
build_code
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
#!/usr/bin/env bash
# Script to set-up and make the radiation code
here=`pwd`
host=`uname -n`
if [ ${host:0:4} == "dali" ]; then
host="dali"
elif [ "${host:7:4}" == "arc4" ]; then
host="arc4"
fi
SRC_LIST="general modules_gen aux scatter correlated_k"
SRC_LIST=${SRC_LIST}" modules_core radiance_core"
SRC_LIST=${SRC_LIST}" illumination interface_core"
SRC_LIST=${SRC_LIST}" nlte"
SRC_LIST=${SRC_LIST}" cosp_control"
SRC_LIST=${SRC_LIST}" cosp_github/src"
SRC_LIST=${SRC_LIST}" cosp_github/src/simulator"
SRC_LIST=${SRC_LIST}" cosp_github/src/simulator/MISR_simulator"
SRC_LIST=${SRC_LIST}" cosp_github/src/simulator/MODIS_simulator"
SRC_LIST=${SRC_LIST}" cosp_github/src/simulator/actsim"
SRC_LIST=${SRC_LIST}" cosp_github/src/simulator/icarus"
SRC_LIST=${SRC_LIST}" cosp_github/src/simulator/parasol"
SRC_LIST=${SRC_LIST}" cosp_github/src/simulator/quickbeam"
SRC_LIST=${SRC_LIST}" cosp_github/src/simulator/rttov"
SRC_LIST=${SRC_LIST}" cosp_github/model-interface"
SRC_LIST=${SRC_LIST}" cosp_github/subsample_and_optics_example/optics"
SRC_LIST=${SRC_LIST}" cosp_github/subsample_and_optics_example/optics/quickbeam_optics"
SRC_LIST=${SRC_LIST}" cosp_github/subsample_and_optics_example/subcol"
SRC_LIST=${SRC_LIST}" cosp_github/subsample_and_optics_example/subcol/rng"
SRC_LIST=${SRC_LIST}" cosp_github/driver/src/"
echo 'Building the radiation code in bin/ and utilities in sbin/'
date
# Build the C utilities in sbin
cd sbin
make
cd $here
# Create the bin directory and copy across files
mkdir -p bin
cd make
for FILE in *
do
if [ $FILE -nt $here/bin/$FILE ]
then
cp $FILE $here/bin/$FILE
fi
done
cd $here
for SRCDIR in $SRC_LIST
do
cd src/$SRCDIR
FILE_LIST=`ls *.f* 2> /dev/null`
for FILE in $FILE_LIST
do
if [ $FILE -nt $here/bin/$FILE ]
then
cp $FILE $here/bin/$FILE
fi
done
FILE_LIST=`ls *.F90 2> /dev/null`
for FILE in $FILE_LIST
do
ppfile=$here/bin/${FILE%F90}f90
if [ $FILE -nt $ppfile ]
then
cp $FILE $ppfile
fi
done
cd $here
done
# Build the source code in bin
cd bin
./mkdep
case "$1" in
"gfortran" | "ifort" | \
"lfric_gfortran6" | "lfric_ifort17" | \
"lfric_gfortran11" | "lfric_ifort19")
cp set_prog_env_$1 set_prog_env
diff -q Mk_cmd_$1 Mk_cmd || (cp Mk_cmd_$1 Mk_cmd; make clean)
shift
;;
*)
if [ -r set_prog_env_$host ]
then
cp set_prog_env_$host set_prog_env
fi
if [ -r Mk_cmd_$host ]
then
cp Mk_cmd_$host Mk_cmd
fi
if [ ! -r set_prog_env ]
then
grep "LIBCDF_PATH" Mk_cmd | \
sed 's/ *LIBCDF_PATH *= */LIBCDF_PATH=/' > set_prog_env
echo 'export LD_LIBRARY_PATH=$LIBCDF_PATH:$LD_LIBRARY_PATH' \
>> set_prog_env
fi
;;
esac
if [ -r /usr/share/Modules/init/bash ]
then
. /usr/share/Modules/init/bash
fi
. ./set_prog_env
make $1 -j 6 && echo "All compiled OK"
cd $here
echo "Setting path to distribution in set_rad_env"
sed "s#???#${here}#" sbin/set_rad_env_tmp > set_rad_env
cat bin/set_prog_env >> set_rad_env
echo "export LD_LIBRARY_PATH='' " >> set_rad_env
date
exit 0