wmake, wmakeLnIncludeAll: Automated the creation of the lnInclude directories based on dependency

Now lnInclude are created as required by the presence of entries in the EXE_INC
variable in the Make/options file.  This removes the need for calling
wmakeLnInclude in various Allwmake files to ensure the existence of the
lnInclude directories prior to compilation of dependent libraries.
This commit is contained in:
Henry Weller
2018-05-03 15:59:50 +01:00
parent 3be5e695ec
commit 3c000dabec
9 changed files with 100 additions and 75 deletions

View File

@ -4,7 +4,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
wmakeLnInclude interfacialModels
wmake $targetType multiphaseSystem
wmake $targetType interfacialModels
wmake $targetType

View File

@ -4,15 +4,10 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
wmakeLnInclude interfacialModels
wmakeLnInclude interfacialCompositionModels
wmakeLnInclude derivedFvPatchFields
wmake $targetType phaseSystems
wmake $targetType interfacialModels
wmake $targetType interfacialCompositionModels
wmake $targetType derivedFvPatchFields
wmakeLnInclude reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels
wmakeLnInclude reactingMultiphaseEulerFoam/multiphaseCompressibleTurbulenceModels
reactingTwoPhaseEulerFoam/Allwmake $targetType $*
reactingMultiphaseEulerFoam/Allwmake $targetType $*
wmake $targetType functionObjects

View File

@ -4,7 +4,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
wmakeLnInclude interfacialModels
wmake $targetType twoPhaseSystem
wmake $targetType interfacialModels
wmake $targetType phaseCompressibleTurbulenceModels

View File

@ -21,8 +21,6 @@ wmakeCheckPwd "$WM_PROJECT_DIR/src" || {
# Update OpenFOAM version strings if required
wmakePrintBuild -check || wrmo OpenFOAM/global/global.o 2>/dev/null
wmakeLnInclude OpenFOAM
wmakeLnInclude OSspecific/${WM_OSTYPE:-POSIX}
Pstream/Allwmake $targetType $*
OSspecific/${WM_OSTYPE:-POSIX}/Allwmake $targetType $*
@ -35,11 +33,8 @@ wmake $targetType meshTools
# Decomposition methods needed by dummyThirdParty
# (dummy metisDecomp, scotchDecomp etc) needed by e.g. meshTools
parallel/decompose/AllwmakeLnInclude
dummyThirdParty/Allwmake $targetType $*
wmakeLnInclude fvOptions
wmake $targetType finiteVolume
wmake $targetType lagrangian/basic
wmake $targetType lagrangian/distributionModels

View File

@ -36,8 +36,6 @@ wmakeMpiLib()
done
}
wmakeLnInclude decompositionMethods
if [ -n "$SCOTCH_ARCH_PATH" ]
then
wmake $targetType scotchDecomp

View File

@ -1,9 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
wmakeLnInclude decompositionMethods
wmakeLnInclude metisDecomp
wmakeLnInclude scotchDecomp
wmakeLnInclude ptscotchDecomp
#------------------------------------------------------------------------------

View File

@ -32,6 +32,6 @@ $(OBJECTS_DIR)/%.dep : %
-R '$(OBJECTS_DIR)/' '$$(OBJECTS_DIR)/' \
-R '$(WM_PROJECT_DIR)/' '$$(WM_PROJECT_DIR)/' \
-R '$(WM_THIRD_PARTY_DIR)/' '$$(WM_THIRD_PARTY_DIR)/' \
-I$(*D) $(LIB_HEADER_DIRS) $< $@
$(LIB_HEADER_DIRS) $< $@
#------------------------------------------------------------------------------

View File

@ -289,6 +289,9 @@ then
wmakeLnIncludeAll -update $parOpt
wclean empty
export WM_UPDATE_DEPENDENCIES=yes
elif [ -z "$all" ]
then
wmakeLnIncludeAll -dep "$parOpt"
fi
@ -313,6 +316,7 @@ then
&& echo "$d"; \
done | xargs \
)
if [ ! "$FOAM_APPS" = "" ]
then
# Compile all applications in sub-directories

View File

