CONFIG: wmakeLnInclude with '-extra' option
- enables symlink for .cpp and .cxx source files
This commit is contained in:
parent
7766854a7e
commit
6103303b9a
@ -7,7 +7,7 @@
|
|||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
# Copyright (C) 2019-2022 OpenCFD Ltd.
|
# Copyright (C) 2019-2023 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.
|
||||||
@ -19,18 +19,20 @@
|
|||||||
# wmakeLnInclude [OPTION] [-pwd | dir [.. dirN]]
|
# wmakeLnInclude [OPTION] [-pwd | dir [.. dirN]]
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# Link source files in the specified dir(s) into their respective
|
# Link header/template files from specified dir(s) into their respective
|
||||||
# lnInclude directories
|
# lnInclude directories
|
||||||
#
|
#
|
||||||
# Header files : .h .H .hh .hpp .hxx
|
# Header files : .h .H .hh .hpp .hxx
|
||||||
# Template files : .C .tcc .tpp .txx
|
# Source files : .c .C .cc .cpp .cxx
|
||||||
|
# Template files : -- .C .tcc .tpp .txx
|
||||||
#
|
#
|
||||||
# Note
|
# Note
|
||||||
# OpenFOAM has historically used '.C' files both for compiled code
|
# OpenFOAM has historically used the '.C' extension for both compiled
|
||||||
# and templated code.
|
# and templated C++ code (may change in the future).
|
||||||
#
|
#
|
||||||
# GNU make suffixes : .c .cc .C .cpp
|
# GNU make suffixes : .c .cc .C .cpp (.cxx is however frequently used)
|
||||||
#
|
#
|
||||||
|
# https://develop.openfoam.com/Development/openfoam/wikis/coding/style/filenames
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
Script="${0##*/}" # Need 'Script' for wmakeFunctions messages
|
Script="${0##*/}" # Need 'Script' for wmakeFunctions messages
|
||||||
scriptsDir="${0%/*}"/scripts # wmake/scripts directory
|
scriptsDir="${0%/*}"/scripts # wmake/scripts directory
|
||||||
@ -42,14 +44,15 @@ printHelp() {
|
|||||||
Usage: ${0##*/} [OPTION] [-pwd | dir [.. dirN]]
|
Usage: ${0##*/} [OPTION] [-pwd | dir [.. dirN]]
|
||||||
|
|
||||||
options:
|
options:
|
||||||
-f | -force Force remove of existing lnInclude before recreating
|
-f | -force Force remove of existing lnInclude/ before recreating
|
||||||
-u | -update Update existing lnInclude directories
|
-u | -update Update existing lnInclude directories
|
||||||
-s | -silent Silent mode (do not echo command)
|
-s | -silent Silent mode (do not echo command)
|
||||||
|
-extra Include additional files (eg, source files)
|
||||||
-pwd Locate root directory containing Make/ directory
|
-pwd Locate root directory containing Make/ directory
|
||||||
-help Print the usage
|
-help Print the usage
|
||||||
|
|
||||||
Link source files in specified dir(s) into their respective
|
Link header/template files from specified dir(s) into their respective
|
||||||
lnInclude directories. With '-update', items are relinked with 'ln -sf'
|
lnInclude/ directories. With '-update', items are relinked with 'ln -sf'
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
exit 0 # clean exit
|
exit 0 # clean exit
|
||||||
@ -75,9 +78,9 @@ die()
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Option for 'ln'
|
# Option for 'ln'
|
||||||
optLink="-s"
|
link_option="-s"
|
||||||
|
|
||||||
unset optForce optUpdate optPwd
|
unset opt_extra opt_force opt_pwd opt_update
|
||||||
|
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
@ -88,19 +91,22 @@ do
|
|||||||
-h | -help*)
|
-h | -help*)
|
||||||
printHelp
|
printHelp
|
||||||
;;
|
;;
|
||||||
|
-extra)
|
||||||
|
opt_extra=true # Include additional files
|
||||||
|
;;
|
||||||
-f | -force)
|
-f | -force)
|
||||||
optForce=true
|
opt_force=true
|
||||||
optLink="-sf"
|
link_option="-sf"
|
||||||
;;
|
;;
|
||||||
-u | -update)
|
-u | -update)
|
||||||
optUpdate=true
|
opt_update=true
|
||||||
optLink="-sf"
|
link_option="-sf"
|
||||||
;;
|
;;
|
||||||
-s | -silent | -quiet)
|
-s | -silent | -quiet)
|
||||||
export WM_QUIET=true
|
export WM_QUIET=true
|
||||||
;;
|
;;
|
||||||
-pwd)
|
-pwd)
|
||||||
optPwd=true
|
opt_pwd=true
|
||||||
;;
|
;;
|
||||||
-*)
|
-*)
|
||||||
die "unknown option: '$1'"
|
die "unknown option: '$1'"
|
||||||
@ -112,7 +118,7 @@ do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -n "$optPwd" ] || [ "$#" -ge 1 ] || \
|
[ -n "$opt_pwd" ] || [ "$#" -ge 1 ] || \
|
||||||
die "incorrect number of arguments"
|
die "incorrect number of arguments"
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
@ -120,7 +126,7 @@ done
|
|||||||
baseDir="$1"
|
baseDir="$1"
|
||||||
|
|
||||||
# With -pwd, go on discovery
|
# With -pwd, go on discovery
|
||||||
if [ -n "$optPwd" ]
|
if [ -n "$opt_pwd" ]
|
||||||
then
|
then
|
||||||
if [ -n "$baseDir" ]
|
if [ -n "$baseDir" ]
|
||||||
then
|
then
|
||||||
@ -181,13 +187,13 @@ do
|
|||||||
|
|
||||||
incDir="$baseDir/lnInclude"
|
incDir="$baseDir/lnInclude"
|
||||||
|
|
||||||
if [ "$optForce" = true ]
|
if [ "$opt_force" = true ]
|
||||||
then
|
then
|
||||||
rm -rf -- "$incDir"
|
rm -rf -- "$incDir"
|
||||||
mkdir "$incDir"
|
mkdir "$incDir"
|
||||||
elif [ -d "$incDir" ]
|
elif [ -d "$incDir" ]
|
||||||
then
|
then
|
||||||
if [ "$optUpdate" != true ]
|
if [ "$opt_update" != true ]
|
||||||
then
|
then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@ -214,9 +220,19 @@ do
|
|||||||
# -exec rm (not -delete) to remove names with '/' in their name
|
# -exec rm (not -delete) to remove names with '/' in their name
|
||||||
# with \+ instead of \; to pack into a single command
|
# with \+ instead of \; to pack into a single command
|
||||||
find -L . -type l -exec rm -- {} \+
|
find -L . -type l -exec rm -- {} \+
|
||||||
|
## TBD: Remove remnant source files too?
|
||||||
|
## if [ -z "$opt_extra" ]
|
||||||
|
## then
|
||||||
|
## find -L \( -name '*.cpp' -o -name '*.cxx' \) -exec rm -- {} \+
|
||||||
|
## fi
|
||||||
;;
|
;;
|
||||||
(*)
|
(*)
|
||||||
find -L . -type l -delete
|
find -L . -type l -delete
|
||||||
|
## TBD: Remove remnant source files too?
|
||||||
|
## if [ -z "$opt_extra" ]
|
||||||
|
## then
|
||||||
|
## find -L \( -name '*.cpp' -o -name '*.cxx' \) -print
|
||||||
|
## fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -230,10 +246,10 @@ do
|
|||||||
-name '*.[CHh]' \
|
-name '*.[CHh]' \
|
||||||
-o -name '*.hh' \
|
-o -name '*.hh' \
|
||||||
-o -name '*.tcc' \
|
-o -name '*.tcc' \
|
||||||
-o -name '*.[ht]pp' \
|
-o -name '*.[ht]pp' ${opt_extra:+-o -name '*.cpp'} \
|
||||||
-o -name '*.[ht]xx' \
|
-o -name '*.[ht]xx' ${opt_extra:+-o -name '*.cxx'} \
|
||||||
\) \
|
\) \
|
||||||
-exec ln "$optLink" {} . \;
|
-exec ln "$link_option" {} . \;
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
echo "$Script error: failed to create include directory $incDir" 1>&2
|
echo "$Script error: failed to create include directory $incDir" 1>&2
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
# Copyright (C) 2018-2022 OpenCFD Ltd.
|
# Copyright (C) 2018-2023 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.
|
||||||
@ -35,6 +35,7 @@ options:
|
|||||||
-u | -update Update existing lnInclude directories
|
-u | -update Update existing lnInclude directories
|
||||||
-j Use all local cores/hyperthreads
|
-j Use all local cores/hyperthreads
|
||||||
-jN | -j N Use N cores/hyperthreads
|
-jN | -j N Use N cores/hyperthreads
|
||||||
|
-extra Include additional files (eg, source files)
|
||||||
-help Display short help and exit
|
-help Display short help and exit
|
||||||
|
|
||||||
Find directories with a 'Make/files' containing a 'LIB =' directive
|
Find directories with a 'Make/files' containing a 'LIB =' directive
|
||||||
@ -66,7 +67,7 @@ die()
|
|||||||
# Parallel operation requested
|
# Parallel operation requested
|
||||||
nCores=0
|
nCores=0
|
||||||
|
|
||||||
unset opt_force opt_update
|
unset opt_extra opt_force opt_update
|
||||||
|
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
@ -77,6 +78,9 @@ do
|
|||||||
-h | -help*)
|
-h | -help*)
|
||||||
printHelp
|
printHelp
|
||||||
;;
|
;;
|
||||||
|
-extra)
|
||||||
|
opt_extra='-extra'
|
||||||
|
;;
|
||||||
-f | -force)
|
-f | -force)
|
||||||
opt_force='-force'
|
opt_force='-force'
|
||||||
;;
|
;;
|
||||||
@ -169,9 +173,9 @@ do
|
|||||||
wait -n
|
wait -n
|
||||||
joblist=($(jobs -p))
|
joblist=($(jobs -p))
|
||||||
done
|
done
|
||||||
wmakeLnInclude $opt_force $opt_update -- "$topDir" &
|
wmakeLnInclude $opt_extra $opt_force $opt_update -- "$topDir" &
|
||||||
else
|
else
|
||||||
wmakeLnInclude $opt_force $opt_update -- "$topDir"
|
wmakeLnInclude $opt_extra $opt_force $opt_update -- "$topDir"
|
||||||
fi
|
fi
|
||||||
elif [ -d "$topDir/lnInclude" ]
|
elif [ -d "$topDir/lnInclude" ]
|
||||||
then
|
then
|
||||||
|
Loading…
Reference in New Issue
Block a user