diff --git a/etc/codeTemplates/source/foamNewSource b/etc/codeTemplates/source/foamNewSource index 6469aa3b32..0e36c4adb4 100755 --- a/etc/codeTemplates/source/foamNewSource +++ b/etc/codeTemplates/source/foamNewSource @@ -91,7 +91,7 @@ shift 2 if [ "${printOpt:-false}" = true ] then - cat $Template$subType$Type + cat "$Template$subType$Type" else fileName="$className$Type" @@ -106,11 +106,11 @@ else # process class name sed -e "s/CLASSNAME/$className/g" \ -e "s/YEAR/$(date +%Y)/g" \ - $Template$subType$Type > $fileName + "$Template$subType$Type" > "$fileName" if [ "$subType" = App -a ! -d Make ] then - wmakeFilesAndOptions + "${WM_DIR:-$WM_PROJECT_DIR/wmake}/wmakeFilesAndOptions" fi fi diff --git a/wmake/scripts/makeFiles b/wmake/scripts/makeFiles index 07806c9238..f04cf84f14 100755 --- a/wmake/scripts/makeFiles +++ b/wmake/scripts/makeFiles @@ -31,7 +31,7 @@ # Usage : makeFiles # #------------------------------------------------------------------------------ -dirToString="$WM_DIR/platforms/$WM_ARCH$WM_COMPILER"/dirToString +dirToString="${WM_DIR:-$WM_PROJECT_DIR/wmake}/platforms/$WM_ARCH$WM_COMPILER/dirToString" if [ -r Make/files ] then @@ -46,8 +46,10 @@ fi [ -d Make ] || mkdir Make rm -f Make/files + #------------------------------------------------------------------------------ -echo "Creating Make/files" + +echo "Creating Make/files ..." for dir in $(find . -mindepth 1 -type d -print) do @@ -68,7 +70,7 @@ do if [ -n "$pathName" ] then - echo '$('$pathName')/'"${file##*/}" + echo '$('"$pathName"')/'"${file##*/}" else echo "${file##*/}" fi diff --git a/wmake/scripts/makeOptions b/wmake/scripts/makeOptions index db1585485d..452c4d97c7 100755 --- a/wmake/scripts/makeOptions +++ b/wmake/scripts/makeOptions @@ -40,7 +40,9 @@ fi [ -d Make ] || mkdir Make rm -f Make/options + #------------------------------------------------------------------------------ + echo "Creating Make/options" echo 'EXE_INC = \ diff --git a/wmake/wmakeRoot b/wmake/wmakeRoot new file mode 100755 index 0000000000..4789c4bf96 --- /dev/null +++ b/wmake/wmakeRoot @@ -0,0 +1,113 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. +# \\/ M anipulation | +#------------------------------------------------------------------------------- +# License +# This file is part of OpenFOAM. +# +# OpenFOAM is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenFOAM. If not, see . +# +# Script +# wmakeRoot +# +# Description +# Locate the root directory that has a Make/ directory. +# +# See Also +# wmake +# +#------------------------------------------------------------------------------ +Script="${0##*/}" # Use 'Script' for error messages in wmakeFunctions +. "${0%/*}/scripts/wmakeFunctions" # Source wmake functions + +usage() { + exec 1>&2 + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat<&2 + exit 1 + fi + + cd "$dir" 2>/dev/null || { + echo "$Script error: could not change to directory '$dir'" 1>&2 + exit 1 + } +fi + + +# Locate target with Make/ directory + +if dir="$(findTarget .)" +then + (cd "$dir" && pwd -L) +else + exit 2 +fi + + +#------------------------------------------------------------------------------