mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add -make option to touchdep, toucho
- restricts selection to Make/$WM_OPTIONS* subdirectories, which is useful when multiple compilers are in use
This commit is contained in:
70
bin/touchdep
70
bin/touchdep
@ -3,7 +3,7 @@
|
|||||||
# ========= |
|
# ========= |
|
||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
# \\ / O peration |
|
# \\ / O peration |
|
||||||
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
@ -28,25 +28,71 @@
|
|||||||
# Description
|
# Description
|
||||||
# touch all .dep files
|
# touch all .dep files
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
usage() {
|
||||||
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||||
|
cat<<USAGE
|
||||||
|
|
||||||
# default is pwd
|
Usage: ${0##*/} [OPTION] [dir1] .. [dirN]
|
||||||
if [ "$#" -eq 0 ]
|
options:
|
||||||
then
|
-make limit selection to 'Make/\$WM_OPTIONS*' (Make/$WM_OPTIONS*)
|
||||||
set -- .
|
-help print the usage
|
||||||
elif [ "$1" = "-h" -o "$1" = "-help" ]
|
|
||||||
then
|
Find and touch all .dep files in the specified directories.
|
||||||
echo "Usage: ${0##*/} [dir1] .. [dirN]"
|
Uses the cwd by default if no directories are specified.
|
||||||
echo " touch all .dep files"
|
|
||||||
|
Current value of WM_OPTIONS=$WM_OPTIONS
|
||||||
|
|
||||||
|
|
||||||
|
NOTE The '-make' is a future feature.
|
||||||
|
This is currently no separation of .dep files by platforms.
|
||||||
|
|
||||||
|
USAGE
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unset restrictOpt
|
||||||
|
|
||||||
|
# parse options
|
||||||
|
while [ "$#" -gt 0 ]
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-h | -help)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
-m | -make)
|
||||||
|
[ -n "$WM_OPTIONS" ] || usage "Error: -make option only valid when \$WM_OPTIONS is set"
|
||||||
|
restrictOpt=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
usage "unknown option: '$*'"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# no directories specified: default is pwd
|
||||||
|
[ "$#" -gt 0 ] || set -- .
|
||||||
|
|
||||||
for i
|
for i
|
||||||
do
|
do
|
||||||
if [ -d "$i" ]
|
if [ -d "$i" ]
|
||||||
then
|
then
|
||||||
echo "touching all .dep files: $i"
|
if [ "$restrictOpt" = true ]
|
||||||
find $i -name '*.dep' -print | xargs -t touch
|
then
|
||||||
|
echo "touching all .dep files under Make/$WM_OPTIONS* : $i"
|
||||||
|
find -depth -name Make -type d -print | \
|
||||||
|
xargs -i find '{}' -depth -name "$WM_OPTIONS*" -type d -print | \
|
||||||
|
xargs -i find '{}' -name '*.dep' -type f -print | \
|
||||||
|
xargs -t touch
|
||||||
|
else
|
||||||
|
echo "touching all .dep files: $i"
|
||||||
|
find $i -name '*.dep' -type f -print | xargs -t touch
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "no directory: $i"
|
echo "no directory: $i"
|
||||||
fi
|
fi
|
||||||
|
|||||||
67
bin/toucho
67
bin/toucho
@ -3,7 +3,7 @@
|
|||||||
# ========= |
|
# ========= |
|
||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
# \\ / O peration |
|
# \\ / O peration |
|
||||||
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
@ -28,27 +28,70 @@
|
|||||||
# Description
|
# Description
|
||||||
# touch all .o files
|
# touch all .o files
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
usage() {
|
||||||
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||||
|
cat<<USAGE
|
||||||
|
|
||||||
# default is pwd
|
Usage: ${0##*/} [OPTION] [dir1] .. [dirN]
|
||||||
if [ "$#" -eq 0 ]
|
options:
|
||||||
then
|
-make limit selection to 'Make/\$WM_OPTIONS*'
|
||||||
set -- .
|
-help print the usage
|
||||||
elif [ "$1" = "-h" -o "$1" = "-help" ]
|
|
||||||
then
|
Find and touch all .o files in the specified directories.
|
||||||
echo "Usage: ${0##*/} [dir1] .. [dirN]"
|
Uses the cwd by default if no directories are specified.
|
||||||
echo " touch all .o files"
|
|
||||||
|
Current value of WM_OPTIONS=$WM_OPTIONS
|
||||||
|
|
||||||
|
USAGE
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unset restrictOpt
|
||||||
|
|
||||||
|
# parse options
|
||||||
|
while [ "$#" -gt 0 ]
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-h | -help)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
-m | -make)
|
||||||
|
[ -n "$WM_OPTIONS" ] || usage "Error: -make option only valid when \$WM_OPTIONS is set"
|
||||||
|
restrictOpt=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
usage "unknown option: '$*'"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# no directories specified: default is pwd
|
||||||
|
[ "$#" -gt 0 ] || set -- .
|
||||||
|
|
||||||
for i
|
for i
|
||||||
do
|
do
|
||||||
if [ -d "$i" ]
|
if [ -d "$i" ]
|
||||||
then
|
then
|
||||||
echo "touching all .o files: $i"
|
if [ "$restrictOpt" = true ]
|
||||||
find $i -name '*.o' -print | xargs -t touch
|
then
|
||||||
|
echo "touching all .o files under Make/$WM_OPTIONS* : $i"
|
||||||
|
find -depth -name Make -type d -print | \
|
||||||
|
xargs -i find '{}' -depth -name "$WM_OPTIONS*" -type d -print | \
|
||||||
|
xargs -i find '{}' -name '*.o' -type f -print | \
|
||||||
|
xargs -t touch
|
||||||
|
else
|
||||||
|
echo "touching all .o files: $i"
|
||||||
|
find $i -name '*.o' -type f -print | xargs -t touch
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "no directory: $i"
|
echo "no directory: $i"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user