wmake: add "dwim" target
dwim (do what I mean): search up directories tree for Make sub-directory and build the target specified in Make/files
This commit is contained in:
parent
850816f829
commit
e66cd871b5
51
wmake/wmake
51
wmake/wmake
@ -50,6 +50,7 @@ The 'target' is a Makefile target:
|
||||
e.g., Make/linux64GccDPOpt/fvMesh.o
|
||||
|
||||
or a special target:
|
||||
dwim search up directories tree for Make sub-directory and build
|
||||
all all subdirectories, uses any Allwmake files if they exist
|
||||
exe build statically linked executable
|
||||
lib build statically linked archive lib (.a)
|
||||
@ -136,7 +137,7 @@ fi
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# check arguments and change to the directory in which to run wmake
|
||||
# Check arguments and change to the directory in which to run wmake
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
unset dir makeType
|
||||
@ -167,6 +168,51 @@ then
|
||||
fi
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Search up directories tree for the Make sub-directory and build there
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
unset dir
|
||||
MakeDir=Make
|
||||
|
||||
expandpath()
|
||||
{
|
||||
dir=`dirname $1`
|
||||
cwd=$PWD
|
||||
cd $dir
|
||||
exPath=$PWD
|
||||
cd $cwd
|
||||
}
|
||||
|
||||
find_target()
|
||||
{
|
||||
expandpath $1
|
||||
|
||||
if [ "$exPath" = "$WM_PROJECT_DIR" -o "$exPath" = "$HOME" -o "$exPath" = "/" ]; then
|
||||
echo "$Script error: could not find Make directory"
|
||||
elif [ -d "$1/Make" ]; then
|
||||
echo Target $1
|
||||
dir=$1
|
||||
else
|
||||
find_target "$1/.."
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$makeType" = dwim ]
|
||||
then
|
||||
find_target .
|
||||
makeType=
|
||||
|
||||
if [ "$dir" ]
|
||||
then
|
||||
cd $dir 2>/dev/null || {
|
||||
echo "$Script error: could not change to directory '$dir'" 1>&2
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Recurse the application directories tree
|
||||
#------------------------------------------------------------------------------
|
||||
@ -254,8 +300,9 @@ $make -s -f $WM_DIR/Makefile MAKE_DIR=$MakeDir INCLUDE_DEPS=$OBJECTS_DIR/dontInc
|
||||
rc=$?
|
||||
[ $rc -eq 0 ] || exit $rc
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# make the object files and link
|
||||
# Make the object files and link
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
cmd="$make -f $WM_DIR/Makefile MAKE_DIR=$MakeDir INCLUDE_DEPS=$OBJECTS_DIR/includeDeps $makeType"
|
||||
|
Loading…
Reference in New Issue
Block a user