ENH: "wmake all" makes 'libso' instead of 'exe' where appropriate

- adds more DWIM (do what I mean) intelligence to wmake

ENH: use ~/.OpenFOAM/.wmake instead of ~/.wmakeScheduler for the lock dir

- keeps more of the OpenFOAM bits together
This commit is contained in:
Mark Olesen
2010-04-19 10:54:23 +02:00
parent 2599c9e1c1
commit 9707e5c100
4 changed files with 42 additions and 45 deletions

View File

@ -46,12 +46,10 @@ Clean up the wmake control directory Make/\$WM_OPTIONS and remove the
lnInclude directories generated for libraries. lnInclude directories generated for libraries.
The targets correspond to a subset of the 'wmake' special targets: The targets correspond to a subset of the 'wmake' special targets:
all all subdirectories all all subdirectories, uses any Allwclean or Allclean
(NB: any Allwclean or Allclean files will be used if they exist) files if they exist
exe clean dir/Make exe | lib | libo | libso
lib clean dir/Make and dir/lnInclude clean Make, any *.dep files and lnInclude directories
libo clean dir/Make and dir/lnInclude
libso clean dir/Make and dir/lnInclude
USAGE USAGE
exit 1 exit 1
@ -122,20 +120,21 @@ then
exit 0 exit 0
fi fi
# This is the end of the recursion down the application directories tree
# so remove the "all" option so that the call to make builds the application
makeOption=
fi fi
# makeOption is not needed beyond this point
unset makeOption
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Check the existance of the Make directory # Require the existence of the 'Make' directory
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
if [ ! -d $MakeDir ] [ -d $MakeDir ] || {
then
echo "$Script error: '$MakeDir' directory does not exist" 1>&2 echo "$Script error: '$MakeDir' directory does not exist" 1>&2
exit 1 exit 1
fi }
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -143,13 +142,10 @@ rm -rf $MakeDir/$WM_OPTIONS $MakeDir/classes 2>/dev/null
find . -name "*.dep" -exec rm {} \; find . -name "*.dep" -exec rm {} \;
case "$makeOption" in # always safe to remove lnInclude
lib | libo | libso ) rm -rf lnInclude 2>/dev/null
rm -rf lnInclude 2>/dev/null
;;
esac
rm -rf ii_files Templates.DB 2>/dev/null rm -rf ii_files Templates.DB 2>/dev/null
rm -f so_locations rm -f so_locations 2>/dev/null
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -44,16 +44,15 @@ options:
A general, easy-to-use make system for multi-platform development A general, easy-to-use make system for multi-platform development
The 'target' is a Makefile target: The 'target' is a Makefile target:
e.g., Make/linux64GccDPOpt/fvMesh.o e.g., Make/linux64GccDPOpt/fvMesh.o
or a special target: or a special target:
all all subdirectories all all subdirectories, uses any Allwmake files if they exist
(NB: any Allwmake files will be used if they exist) exe build statically linked executable
exe build statically linked executable lib build statically linked archive lib (.a)
lib build statically linked archive lib (.a) libo build statically linked lib (.o)
libo build statically linked lib (.o) libso build dynamically linked lib (.so)
libso build dynamically linked lib (.so) jar build Java jar
jar build Java jar
USAGE USAGE
exit 1 exit 1
@ -104,7 +103,7 @@ if [ "$WM_NCOMPPROCS" ]
then then
if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ] if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ]
then then
lockDir=$HOME/.wmakeScheduler lockDir=$HOME/.$WM_PROJECT/.wmake
if [ -d $lockDir ] if [ -d $lockDir ]
then then
@ -168,16 +167,11 @@ then
$make -k -f $WM_DIR/MakefileApps FOAM_APPS="$FOAM_APPS" $make -k -f $WM_DIR/MakefileApps FOAM_APPS="$FOAM_APPS"
exit $? exit $?
fi fi
# This is the end of the recursion down the application directories tree
# so remove the "all" option so that the call to make builds the application
makeOption=
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Check the existance of the Make directory and files file # Require the existence of the 'Make' directory and 'files' file
# If both exist, make the wmake derived files
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
[ -d $MakeDir ] || { [ -d $MakeDir ] || {
@ -190,6 +184,18 @@ fi
exit 1 exit 1
} }
# transform "all" option to "libso" if that looks appropriate or remove it
# so that the call to make builds the application
if [ "$makeOption" = all ]
then
unset makeOption
if grep -e '^ *LIB *=' "$MakeDir/files" >/dev/null 2>&1
then
makeOption=libso
fi
fi
# Spawn a sub-shell and unset MAKEFLAGS in that sub-shell to avoid # Spawn a sub-shell and unset MAKEFLAGS in that sub-shell to avoid
# files and options being built in parallel # files and options being built in parallel
( (
@ -227,12 +233,8 @@ esac
$make -s -f $WM_DIR/Makefile MAKE_DIR=$MakeDir INCLUDE_DEPS=$OBJECTS_DIR/dontIncludeDeps $OBJECTS_DIR/dependencies $make -s -f $WM_DIR/Makefile MAKE_DIR=$MakeDir INCLUDE_DEPS=$OBJECTS_DIR/dontIncludeDeps $OBJECTS_DIR/dependencies
retVal=$? rc=$?
if [ $retVal -ne 0 ] [ $rc -eq 0 ] || exit $rc
then
exit $retVal
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# make the object files and link # make the object files and link

View File

@ -78,12 +78,12 @@ do
continue continue
fi fi
find $checkDir -depth -type d -name Make -print | while read makeDir find $checkDir -depth -type d -name Make -print | while read MakeDir
do do
topDir=${makeDir%/Make} # trim /Make from the end topDir=${MakeDir%/Make} # trim /Make from the end
if [ -d "$topDir" ] if [ -d "$topDir" ]
then then
if grep -e '^ *LIB *=' "$makeDir/files" >/dev/null 2>&1 if grep -e '^ *LIB *=' "$MakeDir/files" >/dev/null 2>&1
then then
wmakeLnInclude -f $topDir wmakeLnInclude -f $topDir
elif [ -d "$topDir/lnInclude" ] elif [ -d "$topDir/lnInclude" ]

View File

@ -48,8 +48,7 @@
# eg, export WM_NCOMPPROCS=$(wmakeScheduler -count) # eg, export WM_NCOMPPROCS=$(wmakeScheduler -count)
# #
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
lockDir=$HOME/.wmakeScheduler lockDir=$HOME/.$WM_PROJECT/.wmake
# fallback - 1 core on current host # fallback - 1 core on current host
: ${WM_HOSTS:=$HOST:1} : ${WM_HOSTS:=$HOST:1}