@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
@ -68,6 +68,9 @@ nCores=0
# Default 'wmakeLnInclude' option
wmLnOpt=
# Option to execute 'wmakeLnInclude' on all dependent libraries
depOpt=
while [ "$#" -gt 0 ]
do
case "$1" in
@ -77,6 +80,10 @@ do
-u | -update)
wmLnOpt="-update"
;;
-d | -dep)
depOpt=true
shift
;;
# Parallel execution on WM_NCOMPPROCS cores
-j)
nCores=$WM_NCOMPPROCS
@ -98,69 +105,106 @@ do
done
FAIL=0
if [ "$nCores" -gt 0 ]
if [ "$depOpt" = true ]
then
echo "$Script: starting wmakeLnInclude processes on $nCores cores"
MakeDir=Make
[ -r $MakeDir/options ] || {
echo "$Script error: file '$MakeDir/options' does not exist" 1>&2
exit 1
}
LIB_SRC="$WM_PROJECT_DIR/src"
includeDirs="
$WM_PROJECT_DIR/src/$WM_PROJECT
$WM_PROJECT_DIR/src/OSspecific/$WM_OSTYPE
$(grep -e '-I.*lnInclude' $MakeDir/options |
sed -e 's%-I\([.$(a-zA-Z0-9_)/]*\)/lnInclude.*%\1%' -e 's/$(\(.*\))/$\1/')"
printed=
for d in $includeDirs
do [ ! -d "$d" ]
path=$(eval echo $d)
if [ ! -d $path/lnInclude ]
then
[ $printed ] || echo "$Script: running wmakeLnInclude on dependent libraries:"
printed=true
echo -n " "
eval wmakeLnInclude $wmLnOpt $d
fi
done
unset MakeDir LIB_SRC printed
else
echo "$Script: running wmakeLnInclude"
fi
FAIL=0
# Defaults to searching from CWD
[ "$#" -gt 0 ] || set -- .
for checkDir
do
if [ -d $checkDir ]
if [ "$nCores" -gt 0 ]
then
echo " searching $checkDir for 'Make' directories"
echo "$Script: starting wmakeLnInclude processes on $nCores cores"
else
echo " skipping non-dir $checkDir"
continue
echo "$Script: running wmakeLnInclude"
fi
find $checkDir -depth -type d -name Make -print | while read MakeDir
# Defaults to searching from CWD
[ "$#" -gt 0 ] || set -- .
for checkDir
do
topDir=${MakeDir%/Make} # trim /Make from the end
if [ -d "$topDir" ]
if [ -d $checkDir ]
then
if grep -e '^ *LIB *=' "$MakeDir/files" >/dev/null 2>&1
then
# If running in parallel start wmakeLnInclude on nCores
# and more as the cores become free
if [ "$nCores" -gt 0 ]
then
joblist=($(jobs -p))
while (( ${#joblist[*]} > $nCores ))
do
# When the job limit is reached wait for a job to finish
wait -n
joblist=($(jobs -p))
done
wmakeLnInclude $wmLnOpt $topDir &
else
wmakeLnInclude $wmLnOpt $topDir
fi
elif [ -d "$topDir/lnInclude" ]
then
echo " removing spurious $topDir/lnInclude"
rm -rf "$topDir/lnInclude"
fi
echo " searching $checkDir for 'Make' directories"
else
echo " skipping non-dir $checkDir"
continue
fi
find $checkDir -depth -type d -name Make -print | while read MakeDir
do
topDir=${MakeDir%/Make} # trim /Make from the end
if [ -d "$topDir" ]
then
if grep -e '^ *LIB *=' "$MakeDir/files" >/dev/null 2>&1
then
# If running in parallel start wmakeLnInclude on nCores
# and more as the cores become free
if [ "$nCores" -gt 0 ]
then
joblist=($(jobs -p))
while (( ${#joblist[*]} > $nCores ))
do
# When the job limit is reached wait for a job to finish
wait -n
joblist=($(jobs -p))
done
wmakeLnInclude $wmLnOpt $topDir &
else
wmakeLnInclude $wmLnOpt $topDir
fi
elif [ -d "$topDir/lnInclude" ]
then
echo " removing spurious $topDir/lnInclude"
rm -rf "$topDir/lnInclude"
fi
fi
done
done
done
if [ "$nCores" -gt 0 ]
then
# Wait for all of the wmakeLnInclude jobs to finish
wait
if [ "$nCores" -gt 0 ]
then
# Wait for all of the wmakeLnInclude jobs to finish
wait
# Synchronize the file system to ensure that all of the links exist
# before compilation
# sync
sleep 2
# Synchronize the file system to ensure that all of the links exist
# before compilation
# sync
sleep 3
fi
unset FAIL joblist
fi
@ -168,7 +212,7 @@ fi
# Cleanup local variables and functions
#------------------------------------------------------------------------------
unset Script usage error
unset Script usage error findName nCores wmLnOpt depOpt
#------------------------------------------------------------------------------