Skip to content
Snippets Groups Projects
Allwmake 2.7 KiB
Newer Older
  • Learn to ignore specific revisions
  • Henry's avatar
    Henry committed
    #!/bin/sh
    
    # Run from OPENFOAM top-level directory only
    cd ${0%/*} && wmakeCheckPwd "$WM_PROJECT_DIR" 2>/dev/null || {
        echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR"
        echo "    Check your OpenFOAM environment and installation"
    
    Henry's avatar
    Henry committed
        exit 1
    }
    
    [ -d "$WM_PROJECT_DIR" -a -f "$WM_PROJECT_DIR/etc/bashrc" ] || {
        echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
    
        echo "    Check your OpenFOAM environment and installation"
    
    Henry's avatar
    Henry committed
        exit 1
    }
    
    
    . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
    
    #------------------------------------------------------------------------------
    
    # Preamble. Report compiler version
    
    case "$WM_COMPILER" in
        Gcc*)    gcc --version 2>/dev/null | sed -ne '1p' ;;
        Clang*)  clang --version 2>/dev/null | sed -ne '1p' ;;
    esac
    
    # Preamble. Report mpirun location
    command -v mpirun 2>/dev/null || true
    
    echo "========================================"
    date "+%Y-%m-%d %H:%M:%S %z" 2>/dev/null || echo "date is unknown"
    echo "Starting compile ${WM_PROJECT_DIR##*/} ${0##*}"
    
    echo "  $WM_COMPILER $WM_COMPILER_TYPE compiler"
    echo "  ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
    
    echo "========================================"
    
    # Compile tools for wmake
    
    "${WM_DIR:-wmake}"/src/Allmake
    
    Henry's avatar
    Henry committed
    
    
    # Compile ThirdParty libraries and applications
    
    Henry's avatar
    Henry committed
    if [ -d "$WM_THIRD_PARTY_DIR" ]
    then
        $WM_THIRD_PARTY_DIR/Allwmake
    else
    
        echo "No ThirdParty directory found - skipping"
    
    echo "========================================"
    echo "Compile OpenFOAM libraries"
    echo
    
    echo "========================================"
    echo "Compile OpenFOAM applications"
    echo
    
    applications/Allwmake $targetType $*
    
    
    # Additional components/modules
    if [ -d "$WM_PROJECT_DIR/modules" ]
    then
    
        echo "========================================"
        echo "Compile OpenFOAM modules"
        echo
        (cd $WM_PROJECT_DIR/modules 2>/dev/null && wmake -all)
    
    # Count files in given directory. Ignore "Test-*" binaries.
    _foamCountDirEntries()
    {
        (cd "$1" 2>/dev/null && find -mindepth 1 -maxdepth 1 -type f 2>/dev/null) |\
            sed -e '\@/Test-@d' | wc -l
    }
    
    
    # Some summary information
    echo
    
    date "+%Y-%m-%d %H:%M:%S %z" 2>/dev/null || echo "date is unknown"
    
    echo "========================================"
    echo "  ${WM_PROJECT_DIR##*/}"
    echo "  $WM_COMPILER $WM_COMPILER_TYPE compiler"
    echo "  ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
    echo
    
    echo "  api   = $(wmakeBuildInfo -show-api 2>/dev/null)"
    echo "  patch = $(wmakeBuildInfo -show-patch 2>/dev/null)"
    echo "  bin   = $(_foamCountDirEntries $FOAM_APPBIN) entries"
    echo "  lib   = $(_foamCountDirEntries $FOAM_LIBBIN) entries"
    echo
    echo "========================================"
    
    
    #------------------------------------------------------------------------------