mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
be more stringent with which files are considered 'source'
This commit is contained in:
@ -29,59 +29,104 @@
|
|||||||
# Description
|
# Description
|
||||||
# Link all the source files in the $1 directory into $1/lnInclude
|
# Link all the source files in the $1 directory into $1/lnInclude
|
||||||
#
|
#
|
||||||
# Usage: wmakeLnInclude <directory> <ln options>
|
# Usage: wmakeLnInclude [-f] <dir> [-lnOption]
|
||||||
#
|
#
|
||||||
|
# The desired source files:
|
||||||
|
# *.C *.H *.h *.cxx
|
||||||
|
# Avoid
|
||||||
|
# *.c (C source)
|
||||||
|
# .#* (cvs recovered files)
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
Script=${0##*/}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||||
|
cat<<USAGE
|
||||||
|
|
||||||
|
usage: $Script [-f] <dir> [-lnOption]
|
||||||
|
|
||||||
|
Link all the source files in the <dir> into <dir>/lnInclude
|
||||||
|
* Use '-f' to force an update when the lnInclude directory already exists.
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
BASEDIR=""
|
# simple option parsing
|
||||||
LNOPTION="-s"
|
unset forceUpdate
|
||||||
|
unset findOpt
|
||||||
|
|
||||||
if [ $# = 1 ]
|
# simple parse options
|
||||||
|
while [ "$#" -gt 0 ]
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-h | -help) # provide immediate help
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
-f)
|
||||||
|
shift
|
||||||
|
forceUpdate=1
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
usage "unknown option/argument: '$*'"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
baseDir=$1
|
||||||
|
incDir=$baseDir/lnInclude
|
||||||
|
|
||||||
|
if [ $# -eq 1 ]
|
||||||
then
|
then
|
||||||
BASEDIR=$1
|
lnOpt="-s"
|
||||||
|
elif [ $# -eq 2 ]
|
||||||
elif [ $# = 2 ]
|
|
||||||
then
|
then
|
||||||
BASEDIR=$1
|
lnOpt="$2"
|
||||||
LNOPTION=$2
|
|
||||||
|
|
||||||
else
|
else
|
||||||
echo $0: wrong number of arguments
|
usage "ERROR: wrong number of arguments"
|
||||||
echo "usage : wmakeLnInclude <dir> [-lnOption]"
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d $BASEDIR ]
|
|
||||||
|
if [ ! -d $baseDir ]
|
||||||
then
|
then
|
||||||
echo Base directory $BASEDIR does not exist, exiting.
|
echo $Script: Base directory $baseDir does not exist, exiting.
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d $incDir ]
|
||||||
|
then
|
||||||
|
if [ ! "$forceUpdate" ]
|
||||||
|
then
|
||||||
|
# echo $Script: include directory $incDir already exists, exiting.
|
||||||
exit 0
|
exit 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
mkdir $incDir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
INCDIR=$BASEDIR/lnInclude
|
if [ ! -d $incDir ]
|
||||||
|
|
||||||
if [ -d $INCDIR ]
|
|
||||||
then
|
then
|
||||||
#echo $0: include directory $INCDIR already exists, exiting.
|
echo $Script: failed to create include directory $incDir
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir $INCDIR
|
|
||||||
|
|
||||||
if [ ! -d $INCDIR ]
|
|
||||||
then
|
|
||||||
echo $0: failed to create include directory $INCDIR
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Link include files
|
# Link include files
|
||||||
# ~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~
|
||||||
|
echo $Script: linking include files to $incDir
|
||||||
echo $0: linking include files to $INCDIR
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
cd $INCDIR
|
cd $incDir
|
||||||
find .. -name lnInclude -prune -o -name '.svn' -prune -o -name Make -prune \
|
|
||||||
-o \( -name '*.[hcHCx]*' -o -name '*.type' \) -exec ln $LNOPTION {} . \;
|
find .. $findOpt \
|
||||||
|
\( -name lnInclude -o -name -Make -o -name .svn -o -name config \) -prune \
|
||||||
|
-o \( -name '*.[CHh]' -o -name '*.[ch]xx' -o -name '*.type' \) \
|
||||||
|
-a ! -name ".#*" \
|
||||||
|
-exec ln $lnOpt {} . \;
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user