changeset 9957:59ed11557715

mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
author John W. Eaton <jwe@octave.org>
date Thu, 10 Dec 2009 02:09:53 -0500
parents f26a33e21db9
children 80432f0ee895
files ChangeLog mkoctfile.cc.in mkoctfile.in
diffstat 3 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-10  John W. Eaton  <jwe@octave.org>
+
+	* mkoctfile.in, mkoctfile.cc.in: If output file is specified and
+	it does not end in output_ext, append output_ext.
+
 2009-12-10  John W. Eaton  <jwe@octave.org>
 
 	* mkoctfile.in, mkoctfile.cc.in: When compiling files in
--- a/mkoctfile.cc.in
+++ b/mkoctfile.cc.in
@@ -570,7 +570,13 @@
   else
     {
       if (!outputfile.empty ())
-	octfile = outputfile;
+        {
+          octfile = outputfile;
+          size_t len = octfile.length ();
+          size_t len_ext = output_ext.length ();
+          if (octfile.substr (len-len_ext) != output_ext)
+            octfile += output_ext;
+        }
       else
 	octfile = basename (octfile, true) + output_ext;
     }
--- a/mkoctfile.in
+++ b/mkoctfile.in
@@ -350,6 +350,13 @@
 else
   if [ -n "$outputfile" ]; then
     octfile="$outputfile"
+    case "$octfile" in
+      *$output_ext)
+      ;;
+      *)
+        octfile="$octfile$output_ext"
+      ;;
+    esac
   else
     octfile=`basename $octfile`
     octfile=`echo $octfile | $SED 's,\.[^.]*$,,'`$output_ext