Allwmake 3.34 KB
Newer Older
1
#!/bin/sh
2
# Run from OPENFOAM top-level directory only
3
cd "${0%/*}" || exit
4
wmake -check-dir "$WM_PROJECT_DIR" 2>/dev/null || {
5 6
    echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR"
    echo "    Check your OpenFOAM environment and installation"
7
    exit 1
8
}
9 10 11 12
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments ]
then  . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments || \
    echo "Argument parse error";
else
13
    echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
14
    echo "    Check your OpenFOAM environment and installation"
15
    exit 1
16
fi
17 18

#------------------------------------------------------------------------------
19 20
# Preamble. Report tools or at least the mpirun location
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/list_tools ]
21
then  . "$WM_PROJECT_DIR"/wmake/scripts/list_tools
22 23 24
else
    echo "mpirun=$(command -v mpirun || true)"
fi
25 26 27 28 29 30 31 32 33 34
echo
# Report compiler information
compiler="$(wmake -show-path-cxx 2>/dev/null || true)"
if [ -x "$compiler" ]
then
    echo "compiler=$compiler"
    "$compiler" --version 2>/dev/null | sed -ne '1p'
else
    echo "compiler=unknown"
fi
35 36

echo
37 38
echo "========================================"
date "+%Y-%m-%d %H:%M:%S %z" 2>/dev/null || echo "date is unknown"
39
echo "Starting compile ${WM_PROJECT_DIR##*/} ${0##*/}"
40
echo "  $WM_COMPILER ${WM_COMPILER_TYPE:-system} compiler"
41
echo "  ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
42
echo "========================================"
43
echo
44

45
# Compile tools for wmake
46
"${WM_DIR:-wmake}"/src/Allmake
47

48
# Compile ThirdParty libraries and applications
49
if [ -d "$WM_THIRD_PARTY_DIR" ]
50
then
51 52 53 54 55 56 57 58 59 60
    if [ -e "$WM_THIRD_PARTY_DIR"/Allwmake.override ]
    then
        if [ -x "$WM_THIRD_PARTY_DIR"/Allwmake.override ]
        then    "$WM_THIRD_PARTY_DIR"/Allwmake.override
        fi
    elif [ -x "$WM_THIRD_PARTY_DIR"/Allwmake ]
    then      "$WM_THIRD_PARTY_DIR"/Allwmake
    else
        echo "Skip ThirdParty (no Allwmake* files)"
    fi
61
else
62
    echo "Skip ThirdParty (no directory)"
63
fi
64

65 66 67
echo "========================================"
echo "Compile OpenFOAM libraries"
echo
68 69
src/Allwmake $targetType $*

70 71 72
echo "========================================"
echo "Compile OpenFOAM applications"
echo
73 74
applications/Allwmake $targetType $*

75
# Additional components/modules
76 77 78 79 80 81
if [ "$FOAM_MODULE_PREFIX" = false ]
then
    echo "========================================"
    echo "OpenFOAM modules disabled (prefix=false)"
    echo
elif [ -d "$WM_PROJECT_DIR/modules" ]
82
then
83
    (cd "$WM_PROJECT_DIR/modules" 2>/dev/null && wmake -all)
84 85
fi

86 87 88
# Count files in given directory. Ignore "Test-*" binaries.
_foamCountDirEntries()
{
89
    (cd "$1" 2>/dev/null && find . -mindepth 1 -maxdepth 1 -type f 2>/dev/null) |\
90 91 92
        sed -e '\@/Test-@d' | wc -l
}

93 94
# Some summary information
echo
95
date "+%Y-%m-%d %H:%M:%S %z" 2>/dev/null || echo "date is unknown"
96 97
echo "========================================"
echo "  ${WM_PROJECT_DIR##*/}"
98
echo "  $WM_COMPILER ${WM_COMPILER_TYPE:-system} compiler"
99 100
echo "  ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
echo
101 102
echo "  api   = $(etc/openfoam -show-api 2>/dev/null)"
echo "  patch = $(etc/openfoam -show-patch 2>/dev/null)"
103 104
echo "  bin   = $(_foamCountDirEntries "$FOAM_APPBIN") entries"
echo "  lib   = $(_foamCountDirEntries "$FOAM_LIBBIN") entries"
105 106 107
echo
echo "========================================"

108
#------------------------------------------------------------------------------