changeset 22031:2cfbb6b25428

mkoctfile: support more file extensions for C++ sources (bug #48381) * mkoctfile.in.cc (help_msg, main): Add support for C++ source files ending with a .cp, .CPP, .cxx, or .c++ suffix (corresponding to gcc). (main): Use CXX when generating dependency files for C++ sources. * mkoctfile.1: Add .cp, .CPP, .cxx, and .c++ to the list of recognized C++ source file suffixes.
author Mike Miller <mtmiller@octave.org>
date Sat, 02 Jul 2016 20:29:39 -0700
parents 3a4742ebaf63
children 91611c9e1d81
files doc/interpreter/mkoctfile.1 src/mkoctfile.in.cc
diffstat 2 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/mkoctfile.1	Sat Jul 02 15:16:51 2016 -0700
+++ b/doc/interpreter/mkoctfile.1	Sat Jul 02 20:29:39 2016 -0700
@@ -130,8 +130,12 @@
 .Vb
    .c    C source
    .cc   C++ source
+   .cp   C++ source
+   .cpp  C++ source
+   .CPP  C++ source
+   .cxx  C++ source
+   .c++  C++ source
    .C    C++ source
-   .cpp  C++ source
    .f    Fortran source (fixed form)
    .F    Fortran source (fixed form)
    .f90  Fortran source (free form)
--- a/src/mkoctfile.in.cc	Sat Jul 02 15:16:51 2016 -0700
+++ b/src/mkoctfile.in.cc	Sat Jul 02 20:29:39 2016 -0700
@@ -318,8 +318,12 @@
 "\n"
 "                            .c    C source\n"
 "                            .cc   C++ source\n"
+"                            .cp   C++ source\n"
+"                            .cpp  C++ source\n"
+"                            .CPP  C++ source\n"
+"                            .cxx  C++ source\n"
+"                            .c++  C++ source\n"
 "                            .C    C++ source\n"
-"                            .cpp  C++ source\n"
 "                            .f    Fortran source (fixed form)\n"
 "                            .F    Fortran source (fixed form)\n"
 "                            .f90  Fortran source (free form)\n"
@@ -434,8 +438,10 @@
           file = arg;
           cfiles.push_back (file);
         }
-      else if (ends_with (arg, ".cc") || ends_with (arg, ".C")
-               || ends_with (arg, ".cpp"))
+      else if (ends_with (arg, ".cc") || ends_with (arg, ".cp")
+               || ends_with (arg, ".cpp") || ends_with (arg, ".CPP")
+               || ends_with (arg, ".cxx") || ends_with (arg, ".c++")
+               || ends_with (arg, ".C"))
         {
           file = arg;
           ccfiles.push_back (file);
@@ -639,7 +645,7 @@
           std::string f = *it, dfile = basename (f, true) + ".d", line;
 
           octave_unlink_wrapper (dfile.c_str ());
-          std::string cmd = vars["CC"] + " "
+          std::string cmd = vars["CXX"] + " "
                             + vars["DEPEND_FLAGS"] + " "
                             + vars["CPPFLAGS"] + " "
                             + vars["ALL_CXXFLAGS"] + " "