CONFIG: adjustments to environment

- provide default WM_DIR if not already set, to improve robustness if a
  reduced environment is used

- add etc/ to WM_PROJECT_SITE search. This makes the site directory
  structure consistent with the OpenFOAM structure.
  Eg,

      WM_PROJECT_SITE/etc/..
      WM_PROJECT_SITE/bin/..
      WM_PROJECT_SITE/platforms/..

- Don't set/export WM_OSTYPE.  The default is POSIX and is properly
  defaulted throughout, including in CMakeLists-OpenFOAM.txt (also for
  Catalyst)
This commit is contained in:
Mark Olesen
2018-12-03 09:50:48 +01:00
parent e917586574
commit b8c257d6ad
19 changed files with 112 additions and 69 deletions

View File

@ -31,7 +31,7 @@ echo "========================================"
echo echo
# Compile tools for wmake # Compile tools for wmake
"${WM_DIR:?}"/src/Allmake "${WM_DIR:-wmake}"/src/Allmake
# Compile ThirdParty libraries and applications # Compile ThirdParty libraries and applications
if [ -d "$WM_THIRD_PARTY_DIR" ] if [ -d "$WM_THIRD_PARTY_DIR" ]

View File

@ -3,7 +3,7 @@ cd ${0%/*} || exit 1 # Run from this directory
# Can never be too certain ... # Can never be too certain ...
# Compile tools for wmake # Compile tools for wmake
( cd "${WM_DIR:?}/src" && make ) ( cd "${WM_DIR:-${WM_PROJECT_DIR}/wmake}/src" && make )
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -18,5 +18,5 @@ LIB_LIBS = \
-lconversion \ -lconversion \
-lgenericPatchFields \ -lgenericPatchFields \
-llagrangian \ -llagrangian \
-L$(FOAM_LIBBIN) -lfoamPv-pv$(PARAVIEW_MAJMIN) \ -L$(FOAM_LIBBIN) -lfoamPv-pv$(PARAVIEW_API) \
$(GLIBS) $(GLIBS)

View File

@ -12,5 +12,5 @@ EXE_INC = \
LIB_LIBS = \ LIB_LIBS = \
-lmeshTools \ -lmeshTools \
-lblockMesh \ -lblockMesh \
-L$(FOAM_LIBBIN) -lfoamPv-pv$(PARAVIEW_MAJMIN) \ -L$(FOAM_LIBBIN) -lfoamPv-pv$(PARAVIEW_API) \
$(GLIBS) $(GLIBS)

View File

@ -310,7 +310,7 @@ case "$optMode" in (*u*) # (U)ser
esac esac
case "$optMode" in (*g*) # (G)roup == site case "$optMode" in (*g*) # (G)roup == site
dirList="$dirList $groupDir/$projectVersion $groupDir" dirList="$dirList $groupDir/$projectVersion/etc $groupDir/etc"
;; ;;
esac esac

View File

@ -404,7 +404,7 @@ echo ""
reportEnv '$FOAM_APPBIN' '$PATH' yes reportEnv '$FOAM_APPBIN' '$PATH' yes
reportEnv '$FOAM_SITE_APPBIN' '$PATH' no reportEnv '$FOAM_SITE_APPBIN' '$PATH' no
reportEnv '$FOAM_USER_APPBIN' '$PATH' no reportEnv '$FOAM_USER_APPBIN' '$PATH' no
reportEnv '$WM_DIR' '$PATH' yes reportEnv '$WM_DIR' '$PATH' often
hline hline
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -24,14 +24,16 @@
# - User or group values (first file found): # - User or group values (first file found):
# - ~/.OpenFOAM/$WM_PROJECT_VERSION/prefs.sh # - ~/.OpenFOAM/$WM_PROJECT_VERSION/prefs.sh
# - ~/.OpenFOAM/prefs.sh # - ~/.OpenFOAM/prefs.sh
# - $WM_PROJECT_SITE/site/$WM_PROJECT_VERSION/prefs.sh # - $WM_PROJECT_SITE/$WM_PROJECT_VERSION/etc/prefs.sh
# - $WM_PROJECT_SITE/site/prefs.sh # - $WM_PROJECT_SITE/etc/prefs.sh
# #
# Environment # Environment
# FOAM_VERBOSE (set/unset) # FOAM_VERBOSE (set/unset)
# - add extra verbosity when sourcing files # - add extra verbosity when sourcing files
# FOAM_CONFIG_NOUSER (set/unset) # FOAM_CONFIG_NOUSER (set/unset)
# - suppress use of user/group configuration files # - suppress use of user/group configuration files
# WM_PROJECT_SITE (optional directory)
# - local site-specific directory, uses WM_PROJECT_DIR/site if unset
# #
# Note # Note
# Changes made to this bashrc file may be lost with the next upgrade. # Changes made to this bashrc file may be lost with the next upgrade.
@ -106,17 +108,17 @@ export WM_MPLIB=SYSTEMOPENMPI
# = true | false # = true | false
#export FOAM_SETNAN=false #export FOAM_SETNAN=false
# [WM_OSTYPE] - Operating System Type: # [FOAM_CODE_TEMPLATES] - dynamicCode templates
# = POSIX # - unset: uses 'foamEtcFile -list codeTemplates/dynamicCode'
#export WM_OSTYPE=POSIX ##export FOAM_CODE_TEMPLATES="$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode"
# [FOAM_JOB_DIR] - location of jobControl # [FOAM_JOB_DIR] - location of jobControl
# - unset: equivalent to ~/.OpenFOAM/jobControl # - unset: equivalent to ~/.OpenFOAM/jobControl
# export FOAM_JOB_DIR="$HOME/.OpenFOAM/jobControl" # export FOAM_JOB_DIR="$HOME/.OpenFOAM/jobControl"
# [FOAM_CODE_TEMPLATES] - dynamicCode templates # [WM_OSTYPE] - Operating System Type
# - unset: uses 'foamEtcFile -list codeTemplates/dynamicCode' # = POSIX
##export FOAM_CODE_TEMPLATES="$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode" #export WM_OSTYPE=POSIX
################################################################################ ################################################################################

View File

@ -18,7 +18,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
setenv WM_ARCH `uname -s` # System name setenv WM_ARCH `uname -s` # System name
if (! $?WM_OSTYPE ) setenv WM_OSTYPE POSIX # System type (POSIX is default) ## if (! $?WM_OSTYPE ) setenv WM_OSTYPE POSIX # System type (POSIX is default)
# Default compiler = gcc/g++ and C++11 # Default compiler = gcc/g++ and C++11
setenv WM_CC "gcc" setenv WM_CC "gcc"
@ -171,7 +171,16 @@ setenv FOAM_USER_APPBIN "$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin"
setenv FOAM_USER_LIBBIN "$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib" setenv FOAM_USER_LIBBIN "$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib"
# Prepend wmake to the path - not required for runtime-only environment # Prepend wmake to the path - not required for runtime-only environment
if ( -d "${WM_DIR}" ) setenv PATH "${WM_DIR}:${PATH}" set foundDir="${WM_PROJECT_DIR}/wmake"
if ( $?WM_DIR ) then
if ( -d "${WM_DIR}" ) foundDir="${WM_DIR}"
endif
if ( -d "$foundDir" ) then
setenv PATH "${foundDir}:${PATH}"
else
unsetenv WM_DIR
endif
# Prepend OpenFOAM scripts to the path # Prepend OpenFOAM scripts to the path
setenv PATH "${WM_PROJECT_DIR}/bin:${PATH}" setenv PATH "${WM_PROJECT_DIR}/bin:${PATH}"
@ -346,7 +355,7 @@ endsw
# Cleanup # Cleanup
# ~~~~~~~ # ~~~~~~~
unset archDir siteDir unset archDir siteDir foundDir
unset gcc_version gccDir unset gcc_version gccDir
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
unset clang_version clangDir unset clang_version clangDir

View File

@ -18,7 +18,7 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
export WM_ARCH=$(uname -s) # System name export WM_ARCH=$(uname -s) # System name
: ${WM_OSTYPE:=POSIX}; export WM_OSTYPE # System type (POSIX is default) ## : ${WM_OSTYPE:=POSIX}; export WM_OSTYPE # System type (POSIX is default)
# Default compiler = gcc/g++ and C++11 # Default compiler = gcc/g++ and C++11
export WM_CC="gcc" export WM_CC="gcc"
@ -167,7 +167,17 @@ export FOAM_USER_LIBBIN="$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib"
# Prepend wmake to the path - not required for runtime-only environment # Prepend wmake to the path - not required for runtime-only environment
[ -d "$WM_DIR" ] && PATH="$WM_DIR:$PATH" foundDir="$WM_PROJECT_DIR/wmake"
if [ -d "$WM_DIR" ]
then
foundDir="${WM_DIR}"
fi
if [ -d "$foundDir" ]
then
PATH="$foundDir:$PATH"
else
unset WM_DIR
fi
# Prepend OpenFOAM scripts to the path # Prepend OpenFOAM scripts to the path
export PATH="$WM_PROJECT_DIR/bin:$PATH" export PATH="$WM_PROJECT_DIR/bin:$PATH"
@ -336,7 +346,7 @@ esac
# Cleanup # Cleanup
# ~~~~~~~ # ~~~~~~~
unset archDir siteDir unset archDir siteDir foundDir
unset gcc_version gccDir unset gcc_version gccDir
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
unset clang_version clangDir unset clang_version clangDir

View File

@ -24,14 +24,16 @@
# - User or group values (first file found): # - User or group values (first file found):
# - ~/.OpenFOAM/$WM_PROJECT_VERSION/prefs.csh # - ~/.OpenFOAM/$WM_PROJECT_VERSION/prefs.csh
# - ~/.OpenFOAM/prefs.csh # - ~/.OpenFOAM/prefs.csh
# - $WM_PROJECT_SITE/site/$WM_PROJECT_VERSION/prefs.csh # - $WM_PROJECT_SITE/$WM_PROJECT_VERSION/etc/prefs.csh
# - $WM_PROJECT_SITE/site/prefs.csh # - $WM_PROJECT_SITE/etc/prefs.csh
# #
# Environment # Environment
# FOAM_VERBOSE (set/unset) # FOAM_VERBOSE (set/unset)
# - add extra verbosity when sourcing files # - add extra verbosity when sourcing files
# FOAM_CONFIG_NOUSER (set/unset) # FOAM_CONFIG_NOUSER (set/unset)
# - suppress use of user/group configuration files # - suppress use of user/group configuration files
# WM_PROJECT_SITE (optional directory)
# - local site-specific directory, uses WM_PROJECT_DIR/site if unset
# #
# Note # Note
# Changes made to this cshrc file may be lost with the next upgrade. # Changes made to this cshrc file may be lost with the next upgrade.
@ -104,17 +106,17 @@ setenv WM_MPLIB SYSTEMOPENMPI
# = true | false # = true | false
#setenv FOAM_SETNAN false #setenv FOAM_SETNAN false
# [WM_OSTYPE] - Operating System Type: # [FOAM_CODE_TEMPLATES] - dynamicCode templates
# = POSIX # - unset: uses 'foamEtcFile -list codeTemplates/dynamicCode'
#setenv WM_OSTYPE POSIX ##setenv FOAM_CODE_TEMPLATES "$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode"
# [FOAM_JOB_DIR] - location of jobControl # [FOAM_JOB_DIR] - location of jobControl
# - unset: equivalent to ~/.OpenFOAM/jobControl # - unset: equivalent to ~/.OpenFOAM/jobControl
#setenv FOAM_JOB_DIR "$HOME/.OpenFOAM/jobControl" #setenv FOAM_JOB_DIR "$HOME/.OpenFOAM/jobControl"
# [FOAM_CODE_TEMPLATES] - dynamicCode templates # [WM_OSTYPE] - Operating System Type
# - unset: uses 'foamEtcFile -list codeTemplates/dynamicCode' # = POSIX
##setenv FOAM_CODE_TEMPLATES "$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode" #setenv WM_OSTYPE POSIX
################################################################################ ################################################################################

View File

@ -15,14 +15,14 @@ cd ${0%/*} && wmakeCheckPwd "$WM_PROJECT_DIR/src" 2>/dev/null || {
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Update OpenFOAM version strings if required # Trigger update of version strings as required
wmakePrintBuild -check || wrmo OpenFOAM/global/global.o 2>/dev/null wmakePrintBuild -check || wrmo OpenFOAM/global/global.o 2>/dev/null
wmakeLnInclude -u OpenFOAM wmakeLnInclude -u OpenFOAM
wmakeLnInclude -u OSspecific/${WM_OSTYPE:=POSIX} wmakeLnInclude -u OSspecific/"${WM_OSTYPE:-POSIX}"
Pstream/Allwmake $targetType $* Pstream/Allwmake $targetType $*
OSspecific/${WM_OSTYPE:=POSIX}/Allwmake $targetType $* OSspecific/"${WM_OSTYPE:-POSIX}"/Allwmake $targetType $*
wmake $targetType OpenFOAM wmake $targetType OpenFOAM
wmake $targetType fileFormats wmake $targetType fileFormats

View File

@ -197,8 +197,8 @@ public:
// - ~/.OpenFOAM/{PROJECT_API}/"caseDicts/postProcessing" // - ~/.OpenFOAM/{PROJECT_API}/"caseDicts/postProcessing"
// - ~/.OpenFOAM/"caseDicts/postProcessing" // - ~/.OpenFOAM/"caseDicts/postProcessing"
// -# \b group settings // -# \b group settings
// - $WM_PROJECT_SITE/{PROJECT_API}/"caseDicts/postProcessing" // - $WM_PROJECT_SITE/{PROJECT_API}/"etc/caseDicts/postProcessing"
// - $WM_PROJECT_SITE/"caseDicts/postProcessing" // - $WM_PROJECT_SITE/"etc/caseDicts/postProcessing"
// -# \b other (shipped) settings // -# \b other (shipped) settings
// - $WM_PROJECT_DIR/etc/"caseDicts/postProcessing" // - $WM_PROJECT_DIR/etc/"caseDicts/postProcessing"
// //

View File

@ -67,13 +67,13 @@ static inline bool userResourceDir(Foam::fileName& queried)
// //
// Corresponds to foamEtcFile -mode=g // Corresponds to foamEtcFile -mode=g
// Looks for // Looks for
// - $WM_PROJECT_SITE // - $WM_PROJECT_SITE/etc
// - $WM_PROJECT_DIR/site // - $WM_PROJECT_DIR/site/etc
static inline bool groupResourceDir(Foam::fileName& queried) static inline bool groupResourceDir(Foam::fileName& queried)
{ {
#ifdef FOAM_RESOURCE_SITE_ENVNAME #ifdef FOAM_RESOURCE_SITE_ENVNAME
queried = Foam::getEnv(FOAM_RESOURCE_SITE_ENVNAME); queried = Foam::getEnv(FOAM_RESOURCE_SITE_ENVNAME)/"etc";
if (queried.size()) if (queried.size() > 3)
{ {
return Foam::isDir(queried); return Foam::isDir(queried);
} }
@ -85,8 +85,8 @@ static inline bool groupResourceDir(Foam::fileName& queried)
// Fallback when WM_PROJECT_SITE is unset // Fallback when WM_PROJECT_SITE is unset
#ifdef FOAM_RESOURCE_SITE_FALLBACK_ENVNAME #ifdef FOAM_RESOURCE_SITE_FALLBACK_ENVNAME
queried = Foam::getEnv(FOAM_RESOURCE_SITE_FALLBACK_ENVNAME)/"site"; queried = Foam::getEnv(FOAM_RESOURCE_SITE_FALLBACK_ENVNAME)/"site/etc";
if (queried.size() > 4) if (queried.size() > 8)
{ {
return Foam::isDir(queried); return Foam::isDir(queried);
} }
@ -160,7 +160,7 @@ Foam::fileNameList searchEtc
} }
} }
// Group resource directories // Group (site) resource directories
if (groupResourceDir(dir)) if (groupResourceDir(dir))
{ {
candidate = dir/version/name; candidate = dir/version/name;

View File

@ -64,13 +64,13 @@ fileNameList findEtcDirs
// - ~/.OpenFOAM/{PROJECT_API} // - ~/.OpenFOAM/{PROJECT_API}
// - ~/.OpenFOAM/ // - ~/.OpenFOAM/
// -# \b group settings // -# \b group settings
// - $WM_PROJECT_SITE/{PROJECT_API} // - $WM_PROJECT_SITE/{PROJECT_API}/etc/
// - $WM_PROJECT_SITE/ // - $WM_PROJECT_SITE/etc/
// -# \b other (shipped) settings // -# \b other (shipped) settings
// - $WM_PROJECT_DIR/etc/ // - $WM_PROJECT_DIR/etc/
// //
// Where {PROJECT_API} is the value of the OPENFOAM define. // Where {PROJECT_API} is the value of the OPENFOAM define.
// - \b \$WM_PROJECT_SITE : If unset, use $WM_PROJECT_DIR/site // - \b \$WM_PROJECT_SITE : If unset, uses $WM_PROJECT_DIR/site
// //
// \return The list of full paths of all the matching files or // \return The list of full paths of all the matching files or
// an empty list if the name cannot be found. // an empty list if the name cannot be found.

View File

@ -27,8 +27,8 @@
# Variables on success # Variables on success
# HAVE_PVPLUGIN_SUPPORT # HAVE_PVPLUGIN_SUPPORT
# FOAM_PV_PLUGIN_LIBBIN # FOAM_PV_PLUGIN_LIBBIN
# PARAVIEW_API - the paraview major/minor numbers (eg 5.6)
# PARAVIEW_INC_DIR # PARAVIEW_INC_DIR
# PARAVIEW_MAJMIN
# #
# Note # Note
# The OpenFOAM plugin must be the first in PV_PLUGIN_PATH and have # The OpenFOAM plugin must be the first in PV_PLUGIN_PATH and have
@ -44,7 +44,7 @@
no_paraview() no_paraview()
{ {
unset HAVE_PVPLUGIN_SUPPORT FOAM_PV_PLUGIN_LIBBIN unset HAVE_PVPLUGIN_SUPPORT FOAM_PV_PLUGIN_LIBBIN
unset PARAVIEW_INC_DIR PARAVIEW_MAJMIN unset PARAVIEW_API PARAVIEW_INC_DIR
return 0 return 0
} }
@ -56,7 +56,7 @@ echo_paraview()
echo "root=$ParaView_DIR" echo "root=$ParaView_DIR"
echo "include=$PARAVIEW_INC_DIR" echo "include=$PARAVIEW_INC_DIR"
echo "plugin=$FOAM_PV_PLUGIN_LIBBIN" echo "plugin=$FOAM_PV_PLUGIN_LIBBIN"
echo "ver=$PARAVIEW_MAJMIN" echo "api=$PARAVIEW_API"
} }
@ -95,13 +95,13 @@ wmakeLibPv()
# Test if a ParaView plugin can be built. # Test if a ParaView plugin can be built.
# On success, return 0 and export variables # On success, return 0 and export variables
# -> HAVE_PVPLUGIN_SUPPORT, FOAM_PV_PLUGIN_LIBBIN, # -> HAVE_PVPLUGIN_SUPPORT, FOAM_PV_PLUGIN_LIBBIN,
# PARAVIEW_INC_DIR, PARAVIEW_MAJMIN # PARAVIEW_API, PARAVIEW_INC_DIR
# #
# There are several prerequisites for building plugins # There are several prerequisites for building plugins
# #
have_pvplugin_support() have_pvplugin_support()
{ {
local header settings warn majmin installDir binDir includeDir targetDir local header settings warn pv_api installDir binDir includeDir targetDir
warn="==> skip paraview-plugin" warn="==> skip paraview-plugin"
# Trivial check # Trivial check
@ -121,7 +121,7 @@ have_pvplugin_support()
# Extract the paraview major+minor version from the directory name # Extract the paraview major+minor version from the directory name
# From /path/paraview-5.6 -> 5.6 # From /path/paraview-5.6 -> 5.6
majmin=$(echo "${targetDir##*/}" | \ pv_api=$(echo "${targetDir##*/}" | \
sed -n -e 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/p') sed -n -e 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/p')
[ -n "$targetDir" ] || { [ -n "$targetDir" ] || {
@ -130,7 +130,7 @@ have_pvplugin_support()
return 1 return 1
} }
[ -n "$majmin" ] || { [ -n "$pv_api" ] || {
echo "$warn (could determine major.minor version)" echo "$warn (could determine major.minor version)"
return 1 return 1
} }
@ -143,7 +143,7 @@ have_pvplugin_support()
# ParaView_DIR defined. Look for include/ # ParaView_DIR defined. Look for include/
header=$(findFirstFile \ header=$(findFirstFile \
"$ParaView_DIR/include/paraview-$majmin/$header" \ "$ParaView_DIR/include/paraview-$pv_api/$header" \
"$ParaView_DIR/include/paraview/$header" "$ParaView_DIR/include/paraview/$header"
) )
@ -164,11 +164,11 @@ have_pvplugin_support()
header=$(findFirstFile \ header=$(findFirstFile \
"$(paraview-config --include 2>/dev/null |sed -ne 's/^ *-I//p')/$header"\ "$(paraview-config --include 2>/dev/null |sed -ne 's/^ *-I//p')/$header"\
"${includeDir:+$includeDir/paraview-$majmin/$header}" \ "${includeDir:+$includeDir/paraview-$pv_api/$header}" \
"${includeDir:+$includeDir/paraview/$header}" \ "${includeDir:+$includeDir/paraview/$header}" \
/usr/local/include/"paraview-$majmin/$header" \ /usr/local/include/"paraview-$pv_api/$header" \
/usr/local/include/paraview/"$header" \ /usr/local/include/paraview/"$header" \
/usr/include/"paraview-$majmin/$header" \ /usr/include/"paraview-$pv_api/$header" \
/usr/include/paraview/"$header" \ /usr/include/paraview/"$header" \
) )
fi fi
@ -182,8 +182,8 @@ have_pvplugin_support()
export HAVE_PVPLUGIN_SUPPORT=true export HAVE_PVPLUGIN_SUPPORT=true
export FOAM_PV_PLUGIN_LIBBIN="$targetDir" export FOAM_PV_PLUGIN_LIBBIN="$targetDir"
export PARAVIEW_API="$pv_api"
export PARAVIEW_INC_DIR="${header%/*}" # Basename export PARAVIEW_INC_DIR="${header%/*}" # Basename
export PARAVIEW_MAJMIN="$majmin"
return 0 # success return 0 # success
} }

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, licensed under GNU General Public License
@ -18,7 +18,14 @@
# Ensure these variables are always defined # Ensure these variables are always defined
MakeDir=Make MakeDir=Make
: ${Script:=wmakeFunctions} : "${Script:=wmakeFunctions}"
# Environment defaults
if [ -z "$WM_DIR" ]
then
WM_DIR="$WM_PROJECT_DIR/wmake"
export WM_DIR
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -27,13 +34,18 @@ MakeDir=Make
checkEnv() checkEnv()
{ {
local check failed
for check in WM_PROJECT_DIR WM_OPTIONS WM_DIR for check in WM_PROJECT_DIR WM_OPTIONS WM_DIR
do do
eval test "\$$check" || { eval test "\$$check" || failed="$failed $check"
echo "$Script error: Environment variable \$$check not set" 1>&2 done
[ -z "$failed" ] || {
echo "$Script error: Environment variable(s) not set" 1>&2
echo " $failed" 1>&2
exit 1 exit 1
} }
done
} }

