ENH: support wmakeLnInclude of C++ template files (.tcc, .tpp, .txx)

- can be used to avoid confusion with source files

ENH: improve handling of '--' option termination (wmake scripts)
This commit is contained in:
Mark Olesen 2022-11-16 10:47:11 +01:00
parent 5714a3606e
commit 90c4ee7e12
15 changed files with 74 additions and 43 deletions

View File

@ -6,7 +6,7 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2019 OpenCFD Ltd. # Copyright (C) 2019-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -54,6 +54,9 @@ optStrip=true
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
('') ;;
(- | --) shift; break ;; # Stop option parsing
# Print help # Print help
(-h | -help*) (-h | -help*)
usage usage
@ -64,10 +67,6 @@ do
(-no-strip) (-no-strip)
unset optStrip unset optStrip
;; ;;
(--)
shift
break
;;
(*) (*)
break break
;; ;;

View File

@ -6,13 +6,13 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018 OpenCFD Ltd. # Copyright (C) 2018-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# #
# Script # Script
# makeDepend # wmake/scripts/makeDepend
# #
# Description # Description
# Wrapping for cpp -M with argument/options compatible with # Wrapping for cpp -M with argument/options compatible with

View File

@ -6,7 +6,7 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Copyright (C) 2019 OpenCFD Ltd. # Copyright (C) 2019-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -51,6 +51,9 @@ unset optRemoveFile optRemoveTmp optNoLines
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
('') ;;
(- | --) shift; break ;; # Stop option parsing
(-h | -help*) printHelp ;; (-h | -help*) printHelp ;;
(-prefix=*) prefix="${1#*=}" ;; (-prefix=*) prefix="${1#*=}" ;;

View File

@ -12,19 +12,19 @@
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# #
# Script # Script
# makeTargetDir # wmake/scripts/makeTargetDir
# #
# Description # Description
# Makes a directory hierarchy for the given target file # Makes a directory hierarchy for the given target file(s)
# #
# Usage: makeTargetDir <file> # Usage: makeTargetDir file1 [..fileN]
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
for target for target
do do
dir=${target%/*} dir="${target%/*}"
[ -d "$dir" ] || [ "$dir" = "$target" ] || mkdir -p "$dir" [ "$dir" = "$target" ] || [ -d "$dir" ] || mkdir -p "$dir"
done done
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -6,7 +6,7 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2021 OpenCFD Ltd. # Copyright (C) 2018-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -101,6 +101,9 @@ unset optCheck optDryRun optUpdate optQuery optFilter
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
('') ;;
(- | --) shift; break ;; # Stop option parsing
-h | -help*) -h | -help*)
printHelp printHelp
;; ;;

View File

@ -7,7 +7,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Copyright (C) 2011-2015 OpenFOAM Foundation # Copyright (C) 2011-2015 OpenFOAM Foundation
# Copyright (C) 2020 OpenCFD Ltd. # Copyright (C) 2020-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -69,16 +69,15 @@ die()
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
('') ;;
(- | --) shift; break ;; # Stop option parsing
-h | -help*) -h | -help*)
printHelp printHelp
;; ;;
-q | -quiet | -s | -silent) -q | -quiet | -s | -silent)
optQuiet=true optQuiet=true
;; ;;
--)
shift
break
;;
-*) -*)
die "Unknown option: '$1'" "See '${0##*/} -help' for usage" die "Unknown option: '$1'" "See '${0##*/} -help' for usage"
;; ;;

View File

@ -6,7 +6,7 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Copyright (C) 2020-2021 OpenCFD Ltd. # Copyright (C) 2020-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -53,8 +53,8 @@ unset optVersion outputDir
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; ('') ;;
--) shift; break ;; (- | --) shift; break ;; # Stop option parsing
-h | -help*) -h | -help*)
printHelp printHelp

View File

@ -7,7 +7,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation # Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2017-2020 OpenCFD Ltd. # Copyright (C) 2017-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -101,6 +101,9 @@ MakeDir=Make
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
('') ;;
(- | --) shift; break ;; # Stop option parsing
-help-f*) # Full help -help-f*) # Full help
printHelp -full printHelp -full
;; ;;

View File

@ -7,7 +7,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2014-2015 OpenFOAM Foundation # Copyright (C) 2014-2015 OpenFOAM Foundation
# Copyright (C) 2017 OpenCFD Ltd. # Copyright (C) 2017-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -50,6 +50,9 @@ USAGE
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
('') ;;
(- | --) shift; break ;; # Stop option parsing
-h | -help*) -h | -help*)
usage usage
;; ;;

View File

@ -223,8 +223,8 @@ fi
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; ('') ;;
--) shift; break ;; (- | --) shift; break ;; # Stop option parsing
-help-f*) # Full help -help-f*) # Full help
printHelp -full printHelp -full
@ -416,6 +416,7 @@ MakeDir=Make
unset dir unset dir
# With -pwd, go on discovery
if [ -n "$opt_pwd" ] if [ -n "$opt_pwd" ]
then then
if [ $# -ge 1 ] if [ $# -ge 1 ]

View File

@ -63,6 +63,9 @@ unset cleanup
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
('') ;;
(- | --) shift; break ;; # Stop option parsing
-h | -help*) -h | -help*)
usage usage
;; ;;

