-
Notifications
You must be signed in to change notification settings - Fork 19
/
Allwmake
executable file
·40 lines (35 loc) · 1.21 KB
/
Allwmake
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
#!/bin/bash
cd "${0%/*}" || exit # Run from this directory
# Stop at first error
set -e
# Check if OpenFOAM/FOAM has been sourced
if [[ -z "${WM_PROJECT}" ]]
then
echo "Please source the OpenFOAM/FOAM bashrc first!"
exit 1
else
allowed_ver=("10")
if ! [[ " ${allowed_ver[*]} " == *" $WM_PROJECT_VERSION "* ]]; then
echo "Unsupported OpenFOAM version sourced!"
fi
fi
# Compile applications
(cd applications && ./Allwmake $* 2>&1 | tee log.Allwmake)
# Check if the build succeeded
echo "Checking if the installation was a success:"
N_ERRORS_1=$(find . -name log.Allwmake | xargs grep "\ Error\ " | wc -l)
N_ERRORS_2=$(find . -name log.Allwmake | xargs grep "\ Stop." | wc -l)
if [[ $N_ERRORS_1 -gt 0 ]] || [[ $N_ERRORS_2 -gt 0 ]]
then
echo "** BUILD ERROR **"
echo "There were build errors in the following logs:"
echo $(find . -name log.Allwmake | xargs grep -l "\ Error\ ")
echo $(find . -name log.Allwmake | xargs grep -l "\ Stop.")
echo; echo "Please examine these logs for additional details"; echo
exit 1
else
echo
echo "There were no build errors: enjoy laserbeamFoam!"; echo
fi
echo
#------------------------------------------------------------------------------