wdep: If source file is not in the current directory search tree for first occurrence

This commit is contained in:
Henry 2015-01-11 17:16:15 +00:00
parent a64d623394
commit 6b819790b4
6 changed files with 23 additions and 18 deletions

View File

@ -133,7 +133,7 @@ fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# get list of directories # Get list of directories
dirList=$( $listBinDirs $packDir $archOptions ) dirList=$( $listBinDirs $packDir $archOptions )
if [ $? -eq 0 -a -n "$dirList" ] if [ $? -eq 0 -a -n "$dirList" ]
then then

View File

@ -27,17 +27,15 @@
# cat `wdep <file>` # cat `wdep <file>`
# #
# Description # Description
# Find the dep-file corresponding to <file> and print the path. # Find the .dep file corresponding to <file> and print the path.
# # If <file> is not in the current directory the tree is searched for
# Note: wdep MUST be run from the directory containing <file>. # the first occurrence.
# If it proves useful an option could be added to search the local
# source-tree for <file> if it is not in the current directory.
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/} Script=${0##*/}
# Source the wdep functions # Source the wmake functions
. ${0%/*}/wmakeFunctions . ${0%/*}/scripts/wmakeFunctions
usage() { usage() {
exec 1>&2 exec 1>&2
@ -78,13 +76,20 @@ checkEnv
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Check <file> is is the current directory # Check <file> is is the current directory,
# otherwise search tree for first occurrance
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
sourceFile=$1
if [ ! -e $1 ] if [ ! -e $1 ]
then then
echo "$Script error: source file $1 is not in the current directory" 1>&2 sourceFile=$(find . -name $sourceFile -print -quit)
if [ -z "$sourceFile" ]
then
echo "$Script: cannot find source file $1" 1>&2
exit 1 exit 1
fi
fi fi
@ -93,7 +98,7 @@ fi
# and echo path for the dep file corresponding to the specified source file # and echo path for the dep file corresponding to the specified source file
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
findObjectDir $1 findObjectDir $sourceFile
fileName=${1##*/} fileName=${1##*/}

View File

@ -34,8 +34,8 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/} Script=${0##*/}
# Source the wmakeFunctions # Source the wmake functions
. ${0%/*}/wmakeFunctions . ${0%/*}/scripts/wmakeFunctions
usage() { usage() {
exec 1>&2 exec 1>&2

View File

@ -35,8 +35,8 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/} Script=${0##*/}
# Source the wdep functions # Source the wmake functions
. ${0%/*}/wmakeFunctions . ${0%/*}/scripts/wmakeFunctions
usage() { usage() {
exec 1>&2 exec 1>&2

View File

@ -34,8 +34,8 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/} Script=${0##*/}
# Source the wmakeFunctions # Source the wmake functions
. ${0%/*}/wmakeFunctions . ${0%/*}/scripts/wmakeFunctions
usage() { usage() {
exec 1>&2 exec 1>&2