From 3e5307111c806fed48859c525866965876a4badb Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@Germany> Date: Mon, 6 Feb 2017 09:13:59 +0100 Subject: [PATCH] STYLE: unify cd, check for the cwd and error message --- Allwmake | 23 +++++++++++------------ applications/Allwmake | 23 +++++++++++------------ doc/Doxygen/Allwmake | 7 +++---- src/Allwmake | 23 +++++++++++------------ 4 files changed, 36 insertions(+), 40 deletions(-) diff --git a/Allwmake b/Allwmake index 12d1ac68913..0f69c87181b 100755 --- a/Allwmake +++ b/Allwmake @@ -1,22 +1,21 @@ #!/bin/sh -cd ${0%/*} || exit 1 # Run from this directory - -# Parse arguments for library compilation -. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments - -wmakeCheckPwd "$WM_PROJECT_DIR" || { - echo "Allwmake error: Current directory is not \$WM_PROJECT_DIR" - echo " The environment variables are inconsistent with the installation." - echo " Check the OpenFOAM entries in your dot-files and source them." +# 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" exit 1 } - [ -n "$FOAM_EXT_LIBBIN" ] || { - echo "Allwmake error: FOAM_EXT_LIBBIN not set" - echo " Check the OpenFOAM entries in your dot-files and source them." + echo "Error (${0##*/}) : FOAM_EXT_LIBBIN not set" + echo " Check your OpenFOAM environment and installation" exit 1 } +# Parse arguments for library compilation +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments + +#------------------------------------------------------------------------------ + # Compile wmake support applications (cd wmake/src && make) diff --git a/applications/Allwmake b/applications/Allwmake index d851254b23a..e78e590f9c7 100755 --- a/applications/Allwmake +++ b/applications/Allwmake @@ -1,22 +1,21 @@ #!/bin/sh -cd ${0%/*} || exit 1 # Run from this directory - -# Parse arguments for library compilation -. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments - -wmakeCheckPwd "$WM_PROJECT_DIR/applications" || { - echo "Allwmake error: Current directory is not \$WM_PROJECT_DIR/applications" - echo " The environment variables are inconsistent with the installation." - echo " Check the OpenFOAM entries in your dot-files and source them." +# Run from OPENFOAM applications/ directory only +cd ${0%/*} && wmakeCheckPwd "$WM_PROJECT_DIR/applications" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR/applications" + echo " Check your OpenFOAM environment and installation" exit 1 } - [ -n "$FOAM_EXT_LIBBIN" ] || { - echo "Allwmake error: FOAM_EXT_LIBBIN not set" - echo " Check the OpenFOAM entries in your dot-files and source them." + echo "Error (${0##*/}) : FOAM_EXT_LIBBIN not set" + echo " Check your OpenFOAM environment and installation" exit 1 } +# Parse arguments for library compilation +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments + +#------------------------------------------------------------------------------ + wmake -all $targetType solvers wmake -all $targetType utilities diff --git a/doc/Doxygen/Allwmake b/doc/Doxygen/Allwmake index 8ca2ed256d3..a2c98fdf149 100755 --- a/doc/Doxygen/Allwmake +++ b/doc/Doxygen/Allwmake @@ -1,10 +1,9 @@ #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory - [ -d "$WM_PROJECT_DIR" ] || { - echo " Error: WM_PROJECT_DIR directory does not exist" - echo " Check the OpenFOAM entries in your dot-files and source them." - echo " WM_PROJECT_DIR=$WM_PROJECT_DIR" + echo "Error (${0##*/}) : no \$WM_PROJECT_DIR found" + echo " Check your OpenFOAM environment and installation" + echo " WM_PROJECT_DIR=$WM_PROJECT_DIR" exit 1 } diff --git a/src/Allwmake b/src/Allwmake index 000688c332a..9d13d973f8a 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -1,22 +1,21 @@ #!/bin/sh -cd ${0%/*} || exit 1 # Run from this directory - -# Parse arguments for library compilation -. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments - -wmakeCheckPwd "$WM_PROJECT_DIR/src" || { - echo "Allwmake error: Current directory is not \$WM_PROJECT_DIR/src" - echo " The environment variables are inconsistent with the installation." - echo " Check the OpenFOAM entries in your dot-files and source them." +# Run from OPENFOAM src/ directory only +cd ${0%/*} && wmakeCheckPwd "$WM_PROJECT_DIR/src" 2>/dev/null || { + echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR/src" + echo " Check your OpenFOAM environment and installation" exit 1 } - [ -n "$FOAM_EXT_LIBBIN" ] || { - echo "Allwmake error: FOAM_EXT_LIBBIN not set" - echo " Check the OpenFOAM entries in your dot-files and source them." + echo "Error (${0##*/}) : FOAM_EXT_LIBBIN not set" + echo " Check your OpenFOAM environment and installation" exit 1 } +# Parse arguments for library compilation +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments + +#------------------------------------------------------------------------------ + # Update OpenFOAM version strings if required wmakePrintBuild -check || wrmo OpenFOAM/global/global.o 2>/dev/null -- GitLab