-
Notifications
You must be signed in to change notification settings - Fork 0
/
paths.sh
48 lines (37 loc) · 953 Bytes
/
paths.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
source create_paths_for_libraries.sh
generate_paths()
{
local root_path="$1"
local lib_name="$2"
local lib_dependencies="$3"
local compiler="gfortran"
local compiler_options="-c -W -fbackslash"
local sep=$( path_separator "$root_path" )
local lib_path="$root_path"$sep"$lib_name"
local scr="$lib_path"$sep"scr"
local obj="$lib_path"$sep"obj"
local mod="$lib_path"$sep"mod"
local modules_dir="-J"$mod
local lib_archive="lib""$lib_name"".a"
# Cleaning
cd "$obj"
for file in *.o; do
rm "$file"
done
# Compilation
cd "$scr"
"$compiler" "$compiler_options" "$modules_dir" "$lib_dependencies" *.f90
# Moving new object files
for file in *.o; do
mv "$file" "$obj"
done
# Creation of the archive
cd $obj
for file in *.o; do
ar cr "$lib_archive" "$file"
done
# Cleaning
mv "$lib_archive" "$lib_path"
cd "$root_path"
echo "$lib_name"" is compiled"
}