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
/
configure
executable file
·70 lines (60 loc) · 1.61 KB
/
configure
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
#!/usr/bin/env bash
# Script to generate Mk_cmd for socrates
# Optimisation flags options (uncomment as required)
optim="-Ofast -march=native"
# optim="-O3"
# optim=""
# Remove old files
rm -rf "bin/"
rm -f "set_rad_env"
rm -f "sbin/Cgen_null"
rm -f "sbin/Cinc_field"
rm -f "sbin/Cscale_field"
# Prepare Mk_cmd file
genpath="make/Mk_cmd"
rm -f $genpath
# header
echo "# Generated automatically" >> $genpath
echo "# System: $(uname -a) " >> $genpath
echo "# Date: $(date) " >> $genpath
echo " " >> $genpath
# compiler and linker
fc="$(command -v gfortran)"
if [ -z "$fc" ]; then
echo "Cannot find gfortran"
exit 1
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
extra="-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/"
else
extra=""
fi
echo "FORTCOMP = $fc $optim -fPIC $extra -c " >> $genpath
echo "LINK = $fc $optim -fPIC $extra " >> $genpath
ar="$(command -v ar)"
if [ -z "$ar" ]; then
echo "Cannot find ar"
exit 1
fi
echo "LIBLINK = $ar rvu " >> $genpath
# NetCDF paths
nf="$(command -v nf-config)"
if [ -z "$nf" ]; then
echo "Cannot find nf-config"
exit 1
fi
cdfinc="$($nf --includedir) $($nf --fflags)"
echo "INCCDF_PATH = $cdfinc " >> $genpath
cdflib="$($nf --flibs | cut -d " " -f 1 | tail -c +3)"
echo "LIBCDF_PATH = $cdflib " >> $genpath
echo "LIBCDF_NAME = netcdff " >> $genpath
# OpenMP flag
echo "OMPARG = -fopenmp " >> $genpath
# other things
echo " " >> $genpath
echo "LIBSUFFIX = a " >> $genpath
echo " " >> $genpath
echo ".SUFFIXES: \$(SUFFIXES) .f90 " >> $genpath
echo " " >> $genpath
# End
exit 0