diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/Allwmake b/applications/solvers/multiphase/multiphaseEulerFoam/Allwmake index d38522312d..c731f57210 100755 --- a/applications/solvers/multiphase/multiphaseEulerFoam/Allwmake +++ b/applications/solvers/multiphase/multiphaseEulerFoam/Allwmake @@ -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 diff --git a/applications/solvers/multiphase/reactingEulerFoam/Allwmake b/applications/solvers/multiphase/reactingEulerFoam/Allwmake index be8ba39a10..77f61dd781 100755 --- a/applications/solvers/multiphase/reactingEulerFoam/Allwmake +++ b/applications/solvers/multiphase/reactingEulerFoam/Allwmake @@ -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 diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake b/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake index 9eb3ae37c4..33db79cd4d 100755 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake @@ -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 diff --git a/src/Allwmake b/src/Allwmake index 3f7a0f8d68..06ad2cf7ac 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -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 diff --git a/src/parallel/decompose/Allwmake b/src/parallel/decompose/Allwmake index 20a3d4dfc1..8f769c3882 100755 --- a/src/parallel/decompose/Allwmake +++ b/src/parallel/decompose/Allwmake @@ -36,8 +36,6 @@ wmakeMpiLib() done } -wmakeLnInclude decompositionMethods - if [ -n "$SCOTCH_ARCH_PATH" ] then wmake $targetType scotchDecomp diff --git a/src/parallel/decompose/AllwmakeLnInclude b/src/parallel/decompose/AllwmakeLnInclude deleted file mode 100755 index 74fdde1f38..0000000000 --- a/src/parallel/decompose/AllwmakeLnInclude +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -cd ${0%/*} || exit 1 # Run from this directory - -wmakeLnInclude decompositionMethods -wmakeLnInclude metisDecomp -wmakeLnInclude scotchDecomp -wmakeLnInclude ptscotchDecomp - -#------------------------------------------------------------------------------ diff --git a/wmake/rules/General/transform b/wmake/rules/General/transform index eb230ab3f8..efb86df866 100644 --- a/wmake/rules/General/transform +++ b/wmake/rules/General/transform @@ -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) $< $@ #------------------------------------------------------------------------------ diff --git a/wmake/wmake b/wmake/wmake index 052b83f0c1..48a2c280fc 100755 --- a/wmake/wmake +++ b/wmake/wmake @@ -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 diff --git a/wmake/wmakeLnIncludeAll b/wmake/wmakeLnIncludeAll index ba4927b3b2..0267dfbbd5 100755 --- a/wmake/wmakeLnIncludeAll +++ b/wmake/wmakeLnIncludeAll @@ -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 #------------------------------------------------------------------------------