View File

@ -7,7 +7,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation # Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2019-2020 OpenCFD Ltd. # Copyright (C) 2019-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -22,8 +22,13 @@
# Link source files in the specified dir(s) into their respective # Link source files in the specified dir(s) into their respective
# lnInclude directories # lnInclude directories
# #
# C files: .c .h # Header files (C) : .h
# C++ files: .C .cc .cpp .cxx .H .hh .hpp .hxx # Source files (C) : .c
# Header files (C++) : .H .hh .hpp .hxx
# Source files (C++) : .C .cc .cpp .cxx
# Template files (C++) : .tcc .tpp .txx
#
# GNU make suffixes : .c .cc .C .cpp
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script="${0##*/}" # Need 'Script' for wmakeFunctions messages Script="${0##*/}" # Need 'Script' for wmakeFunctions messages
@ -76,6 +81,9 @@ unset optForce optUpdate optPwd
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
('') ;;
(- | --) shift; break ;; # Stop option parsing
-h | -help*) -h | -help*)
printHelp printHelp
;; ;;
@ -103,7 +111,7 @@ do
shift shift
done done
[ "$optPwd" = true ] || [ "$#" -ge 1 ] || \ [ -n "$optPwd" ] || [ "$#" -ge 1 ] || \
die "incorrect number of arguments" die "incorrect number of arguments"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -111,7 +119,7 @@ done
baseDir="$1" baseDir="$1"
# With -pwd, go on discovery # With -pwd, go on discovery
if [ "$optPwd" = true ] if [ -n "$optPwd" ]
then then
if [ -n "$baseDir" ] if [ -n "$baseDir" ]
then then
@ -221,9 +229,9 @@ do
-name '*.[CHch]' \ -name '*.[CHch]' \
-o -name '*.cc' \ -o -name '*.cc' \
-o -name '*.hh' \ -o -name '*.hh' \
-o -name '*.[ch]xx' \ -o -name '*.[cht]xx' \
-o -name '*.[ch]pp' \ -o -name '*.[cht]pp' \
-o -name '*.type' \ -o -name '*.tcc' \
\) \ \) \
-exec ln "$optLink" {} . \; -exec ln "$optLink" {} . \;
) )

View File

@ -7,7 +7,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation # Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2018-2020 OpenCFD Ltd. # Copyright (C) 2018-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -66,19 +66,22 @@ die()
# Parallel operation requested # Parallel operation requested
nCores=0 nCores=0
unset optForce optUpdate unset opt_force opt_update
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
('') ;;
(- | --) shift; break ;; # Stop option parsing
-h | -help*) -h | -help*)
printHelp printHelp
;; ;;
-f | -force) -f | -force)
optForce=true opt_force='-force'
;; ;;
-u | -update) -u | -update)
optUpdate=true opt_update='-update'
;; ;;
-s | -silent | -quiet) -s | -silent | -quiet)
export WM_QUIET=true export WM_QUIET=true
@ -150,7 +153,7 @@ do
find "$checkDir" -depth -name Make -type d -print | while read MakeDir find "$checkDir" -depth -name Make -type d -print | while read MakeDir
do do
topDir=${MakeDir%/Make} # trim /Make from the end topDir="${MakeDir%/Make}" # trim /Make from the end
if [ -d "$topDir" ] if [ -d "$topDir" ]
then then
if grep -qe '^ *LIB *=' "$MakeDir/files" 2>/dev/null if grep -qe '^ *LIB *=' "$MakeDir/files" 2>/dev/null
@ -166,9 +169,9 @@ do
wait -n wait -n
joblist=($(jobs -p)) joblist=($(jobs -p))
done done
wmakeLnInclude ${optForce:+-force} ${optUpdate:+-update} $topDir & wmakeLnInclude $opt_force $opt_update -- "$topDir" &
else else
wmakeLnInclude ${optForce:+-force} ${optUpdate:+-update} $topDir wmakeLnInclude $opt_force $opt_update -- "$topDir"
fi fi
elif [ -d "$topDir/lnInclude" ] elif [ -d "$topDir/lnInclude" ]
then then

View File

@ -7,7 +7,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2015-2016 OpenFOAM Foundation # Copyright (C) 2015-2016 OpenFOAM Foundation
# Copyright (C) 2017-2019 OpenCFD Ltd. # Copyright (C) 2017-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -92,6 +92,9 @@ unset platform
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
('') ;;
(- | --) shift; break ;; # Stop option parsing
-h | -help*) -h | -help*)
usage usage
;; ;;

View File

@ -7,7 +7,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2015 OpenFOAM Foundation # Copyright (C) 2015 OpenFOAM Foundation
# Copyright (C) 2017-2019 OpenCFD Ltd. # Copyright (C) 2017-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -55,6 +55,9 @@ unset platform
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
('') ;;
(- | --) shift; break ;; # Stop option parsing
-h | -help*) -h | -help*)
usage usage
;; ;;