From 69ec807f59a0ba770825acabb1766a21e4ec80a8 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Thu, 14 Sep 2023 14:41:24 +0100 Subject: [PATCH] wmakeLnInclude: Don't link to files in sub-libraries --- applications/modules/film/Make/options | 1 + .../incompressibleDriftFlux/Make/options | 2 + .../modules/solidDisplacement/Make/options | 1 + wmake/wmakeLnInclude | 54 ++++++++++++------- 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/applications/modules/film/Make/options b/applications/modules/film/Make/options index 85e2457605..7f2bd42556 100644 --- a/applications/modules/film/Make/options +++ b/applications/modules/film/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I$(FOAM_MODULES)/isothermalFilm/lnInclude \ + -I$(FOAM_MODULES)/isothermalFilm/filmCompressibleMomentumTransportModels/lnInclude \ -IfilmThermophysicalTransportModels/lnInclude \ -I$(LIB_SRC)/physicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ diff --git a/applications/modules/incompressibleDriftFlux/Make/options b/applications/modules/incompressibleDriftFlux/Make/options index b163ceabc6..28a39e76ea 100644 --- a/applications/modules/incompressibleDriftFlux/Make/options +++ b/applications/modules/incompressibleDriftFlux/Make/options @@ -2,6 +2,8 @@ EXE_INC = \ -I$(FOAM_MODULES)/twoPhaseSolver/lnInclude \ -I$(FOAM_MODULES)/VoFSolver/lnInclude \ -I$(FOAM_MODULES)/fluidSolver/lnInclude \ + -ImixtureViscosityModels/lnInclude \ + -IrelativeVelocityModels/lnInclude \ -I$(LIB_SRC)/physicalProperties/lnInclude \ -I$(LIB_SRC)/twoPhaseModels/VoF \ -I$(LIB_SRC)/twoPhaseModels/interfaceCompression/lnInclude \ diff --git a/applications/modules/solidDisplacement/Make/options b/applications/modules/solidDisplacement/Make/options index 8b0a050f14..b541411fe8 100644 --- a/applications/modules/solidDisplacement/Make/options +++ b/applications/modules/solidDisplacement/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I$(FOAM_MODULES)/solid/lnInclude \ + -IsolidDisplacementThermo/lnInclude \ -I$(LIB_SRC)/physicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ diff --git a/wmake/wmakeLnInclude b/wmake/wmakeLnInclude index 8c7f237ad5..300aba62a4 100755 --- a/wmake/wmakeLnInclude +++ b/wmake/wmakeLnInclude @@ -1,9 +1,9 @@ -#!/bin/sh +#!/bin/bash #------------------------------------------------------------------------------ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -116,27 +116,27 @@ do baseDir="." fi done -incDir=$baseDir/lnInclude +incDir="$baseDir"/lnInclude -[ -d $baseDir ] || { +[ -d "$baseDir" ] || { echo "$Script error: base directory $baseDir does not exist" 1>&2 exit 2 } -if [ -d $incDir ] +if [ -d "$incDir" ] then [ "$update" = true ] || exit 0 else - mkdir $incDir + mkdir "$incDir" fi -[ -d $incDir ] || { +[ -d "$incDir" ] || { echo "$Script error: failed to create include directory $incDir" 1>&2 exit 0 } -cd $incDir || exit 1 +cd "$incDir" || exit 1 if [ "$silentOpt" = true ] || [ -n "$WM_QUIET" ] then @@ -153,19 +153,35 @@ find -L . -type l -print0 | xargs -0 rm -f #------------------------------------------------------------------------------ -# Create links, avoid recreating links unless necessary -# things placed in the 'noLink' directory are skipped +# Create links. Avoid recreating links unless necessary. Files in lnInclude, +# Make, config and noLink are ignored, as is anything within a sub-library. #------------------------------------------------------------------------------ + +filter() +{ + kind="$1" + shift + + while [ "$#" -gt 1 ] + do + echo "-$kind" && echo "$1" + shift + echo "-o" + done + + echo "-$kind" && echo "$1" + shift +} + +mapfile -t pruneNames < <(filter name lnInclude Make config noLink) +mapfile -t prunePaths < <(find .. -mindepth 2 -type d -name Make -printf '%h\n') +mapfile -t prunePaths < <(filter path "${prunePaths[@]}") +mapfile -t matchNames < <(filter name '*.[CHh]' '*.[ch]xx' '*.[ch]pp' '*.type') + find .. \ - \( -name lnInclude -o -name Make -o -name config -o -name noLink \) \ - -prune \ - -o \( \ - -name '*.[CHh]' \ - -o -name '*.[ch]xx' \ - -o -name '*.[ch]pp' \ - -o -name '*.type' \ - \) \ - -exec ln $lnOpt {} . \; + \( "${pruneNames[@]}" -o "${prunePaths[@]}" \) -prune \ + -o \( "${matchNames[@]}" \) \ + -exec ln $lnOpt {} . \; #------------------------------------------------------------------------------