changeset 9956:f26a33e21db9

mkoctfile: when compiling files in subdirectories, place object files in current directory by default
author John W. Eaton <jwe@octave.org>
date Thu, 10 Dec 2009 01:49:15 -0500
parents 33537a4d223f
children 59ed11557715
files ChangeLog mkoctfile.cc.in mkoctfile.in
diffstat 3 files changed, 19 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-12-10  John W. Eaton  <jwe@octave.org>
+
+	* mkoctfile.in, mkoctfile.cc.in: When compiling files in
+	subdirectories, place object files in current directory by
+	default.
+
 2009-12-10  John W. Eaton  <jwe@octave.org>
 
 	* mkoctfile.cc.in: Accept long options with single -.
--- a/mkoctfile.cc.in
+++ b/mkoctfile.cc.in
@@ -581,7 +581,7 @@
     {
       for (it = cfiles.begin (); it != cfiles.end (); ++it)
 	{
-	  string f = *it, dfile = basename (f) + ".d", line;
+	  string f = *it, dfile = basename (f, true) + ".d", line;
 
 	  unlink (dfile.c_str ());
 	  string cmd = vars["CC"] + " " + vars["DEPEND_FLAGS"] + " "
@@ -609,7 +609,7 @@
 
       for (it = ccfiles.begin (); it != ccfiles.end (); ++it)
 	{
-	  string f = *it, dfile = basename (f) + ".d", line;
+	  string f = *it, dfile = basename (f, true) + ".d", line;
 
 	  unlink (dfile.c_str ());
 	  string cmd = vars["CC"] + " " + vars["DEPEND_FLAGS"] + " "
@@ -640,7 +640,7 @@
 
   for (it = f77files.begin (); it != f77files.end (); ++it)
     {
-      string f = *it, b = basename (f);
+      string f = *it, b = basename (f, true);
       if (!vars["F77"].empty ())
 	{
 	  string o;
@@ -671,7 +671,7 @@
       string f = *it;
       if (!vars["CC"].empty ())
 	{
-	  string b = basename (f), o;
+	  string b = basename (f, true), o;
 	  if (!outputfile.empty ())
 	    {
 	      if (link)
@@ -700,7 +700,7 @@
       string f = *it;
       if (!vars["CXX"].empty ())
 	{
-	  string b = basename (f), o;
+	  string b = basename (f, true), o;
 	  if (!outputfile.empty ())
 	    {
 	      if (link)
--- a/mkoctfile.in
+++ b/mkoctfile.in
@@ -405,16 +405,16 @@
   for f in $f77files; do
     case $f in
       *.f)
-        b=`echo $f | $SED 's,\.f$,,'`
+        b=`echo $f | $SED 's,.*/,,; s,\.f$,,'`
       ;;
       *.F)
-        b=`echo $f | $SED 's,\.F$,,'`
+        b=`echo $f | $SED 's,.*/,,; s,\.F$,,'`
       ;;
       *.f90)
-        b=`echo $f | $SED 's,\.f90$,,'`
+        b=`echo $f | $SED 's,.*/,,; s,\.f90$,,'`
       ;;
       *.F90)
-        b=`echo $f | $SED 's,\.F90$,,'`
+        b=`echo $f | $SED 's,.*/,,; s,\.F90$,,'`
       ;;
     esac
     if [ -n "$F77" ]; then
@@ -440,7 +440,7 @@
 if [ -n "$cfiles" ]; then
   for f in $cfiles; do
     if [ -n  "$CC" ]; then
-      b=`echo $f | $SED 's,\.c$,,'`
+      b=`echo $f | $SED 's,.*/,,; s,\.c$,,'`
       if [ -n "$outputfile" ]; then
 	if $link; then
 	  o=$b.o
@@ -465,13 +465,13 @@
     if [ -n "$CXX" ]; then
       case $f in
 	*.cc)
-	  b=`echo $f | $SED 's,\.cc$,,'`
+	  b=`echo $f | $SED 's,.*/,,; s,\.cc$,,'`
 	;;
 	*.C)
-	  b=`echo $f | $SED 's,\.C$,,'`
+	  b=`echo $f | $SED 's,.*/,,; s,\.C$,,'`
 	;;
 	*.cpp)
-	  b=`echo $f | $SED 's,\.cpp$,,'`
+	  b=`echo $f | $SED 's,.*/,,; s,\.cpp$,,'`
 	;;
       esac
       if [ -n "$outputfile" ]; then