diff --git a/wmake/scripts/dirToString b/wmake/scripts/dirToString index 2ed4ba7619..f31f0e3032 100755 --- a/wmake/scripts/dirToString +++ b/wmake/scripts/dirToString @@ -6,7 +6,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2019 OpenCFD Ltd. +# Copyright (C) 2019-2022 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -54,6 +54,9 @@ optStrip=true while [ "$#" -gt 0 ] do case "$1" in + ('') ;; + (- | --) shift; break ;; # Stop option parsing + # Print help (-h | -help*) usage @@ -64,10 +67,6 @@ do (-no-strip) unset optStrip ;; - (--) - shift - break - ;; (*) break ;; diff --git a/wmake/scripts/makeDepend b/wmake/scripts/makeDepend index 711275614d..46fb6258c1 100755 --- a/wmake/scripts/makeDepend +++ b/wmake/scripts/makeDepend @@ -6,13 +6,13 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2018 OpenCFD Ltd. +# Copyright (C) 2018-2022 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # # Script -# makeDepend +# wmake/scripts/makeDepend # # Description # Wrapping for cpp -M with argument/options compatible with diff --git a/wmake/scripts/makeParser b/wmake/scripts/makeParser index ee59ded895..d65f094cf7 100755 --- a/wmake/scripts/makeParser +++ b/wmake/scripts/makeParser @@ -6,7 +6,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------- -# Copyright (C) 2019 OpenCFD Ltd. +# Copyright (C) 2019-2022 OpenCFD Ltd. #------------------------------------------------------------------------------- # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -51,6 +51,9 @@ unset optRemoveFile optRemoveTmp optNoLines while [ "$#" -gt 0 ] do case "$1" in + ('') ;; + (- | --) shift; break ;; # Stop option parsing + (-h | -help*) printHelp ;; (-prefix=*) prefix="${1#*=}" ;; diff --git a/wmake/scripts/makeTargetDir b/wmake/scripts/makeTargetDir index 18ecb22d2f..5e295af6f3 100755 --- a/wmake/scripts/makeTargetDir +++ b/wmake/scripts/makeTargetDir @@ -12,19 +12,19 @@ # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # # Script -# makeTargetDir +# wmake/scripts/makeTargetDir # # Description -# Makes a directory hierarchy for the given target file +# Makes a directory hierarchy for the given target file(s) # -# Usage: makeTargetDir +# Usage: makeTargetDir file1 [..fileN] # #------------------------------------------------------------------------------ for target do - dir=${target%/*} - [ -d "$dir" ] || [ "$dir" = "$target" ] || mkdir -p "$dir" + dir="${target%/*}" + [ "$dir" = "$target" ] || [ -d "$dir" ] || mkdir -p "$dir" done #------------------------------------------------------------------------------ diff --git a/wmake/scripts/wmake-build-info b/wmake/scripts/wmake-build-info index 8ec98bd8f0..a3003006d0 100755 --- a/wmake/scripts/wmake-build-info +++ b/wmake/scripts/wmake-build-info @@ -6,7 +6,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2018-2021 OpenCFD Ltd. +# Copyright (C) 2018-2022 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -101,6 +101,9 @@ unset optCheck optDryRun optUpdate optQuery optFilter while [ "$#" -gt 0 ] do case "$1" in + ('') ;; + (- | --) shift; break ;; # Stop option parsing + -h | -help*) printHelp ;; diff --git a/wmake/scripts/wmake-check-dir b/wmake/scripts/wmake-check-dir index be333717c7..28c7dc96c8 100755 --- a/wmake/scripts/wmake-check-dir +++ b/wmake/scripts/wmake-check-dir @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------- # Copyright (C) 2011-2015 OpenFOAM Foundation -# Copyright (C) 2020 OpenCFD Ltd. +# Copyright (C) 2020-2022 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -69,16 +69,15 @@ die() while [ "$#" -gt 0 ] do case "$1" in + ('') ;; + (- | --) shift; break ;; # Stop option parsing + -h | -help*) printHelp ;; -q | -quiet | -s | -silent) optQuiet=true ;; - --) - shift - break - ;; -*) die "Unknown option: '$1'" "See '${0##*/} -help' for usage" ;; diff --git a/wmake/scripts/wmake-with-bear b/wmake/scripts/wmake-with-bear index addd753e8b..1c01123222 100755 --- a/wmake/scripts/wmake-with-bear +++ b/wmake/scripts/wmake-with-bear @@ -6,7 +6,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------- -# Copyright (C) 2020-2021 OpenCFD Ltd. +# Copyright (C) 2020-2022 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -53,8 +53,8 @@ unset optVersion outputDir while [ "$#" -gt 0 ] do case "$1" in - '') ;; - --) shift; break ;; + ('') ;; + (- | --) shift; break ;; # Stop option parsing -h | -help*) printHelp diff --git a/wmake/wclean b/wmake/wclean index 362bff0e08..67d72fef18 100755 --- a/wmake/wclean +++ b/wmake/wclean @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011-2016 OpenFOAM Foundation -# Copyright (C) 2017-2020 OpenCFD Ltd. +# Copyright (C) 2017-2022 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -101,6 +101,9 @@ MakeDir=Make while [ "$#" -gt 0 ] do case "$1" in + ('') ;; + (- | --) shift; break ;; # Stop option parsing + -help-f*) # Full help printHelp -full ;; diff --git a/wmake/wdep b/wmake/wdep index 6319c8f92e..2f8f315df3 100755 --- a/wmake/wdep +++ b/wmake/wdep @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2014-2015 OpenFOAM Foundation -# Copyright (C) 2017 OpenCFD Ltd. +# Copyright (C) 2017-2022 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -50,6 +50,9 @@ USAGE while [ "$#" -gt 0 ] do case "$1" in + ('') ;; + (- | --) shift; break ;; # Stop option parsing + -h | -help*) usage ;; diff --git a/wmake/wmake b/wmake/wmake index 2898b73da9..d30b040843 100755 --- a/wmake/wmake +++ b/wmake/wmake @@ -223,8 +223,8 @@ fi while [ "$#" -gt 0 ] do case "$1" in - '') ;; - --) shift; break ;; + ('') ;; + (- | --) shift; break ;; # Stop option parsing -help-f*) # Full help printHelp -full @@ -416,6 +416,7 @@ MakeDir=Make unset dir +# With -pwd, go on discovery if [ -n "$opt_pwd" ] then if [ $# -ge 1 ] diff --git a/wmake/wmakeCollect b/wmake/wmakeCollect index 411e209315..73422754a9 100755 --- a/wmake/wmakeCollect +++ b/wmake/wmakeCollect @@ -63,6 +63,9 @@ unset cleanup while [ "$#" -gt 0 ] do case "$1" in + ('') ;; + (- | --) shift; break ;; # Stop option parsing + -h | -help*) usage ;; diff --git a/wmake/wmakeLnInclude b/wmake/wmakeLnInclude index f64a8dffdb..c78f0c4b92 100755 --- a/wmake/wmakeLnInclude +++ b/wmake/wmakeLnInclude @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011-2016 OpenFOAM Foundation -# Copyright (C) 2019-2020 OpenCFD Ltd. +# Copyright (C) 2019-2022 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -22,8 +22,13 @@ # Link source files in the specified dir(s) into their respective # lnInclude directories # -# C files: .c .h -# C++ files: .C .cc .cpp .cxx .H .hh .hpp .hxx +# Header files (C) : .h +# Source files (C) : .c +# Header files (C++) : .H .hh .hpp .hxx +# Source files (C++) : .C .cc .cpp .cxx +# Template files (C++) : .tcc .tpp .txx +# +# GNU make suffixes : .c .cc .C .cpp # #------------------------------------------------------------------------------ Script="${0##*/}" # Need 'Script' for wmakeFunctions messages @@ -76,6 +81,9 @@ unset optForce optUpdate optPwd while [ "$#" -gt 0 ] do case "$1" in + ('') ;; + (- | --) shift; break ;; # Stop option parsing + -h | -help*) printHelp ;; @@ -103,7 +111,7 @@ do shift done -[ "$optPwd" = true ] || [ "$#" -ge 1 ] || \ +[ -n "$optPwd" ] || [ "$#" -ge 1 ] || \ die "incorrect number of arguments" #------------------------------------------------------------------------------ @@ -111,7 +119,7 @@ done baseDir="$1" # With -pwd, go on discovery -if [ "$optPwd" = true ] +if [ -n "$optPwd" ] then if [ -n "$baseDir" ] then @@ -221,9 +229,9 @@ do -name '*.[CHch]' \ -o -name '*.cc' \ -o -name '*.hh' \ - -o -name '*.[ch]xx' \ - -o -name '*.[ch]pp' \ - -o -name '*.type' \ + -o -name '*.[cht]xx' \ + -o -name '*.[cht]pp' \ + -o -name '*.tcc' \ \) \ -exec ln "$optLink" {} . \; ) diff --git a/wmake/wmakeLnIncludeAll b/wmake/wmakeLnIncludeAll index 310daf243b..c38f3943c0 100755 --- a/wmake/wmakeLnIncludeAll +++ b/wmake/wmakeLnIncludeAll @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011-2016 OpenFOAM Foundation -# Copyright (C) 2018-2020 OpenCFD Ltd. +# Copyright (C) 2018-2022 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -66,19 +66,22 @@ die() # Parallel operation requested nCores=0 -unset optForce optUpdate +unset opt_force opt_update while [ "$#" -gt 0 ] do case "$1" in + ('') ;; + (- | --) shift; break ;; # Stop option parsing + -h | -help*) printHelp ;; -f | -force) - optForce=true + opt_force='-force' ;; -u | -update) - optUpdate=true + opt_update='-update' ;; -s | -silent | -quiet) export WM_QUIET=true @@ -150,7 +153,7 @@ do find "$checkDir" -depth -name Make -type d -print | while read MakeDir do - topDir=${MakeDir%/Make} # trim /Make from the end + topDir="${MakeDir%/Make}" # trim /Make from the end if [ -d "$topDir" ] then if grep -qe '^ *LIB *=' "$MakeDir/files" 2>/dev/null @@ -166,9 +169,9 @@ do wait -n joblist=($(jobs -p)) done - wmakeLnInclude ${optForce:+-force} ${optUpdate:+-update} $topDir & + wmakeLnInclude $opt_force $opt_update -- "$topDir" & else - wmakeLnInclude ${optForce:+-force} ${optUpdate:+-update} $topDir + wmakeLnInclude $opt_force $opt_update -- "$topDir" fi elif [ -d "$topDir/lnInclude" ] then diff --git a/wmake/wrmdep b/wmake/wrmdep index ffd993657c..89b021ce50 100755 --- a/wmake/wrmdep +++ b/wmake/wrmdep @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2015-2016 OpenFOAM Foundation -# Copyright (C) 2017-2019 OpenCFD Ltd. +# Copyright (C) 2017-2022 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -92,6 +92,9 @@ unset platform while [ "$#" -gt 0 ] do case "$1" in + ('') ;; + (- | --) shift; break ;; # Stop option parsing + -h | -help*) usage ;; diff --git a/wmake/wrmo b/wmake/wrmo index 0ce4bf548b..732f5110b8 100755 --- a/wmake/wrmo +++ b/wmake/wrmo @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2015 OpenFOAM Foundation -# Copyright (C) 2017-2019 OpenCFD Ltd. +# Copyright (C) 2017-2022 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -55,6 +55,9 @@ unset platform while [ "$#" -gt 0 ] do case "$1" in + ('') ;; + (- | --) shift; break ;; # Stop option parsing + -h | -help*) usage ;;