-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_g2c.sh
executable file
·81 lines (73 loc) · 1.92 KB
/
build_g2c.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
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
#!/bin/bash
: ${THISDIR:=$(dirname $(readlink -f -n ${BASH_SOURCE[0]}))}
CDIR=$PWD; cd $THISDIR
source ./Conf/Analyse_args.sh
source ./Conf/Collect_info.sh
source ./Conf/Gen_cfunction.sh
source ./Conf/Reset_version.sh
if [[ ${sys} == "intel_general" ]]; then
sys6=${sys:6}
source ./Conf/G2c_${sys:0:5}_${sys6^}.sh
rinst=false
elif [[ ${sys} == "gnu_general" ]]; then
sys4=${sys:4}
source ./Conf/G2c_${sys:0:3}_${sys4^}.sh
rinst=false
else
source ./Conf/G2c_intel_${sys^}.sh
fi
$CC --version &> /dev/null || {
echo "??? G2C: compilers not set." >&2
exit 1
}
[[ -z ${G2C_VER+x} || -z ${G2C_LIB4+x} ]] && {
[[ -z ${libver+x} || -z ${libver} ]] && {
echo "??? G2C: \"libver\" not set." >&2
exit
}
G2C_LIB4=lib${libver}_4.a
G2C_VER=v${libver##*_v}
}
set -x
g2cLib4=$(basename $G2C_LIB4)
#################
cd src
#################
#-------------------------------------------------------------------
# Start building libraries
#
echo
echo " ... build (i4/r4) g2c library ..."
echo
make clean LIB=$g2cLib4
collect_info g2c 4 OneLine4 LibInfo4
g2cInfo4=g2c_info_and_log4.txt
$debg && make debug LIB=$g2cLib4 &> $g2cInfo4 \
|| make build LIB=$g2cLib4 &> $g2cInfo4
make message MSGSRC="$(gen_cfunction $g2cInfo4 OneLine4 LibInfo4)" LIB=$g2cLib4
$inst && {
#
# Install libraries and source files
#
$local && {
instloc=..
LIB_DIR=$instloc/lib
[ -d $LIB_DIR ] || { mkdir -p $LIB_DIR; }
LIB_DIR4=$LIB_DIR
SRC_DIR=
} || {
$rinst && {
LIB_DIR4=$(dirname ${G2C_LIB4})
SRC_DIR=$G2C_SRC
} || {
LIB_DIR=$instloc/lib
LIB_DIR4=$LIB_DIR
SRC_DIR=$instloc/src
[[ $instloc == .. ]] && SRC_DIR=
}
[ -d $LIB_DIR4 ] || mkdir -p $LIB_DIR4
[ -z $SRC_DIR ] || { [ -d $SRC_DIR ] || mkdir -p $SRC_DIR; }
}
make clean LIB=
make install LIB=$g2cLib4 LIB_DIR=$LIB_DIR4 SRC_DIR=$SRC_DIR
}