-
Notifications
You must be signed in to change notification settings - Fork 1
/
code_build
executable file
·80 lines (80 loc) · 1.76 KB
/
code_build
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
#!/bin/bash
unalias -a
echo
echo " code_build (Version December 29 2023) (C) Copyright 2023 Arjan Koning All Rights Reserved"
echo
if [ $# -ne 1 ] ; then
echo 'Error: Code name required, for example '
echo 'code_build talys'
exit
fi
code=$1
#
# Script for fortran code installation on Linux and MacOS.
# Adapt the following compilation variables.
#
FC='gfortran'
FFLAGS='-w'
#
# Basic installation (verified with the sample cases)
#
# FC="gfortran " FFLAGS=" "
#
# Distribution FC & FFLAGS (options provided by J-C Sublet)
#
# FC="gfortran " FFLAGS=" -Ofast "
# FC="ifort " FFLAGS=" -Ofast "
# FC="nagfor " FFLAGS=" -w "
#
# Development FC & FFLAGS (options provided by J-C Sublet)
#
# FC="gfortran " FFLAGS=" -Wall -fcheck=all -Og -g -fbacktrace "
# FC="ifort " FFLAGS=" -O0 -g -traceback -check all -debug all"
# FC="nagfor " FFLAGS=" -C=all -O0 -g -gline "
#
#
# Set directories
#
cwd=`pwd`'/'
sourcedir=${cwd}'source/'
bindir=${cwd}'bin'
cd $sourcedir
if [ $code != endftables ] && [ $code != sacs ] ; then
../path_change
fi
#
# Clean up previous .o and .mod files and compile code.
#
echo "Compiling ${code}...."
ls *.o > /dev/null 2>&1
if [ $? -eq 0 ] ;then
rm *.o
fi
ls *.mod > /dev/null 2>&1
if [ $? -eq 0 ] ;then
rm *.mod
fi
ls *.f > /dev/null 2>&1
if [ $? -eq 0 ] ;then
${FC} ${FFLAGS} -c *.f
fi
ls *.f90 > /dev/null 2>&1
if [ $? -eq 0 ] ;then
${FC} ${FFLAGS} -c *.f90
fi
${FC} ${FFLAGS} *.o -o ${code}
rm -f *.o *.mod
#
# Check whether the build procedure has been successful
#
if [ -e $code ] ; then
mkdir -p ${bindir}
mv -f $code ${bindir}/$code
echo ' '
echo 'The '${code}' build has been completed.'
echo ' '
echo 'The '${code}' executable is in the ' $bindir 'directory.'
echo ' '
else
echo ${code} 'build failed'
fi