View File

@ -1,9 +1,12 @@
#!/bin/sh #!/bin/sh
cd "${0%/*}" || exit 1 # Run from this directory cd "${0%/*}" || exit 1 # Run from this directory
[ -d "${WM_DIR:?}" ] || exit 1 # Require WM_DIR
# Compile tools for wmake if [ -z "$WM_DIR" ] # Require WM_DIR
then
WM_DIR="$(\cd $(dirname $0)/.. && \pwd -L)"
export WM_DIR
fi
make make # Compile tools for wmake
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -53,8 +53,8 @@
# wclean, wcleanPlatform, wcleanLnIncludeAll # wclean, wcleanPlatform, wcleanLnIncludeAll
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/} # Use 'Script' for error messages in wmakeFunctions Script="${0##*/}" # Use 'Script' for error messages in wmakeFunctions
. ${0%/*}/scripts/wmakeFunctions # Source wmake functions . "${0%/*}/scripts/wmakeFunctions" # Source wmake functions
usage() { usage() {
exec 1>&2 exec 1>&2
@ -248,9 +248,9 @@ then
elif [ -f "$1" ] elif [ -f "$1" ]
then then
dir="${1%/*}" dir="${1%/*}"
: ${dir:=.} : "${dir:=.}"
else else
targetType=$1 targetType="$1"
fi fi
# Specified directory name: # Specified directory name:

View File

@ -17,6 +17,10 @@
# Print the version used when building the project # Print the version used when building the project
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Environment defaults
: "${WM_DIR:-$WM_PROJECT_DIR/wmake}"
#--------
usage() { usage() {
exec 1>&2 exec 1>&2
@ -56,6 +60,7 @@ die()
exit 1 exit 1
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Parse arguments and options # Parse arguments and options
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------