Commit 872a7788 authored by Mark Olesen's avatar Mark Olesen

ENH: add wmake -debug option

- forces c++DBUG='-DFULLDEBUG -g -O0' for the compilation, to allow
  localized debugging during development without file editing and
  while retaining the WM_COMPILE_OPTION (eg, Opt)

  Note that switching between 'wmake' and 'wmake -debug' will not
  cause existing targets to be rebuilt. As before, these are driven by
  the dependencies. An intermediate wclean may thus be required.
parent aa92e6d4
......@@ -47,6 +47,12 @@ int main(int argc, char *argv[])
{
printTest();
#ifdef FULLDEBUG
Info<< nl << "Compiled with FULLDEBUG" << nl;
#else
Info<< nl << "Regular compilation" << nl;
#endif
Info<< "\nEnd\n" << nl;
return 0;
......
......@@ -53,7 +53,7 @@ USAGE
# Parse the arguments and options
#------------------------------------------------------------------------------
unset fromWmake optLog optQueue
unset fromWmake optDebug optLog optQueue
for arg in "$@"
do
......@@ -88,8 +88,12 @@ do
fi
continue # Permanently remove arg
;;
-debug)
optDebug="-debug"
continue # Permanently remove arg
;;
-q | -queue)
optQueue="-q"
optQueue="-queue"
continue # Permanently remove arg
;;
lib | libo | libso | dep | objects)
......@@ -116,7 +120,7 @@ then
else
echo "Logging wmake -all output to '$optLog'" 1>&2
echo 1>&2
exec wmake -all $optQueue $* 2>&1 | /usr/bin/tee $optLog
exec wmake -all $optDebug $optQueue $* 2>&1 | /usr/bin/tee $optLog
# Need to cleanup after the tee
rc=$? # Error code from tee (not wmake), but not entirely important
echo "Done logging to '$optLog'" 1>&2
......@@ -139,7 +143,7 @@ fi
# Cleanup local variables and functions
#------------------------------------------------------------------------------
unset fromWmake optLog optQueue
unset fromWmake optDebug optLog optQueue
unset -f usage
......
......@@ -71,6 +71,7 @@ options:
-a | -all wmake all sub-directories, running Allwmake if present
-q | -queue wmakeCollect all sub-directories, running Allwmake if present
-k | -keep-going Keep going even when errors occur (-non-stop)
-debug Define c++DBUG='-DFULLDEBUG -g -O0' as override
-j Compile using all local cores/hyperthreads
-jN | -j N Compile using N cores/hyperthreads
-no-scheduler Disable scheduled parallel compilation
......@@ -131,7 +132,7 @@ allCores()
#------------------------------------------------------------------------------
# Default to compiling the local target only
unset all optShow update optPrintRootDir
unset all update optDebug optShow optPrintRootDir
while [ "$#" -gt 0 ]
do
......@@ -143,6 +144,9 @@ do
-s | -silent)
export WM_QUIET=true
;;
-debug)
optDebug="-DFULLDEBUG -g -O0"
;;
-show-api | -show-ext-so | \
-show-compile-c | -show-c | -show-cflags | -show-cflags-arch | \
-show-compile-cxx | -show-cxx | -show-cxxflags | -show-cxxflags-arch )
......@@ -348,7 +352,7 @@ if [ "$all" = all ]
then
if [ -e Allwmake ]
then
./Allwmake -fromWmake $targetType
./Allwmake -fromWmake ${optDebug:+-debug} $targetType
exit $?
fi
......@@ -364,6 +368,7 @@ then
# Compile all applications in sub-directories
$make ${WM_CONTINUE_ON_ERROR:+-k} \
-f $WM_DIR/makefiles/apps \
${optDebug:+c++DBUG="$optDebug"} \
TARGET="$targetType" FOAM_APPS="$FOAM_APPS"
makeExitCode=$?
else
......@@ -394,7 +399,7 @@ then
"$WM_SCHEDULER" -clean \
&& wmake -all objects \
&& "$WM_SCHEDULER"
) && wmake -all
) && wmake -all ${optDebug:+-debug}
exit $?
fi
......@@ -449,11 +454,11 @@ esac
# Pre-build the $WM_OPTIONS/options file
# which is included when building the $WM_OPTIONS/files file
$make -s -f $WM_DIR/makefiles/files MAKE_DIR=$MakeDir \
OBJECTS_DIR=$objectsDir $objectsDir/options
$make -s -f $WM_DIR/makefiles/files \
MAKE_DIR=$MakeDir OBJECTS_DIR=$objectsDir $objectsDir/options
$make -s -f $WM_DIR/makefiles/files MAKE_DIR=$MakeDir \
OBJECTS_DIR=$objectsDir
$make -s -f $WM_DIR/makefiles/files \
MAKE_DIR=$MakeDir OBJECTS_DIR=$objectsDir
)
......@@ -477,8 +482,8 @@ case "$targetType" in
(lib | libo | libso | dep)
if grep -qe '^ *LIB *=' "$MakeDir/files" 2>/dev/null
then
$make -s -f $WM_DIR/makefiles/general MAKE_DIR=$MakeDir \
OBJECTS_DIR=$objectsDir lnInclude
$make -s -f $WM_DIR/makefiles/general \
MAKE_DIR=$MakeDir OBJECTS_DIR=$objectsDir lnInclude
fi
;;
esac
......@@ -491,8 +496,8 @@ esac
if [ -n "$WM_UPDATE_DEPENDENCIES" ]
then
$make -f $WM_DIR/makefiles/general MAKE_DIR=$MakeDir \
OBJECTS_DIR=$objectsDir updatedep
$make -f $WM_DIR/makefiles/general \
MAKE_DIR=$MakeDir OBJECTS_DIR=$objectsDir updatedep
makeExitCode=$?
[ $makeExitCode -eq 0 ] || exit $makeExitCode
......@@ -503,8 +508,9 @@ fi
# Make the dependency files or object files and link
#------------------------------------------------------------------------------
exec $make -f $WM_DIR/makefiles/general MAKE_DIR=$MakeDir \
OBJECTS_DIR=$objectsDir $targetType
exec $make -f $WM_DIR/makefiles/general \
${optDebug:+c++DBUG="$optDebug"} \
MAKE_DIR=$MakeDir OBJECTS_DIR=$objectsDir $targetType
exit 0 # clean exit
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment