Mercurial > octave-nkf
annotate mkoctfile.cc.in @ 12174:db1f49eaba6b
whitespace fixes
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 26 Jan 2011 23:49:42 -0500 |
parents | 1140bd9f9b21 |
children |
rev | line source |
---|---|
8920 | 1 /* |
2 | |
11523 | 3 Copyright (C) 2008-2011 Michael Goffioul |
8920 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
9 Free Software Foundation; either version 3 of the License, or (at your | |
10 option) any later version. | |
11 | |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with Octave; see the file COPYING. If not, see | |
19 <http://www.gnu.org/licenses/>. | |
20 | |
21 */ | |
22 | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
23 #if defined (HAVE_CONFIG_H) |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
24 #include <config.h> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
25 #endif |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
26 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
27 #include <string> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
28 #include <map> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
29 #include <list> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
30 #include <algorithm> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
31 #include <iostream> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
32 #include <fstream> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
33 #include <vector> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
34 #include <cstdlib> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
35 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
36 #if defined (__WIN32__) && ! defined (_POSIX_VERSION) |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
37 #include <windows.h> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
38 #ifdef _MSC_VER |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
39 #define popen _popen |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
40 #define pclose _pclose |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
41 #endif |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
42 #endif |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
43 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
44 using namespace std; |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
45 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
46 static bool initialized = false; |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
47 static map<string,string> vars; |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
48 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
49 static string OCTAVE_VERSION = %OCTAVE_CONF_VERSION%; |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
50 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
51 static std::string |
8332 | 52 substitute_prefix (const std::string& s, const std::string& prefix, |
12174 | 53 const std::string& new_prefix) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
54 { |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
55 std::string retval = s; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
56 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
57 if (!prefix.empty () && new_prefix != prefix) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
58 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
59 int len = prefix.length (); |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
60 if (retval.find (prefix) == 0) |
12174 | 61 retval.replace (0, len, new_prefix); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
62 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
63 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
64 #if defined (__WIN32__) && ! defined (_POSIX_VERSION) |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
65 std::replace (retval.begin (), retval.end (), '/', '\\'); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
66 #endif |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
67 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
68 return retval; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
69 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
70 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
71 static string |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
72 get_line (FILE *fp) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
73 { |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
74 static vector<char> buf (100); |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
75 int idx = 0; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
76 char c; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
77 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
78 while (true) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
79 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
80 c = static_cast<char> (fgetc (fp)); |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
81 if (c == '\n' || c == EOF) |
12174 | 82 break; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
83 if (buf.size () <= idx) |
12174 | 84 buf.resize (buf.size () + 100); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
85 buf[idx++] = c; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
86 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
87 if (idx == 0) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
88 return string (""); |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
89 else |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
90 return string (&buf[0], idx); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
91 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
92 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
93 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
94 static string |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
95 get_variable (const char *name, const string& defval) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
96 { |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
97 const char *val = getenv (name); |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
98 if (val == NULL || val[0] == '\0') |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
99 return defval; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
100 else |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
101 return string (val); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
102 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
103 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
104 static string |
8332 | 105 quote_path (const string& s) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
106 { |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
107 if (s.find (' ') != string::npos && s[0] != '"') |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
108 return "\"" + s + "\""; |
8332 | 109 else |
110 return s; | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
111 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
112 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
113 static void |
8332 | 114 initialize (void) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
115 { |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
116 if (initialized) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
117 return; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
118 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
119 initialized = true; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
120 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
121 vars["OCTAVE_HOME"] = get_variable ("OCTAVE_HOME", ""); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
122 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
123 #if defined (__WIN32__) && ! defined (_POSIX_VERSION) |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
124 int n = 1024; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
125 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
126 std::string bin_dir (n, '\0'); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
127 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
128 while (true) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
129 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
130 int status = GetModuleFileName (0, &bin_dir[0], n); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
131 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
132 if (status < n) |
12174 | 133 { |
134 bin_dir.resize (status); | |
135 break; | |
136 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
137 else |
12174 | 138 { |
139 n *= 2; | |
140 bin_dir.resize (n); | |
141 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
142 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
143 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
144 if (! bin_dir.empty ()) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
145 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
146 size_t pos = bin_dir.rfind ("\\bin\\"); |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
147 |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
148 if (pos != string::npos) |
12174 | 149 vars["OCTAVE_HOME"] = bin_dir.substr (0, pos); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
150 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
151 #endif |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
152 |
8332 | 153 vars["SED"] = get_variable ("SED", %OCTAVE_CONF_SED%); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
154 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
155 vars["OCTAVE_PREFIX"] = %OCTAVE_CONF_PREFIX%; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
156 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
157 std::string DEFAULT_OCTINCLUDEDIR = %OCTAVE_CONF_OCTINCLUDEDIR%; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
158 std::string DEFAULT_INCLUDEDIR = %OCTAVE_CONF_INCLUDEDIR%; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
159 std::string DEFAULT_LIBDIR = %OCTAVE_CONF_LIBDIR%; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
160 std::string DEFAULT_OCTLIBDIR = %OCTAVE_CONF_OCTLIBDIR%; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
161 |
8332 | 162 if (! vars["OCTAVE_HOME"].empty ()) |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
163 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
164 DEFAULT_OCTINCLUDEDIR |
12174 | 165 = substitute_prefix (DEFAULT_OCTINCLUDEDIR, vars["OCTAVE_PREFIX"], |
166 vars["OCTAVE_HOME"]); | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
167 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
168 DEFAULT_INCLUDEDIR |
12174 | 169 = substitute_prefix (DEFAULT_INCLUDEDIR, vars["OCTAVE_PREFIX"], |
170 vars["OCTAVE_HOME"]); | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
171 |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
172 DEFAULT_LIBDIR |
12174 | 173 = substitute_prefix (DEFAULT_LIBDIR, vars["OCTAVE_PREFIX"], |
174 vars["OCTAVE_HOME"]); | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
175 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
176 DEFAULT_OCTLIBDIR |
12174 | 177 = substitute_prefix (DEFAULT_OCTLIBDIR, vars["OCTAVE_PREFIX"], |
178 vars["OCTAVE_HOME"]); | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
179 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
180 |
8332 | 181 vars["OCTINCLUDEDIR"] = get_variable ("OCTINCLUDEDIR", DEFAULT_OCTINCLUDEDIR); |
182 vars["INCLUDEDIR"] = get_variable ("INCLUDEDIR", DEFAULT_INCLUDEDIR); | |
183 vars["LIBDIR"] = get_variable ("LIBDIR", DEFAULT_LIBDIR); | |
184 vars["OCTLIBDIR"] = get_variable ("OCTLIBDIR", DEFAULT_OCTLIBDIR); | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
185 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
186 #if defined (__WIN32__) && ! defined (_POSIX_VERSION) |
9794
0d4613a736e9
convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents:
9565
diff
changeset
|
187 std::string DEFAULT_INCFLAGS |
0d4613a736e9
convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents:
9565
diff
changeset
|
188 = "-I" + quote_path (vars["OCTINCLUDEDIR"] + "\\..") |
0d4613a736e9
convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents:
9565
diff
changeset
|
189 + " -I" + quote_path (vars["OCTINCLUDEDIR"]); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
190 #else |
9794
0d4613a736e9
convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents:
9565
diff
changeset
|
191 std::string DEFAULT_INCFLAGS |
0d4613a736e9
convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents:
9565
diff
changeset
|
192 = "-I" + quote_path (vars["OCTINCLUDEDIR"] + "/..") |
0d4613a736e9
convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents:
9565
diff
changeset
|
193 + " -I" + quote_path (vars["OCTINCLUDEDIR"]); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
194 #endif |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
195 if (vars["INCLUDEDIR"] != "/usr/include") |
8332 | 196 DEFAULT_INCFLAGS += " -I" + quote_path (vars["INCLUDEDIR"]); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
197 |
8332 | 198 std::string DEFAULT_LFLAGS = "-L" + quote_path (vars["OCTLIBDIR"]); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
199 if (vars["LIBDIR"] != "/usr/lib") |
8332 | 200 DEFAULT_LFLAGS += " -L" + quote_path (vars["LIBDIR"]); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
201 |
8332 | 202 vars["CPPFLAGS"] = get_variable ("CPPFLAGS", %OCTAVE_CONF_CPPFLAGS%); |
203 vars["INCFLAGS"] = get_variable ("INCFLAGS", DEFAULT_INCFLAGS); | |
204 vars["F77"] = get_variable ("F77", %OCTAVE_CONF_F77%); | |
205 vars["FFLAGS"] = get_variable ("FFLAGS", %OCTAVE_CONF_FFLAGS%); | |
206 vars["FPICFLAG"] = get_variable ("FPICFLAG", %OCTAVE_CONF_FPICFLAG%); | |
207 vars["CC"] = get_variable ("CC", %OCTAVE_CONF_CC%); | |
208 vars["CFLAGS"] = get_variable ("CFLAGS", %OCTAVE_CONF_CFLAGS%); | |
209 vars["CPICFLAG"] = get_variable ("CPICFLAG", %OCTAVE_CONF_CPICFLAG%); | |
210 vars["CXX"] = get_variable ("CXX", %OCTAVE_CONF_CXX%); | |
211 vars["CXXFLAGS"] = get_variable ("CXXFLAGS", %OCTAVE_CONF_CXXFLAGS%); | |
212 vars["CXXPICFLAG"] = get_variable ("CXXPICFLAG", %OCTAVE_CONF_CXXPICFLAG%); | |
213 vars["XTRA_CFLAGS"] = get_variable ("XTRA_CFLAGS", %OCTAVE_CONF_XTRA_CFLAGS%); | |
214 vars["XTRA_CXXFLAGS"] = get_variable ("XTRA_CXXFLAGS", %OCTAVE_CONF_XTRA_CXXFLAGS%); | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
215 |
8332 | 216 vars["DEPEND_FLAGS"] = get_variable ("DEPEND_FLAGS", %OCTAVE_CONF_DEPEND_FLAGS%); |
217 vars["DEPEND_EXTRA_SED_PATTERN"] = get_variable ("DEPEND_EXTRA_SED_PATTERN", %OCTAVE_CONF_DEPEND_EXTRA_SED_PATTERN%); | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
218 |
8332 | 219 vars["DL_LD"] = get_variable ("DL_LD", %OCTAVE_CONF_DL_LD%); |
220 vars["DL_LDFLAGS"] = get_variable ("DL_LDFLAGS", %OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS%); | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
221 |
8332 | 222 vars["RLD_FLAG"] = get_variable ("RLD_FLAG", %OCTAVE_CONF_RLD_FLAG%); |
223 vars["RDYNAMIC_FLAG"] = get_variable ("RDYNAMIC_FLAG", %OCTAVE_CONF_RDYNAMIC_FLAG%); | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
224 vars["LIBOCTAVE"] = "-loctave"; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
225 vars["LIBOCTINTERP"] = "-loctinterp"; |
9515 | 226 vars["READLINE_LIBS"] = "-lreadline"; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
227 vars["LIBCRUFT"] = "-lcruft"; |
11450
5eb10763069f
substitute and use LAPACK_LIBS in mkoctfile script
John W. Eaton <jwe@octave.org>
parents:
11251
diff
changeset
|
228 vars["LAPACK_LIBS"] = get_variable ("LAPACK_LIBS", %OCTAVE_CONF_LAPACK_LIBS%); |
8332 | 229 vars["BLAS_LIBS"] = get_variable ("BLAS_LIBS", %OCTAVE_CONF_BLAS_LIBS%); |
9538
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
230 vars["FFTW3_LDFLAGS"] = get_variable ("FFTW3_LDFLAGS", %OCTAVE_CONF_FFTW3_LDFLAGS%); |
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
231 vars["FFTW3_LIBS"] = get_variable ("FFTW3_LIBS", %OCTAVE_CONF_FFTW3_LIBS%); |
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
232 vars["FFTW3F_LDFLAGS"] = get_variable ("FFTW3F_LDFLAGS", %OCTAVE_CONF_FFTW3F_LDFLAGS%); |
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
233 vars["FFTW3F_LIBS"] = get_variable ("FFTW3F_LIBS", %OCTAVE_CONF_FFTW3F_LIBS%); |
8332 | 234 vars["LIBS"] = get_variable ("LIBS", %OCTAVE_CONF_LIBS%); |
235 vars["FLIBS"] = get_variable ("FLIBS", %OCTAVE_CONF_FLIBS%); | |
236 vars["LD_CXX"] = get_variable ("LD_CXX", %OCTAVE_CONF_LD_CXX%); | |
237 vars["LDFLAGS"] = get_variable ("LDFLAGS", %OCTAVE_CONF_LDFLAGS%); | |
238 vars["LD_STATIC_FLAG"] = get_variable ("LD_STATIC_FLAG", %OCTAVE_CONF_LD_STATIC_FLAG%); | |
239 vars["LFLAGS"] = get_variable ("LFLAGS", DEFAULT_LFLAGS); | |
11251
77989197a3c7
[mq]: mkoctfile_variable
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10721
diff
changeset
|
240 vars["F77_INTEGER8_FLAG"] = get_variable ("F77_INTEGER8_FLAG", %OCTAVE_CONF_F77_INTEGER_8_FLAG%); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
241 |
10721
4906ccf5d95e
use F77_INTEGER8_FLAG in BLAS checking as well as ALL_FFLAGS in mkoctfile
Jaroslav Hajek <highegg@gmail.com>
parents:
9957
diff
changeset
|
242 vars["ALL_FFLAGS"] = vars["FFLAGS"] + " " + vars["F77_INTEGER8_FLAG"]; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
243 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
244 vars["ALL_CFLAGS"] = vars["INCFLAGS"] + " " + vars["XTRA_CFLAGS"] |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
245 + " " + vars["CFLAGS"]; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
246 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
247 vars["ALL_CXXFLAGS"] = vars["INCFLAGS"] + " " + vars["XTRA_CXXFLAGS"] |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
248 + " " + vars["CXXFLAGS"]; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
249 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
250 vars["ALL_LDFLAGS"] = vars["LD_STATIC_FLAG"] + " " + vars["CPICFLAG"] |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
251 + " " + vars["LDFLAGS"]; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
252 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
253 vars["OCTAVE_LIBS"] = vars["LIBOCTINTERP"] + " " + vars["LIBOCTAVE"] |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
254 + " " + vars["SPECIAL_MATH_LIB"] + " " + vars["LIBCRUFT"]; |
9538
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
255 |
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
256 vars["FFTW_LIBS"] = vars["FFTW3_LDFLAGS"] + " " + vars["FFTW3_LIBS"] |
9565
fe57b638e48c
adapt octave-bug.cc.in and mkoctfile.cc.in to recent configure changes
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents:
9538
diff
changeset
|
257 + " " + vars["FFTW3F_LDFLAGS"] + " " + vars["FFTW3F_LIBS"]; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
258 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
259 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
260 static string usage_msg = "usage: mkoctfile [options] file ..."; |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
261 static string version_msg = "mkoctfile, version " + OCTAVE_VERSION; |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
262 static bool debug = false; |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
263 static string help_msg = |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
264 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
265 "Options:\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
266 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
267 " -h, -?, --help Print this message.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
268 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
269 " -IDIR Add -IDIR to compile commands.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
270 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
271 " -idirafter DIR Add -idirafter DIR to compile commands.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
272 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
273 " -DDEF Add -DDEF to compile commands.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
274 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
275 " -lLIB Add library LIB to link command.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
276 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
277 " -LDIR Add -LDIR to link command.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
278 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
279 " -M, --depend Generate dependency files (.d) for C and C++\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
280 " source files.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
281 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
282 " -RDIR Add -RDIR to link command.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
283 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
284 " -Wl,... Pass flags though the linker like -Wl,-rpath=...\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
285 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
286 " -W... Pass flags though the compiler like -Wa,OPTION.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
287 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
288 " -c, --compile Compile, but do not link.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
289 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
290 " -o FILE, --output FILE Output file name. Default extension is .oct\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
291 " (or .mex if --mex is specified) unless linking\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
292 " a stand-alone executable.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
293 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
294 " -g Enable debugging options for compilers.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
295 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
296 " -p VAR, --print VAR Print configuration variable VAR. Recognized\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
297 " variables are:\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
298 "\n" |
12174 | 299 " ALL_CFLAGS FLIBS\n" |
300 " ALL_CXXFLAGS FPICFLAG\n" | |
301 " ALL_FFLAGS INCFLAGS\n" | |
302 " ALL_LDFLAGS LAPACK_LIBS\n" | |
303 " BLAS_LIBS LDFLAGS\n" | |
304 " CC LD_CXX\n" | |
305 " CFLAGS LD_STATIC_FLAG\n" | |
306 " CPICFLAG LFLAGS\n" | |
307 " CPPFLAGS LIBCRUFT\n" | |
308 " CXX LIBOCTAVE\n" | |
309 " CXXFLAGS LIBOCTINTERP\n" | |
310 " CXXPICFLAG LIBS\n" | |
311 " DEPEND_EXTRA_SED_PATTERN OCTAVE_LIBS\n" | |
312 " DEPEND_FLAGS RDYNAMIC_FLAG\n" | |
313 " DL_LD READLINE_LIBS\n" | |
314 " DL_LDFLAGS RLD_FLAG\n" | |
315 " F77 SED\n" | |
316 " FFLAGS XTRA_CFLAGS\n" | |
317 " FFTW_LIBS XTRA_CXXFLAGS\n" | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
318 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
319 " --link-stand-alone Link a stand-alone executable file.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
320 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
321 " --mex Assume we are creating a MEX file. Set the\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
322 " default output extension to \".mex\".\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
323 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
324 " -s, --strip Strip output file.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
325 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
326 " -v, --verbose Echo commands as they are executed.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
327 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
328 " FILE Compile or link FILE. Recognized file types are:\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
329 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
330 " .c C source\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
331 " .cc C++ source\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
332 " .C C++ source\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
333 " .cpp C++ source\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
334 " .f Fortran source (fixed form)\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
335 " .F Fortran source (fixed form)\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
336 " .f90 Fortran source (free form)\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
337 " .F90 Fortran source (free form)\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
338 " .o object file\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
339 " .a library file\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
340 #ifdef _MSC_VER |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
341 " .lib library file\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
342 #endif |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
343 "\n"; |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
344 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
345 static string |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
346 basename (const string& s, bool strip_path = false) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
347 { |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
348 size_t pos = s.rfind ('.'); |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
349 string retval; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
350 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
351 if (pos == string::npos) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
352 retval = s; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
353 else |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
354 retval = s.substr (0, pos); |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
355 if (strip_path) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
356 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
357 size_t p1 = retval.rfind ('/'), p2 = retval.rfind ('\\'); |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
358 pos = (p1 != string::npos && p2 != string::npos |
12174 | 359 ? max (p1, p2) : (p2 != string::npos ? p2 : p1)); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
360 if (pos != string::npos) |
12174 | 361 retval = retval.substr (0, pos); |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
362 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
363 return retval; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
364 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
365 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
366 inline bool |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
367 starts_with (const string& s, const string& prefix) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
368 { |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
369 return (s.length () >= prefix.length () && s.find (prefix) == 0); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
370 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
371 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
372 inline bool |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
373 ends_with (const string& s, const string& suffix) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
374 { |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
375 return (s.length () >= suffix.length () |
12174 | 376 && s.rfind (suffix) == s.length () - suffix.length ()); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
377 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
378 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
379 static int |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
380 run_command (const string& cmd) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
381 { |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
382 if (debug) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
383 cout << cmd << endl; |
8332 | 384 return system (cmd.c_str ()); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
385 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
386 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
387 int |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
388 main (int argc, char **argv) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
389 { |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
390 initialize (); |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
391 |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
392 string file, output_option; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
393 list<string> cfiles, ccfiles, f77files; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
394 int result = 0; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
395 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
396 string objfiles = ""; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
397 string libfiles = ""; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
398 string octfile = ""; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
399 string outputfile = ""; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
400 string incflags = ""; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
401 string defs = ""; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
402 string ldflags = ""; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
403 string pass_on_options = ""; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
404 bool strip = false; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
405 bool no_oct_file_strip_on_this_platform = %NO_OCT_FILE_STRIP%; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
406 bool link = true; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
407 bool link_stand_alone = false; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
408 string output_ext = ".oct"; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
409 bool depend = false; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
410 bool compile = true; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
411 |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
412 if (argc == 1) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
413 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
414 cout << usage_msg << endl; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
415 return 1; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
416 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
417 |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
418 if (argc == 2 && (!strcmp (argv[1], "-v") |
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
419 || !strcmp (argv[1], "-version") |
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
420 || !strcmp (argv[1], "--version"))) |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
421 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
422 cout << version_msg << endl; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
423 return 0; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
424 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
425 |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
426 for (int i = 1; i < argc; i++) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
427 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
428 string arg = argv[i]; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
429 size_t len = arg.length (); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
430 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
431 if (ends_with (arg, ".c")) |
12174 | 432 { |
433 file = arg; | |
434 cfiles.push_back (file); | |
435 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
436 else if (ends_with (arg, ".cc") || ends_with (arg, ".C") |
12174 | 437 || ends_with (arg, ".cpp")) |
438 { | |
439 file = arg; | |
440 ccfiles.push_back (file); | |
441 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
442 else if (ends_with (arg, ".f") || ends_with (arg, ".F") |
12174 | 443 || ends_with (arg, "f90") || ends_with (arg, ".F90")) |
444 { | |
445 file = arg; | |
446 f77files.push_back (file); | |
447 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
448 else if (ends_with (arg, ".o") || ends_with (arg, ".obj")) |
12174 | 449 { |
450 file = arg; | |
451 objfiles += (" " + quote_path (arg)); | |
452 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
453 else if (ends_with (arg, ".lib") || ends_with (arg, ".a")) |
12174 | 454 { |
455 file = arg; | |
456 libfiles += (" " + quote_path (arg)); | |
457 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
458 else if (arg == "-d" || arg == "-debug" || arg == "--debug" |
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
459 || arg == "-v" || arg == "-verbose" || arg == "--verbose") |
12174 | 460 { |
461 debug = true; | |
462 if (vars["CC"] == "cc-msvc") | |
463 vars["CC"] += " -d"; | |
464 if (vars["CXX"] == "cc-msvc") | |
465 vars["CXX"] += " -d"; | |
466 if (vars["DL_LD"] == "cc-msvc") | |
467 vars["DL_LD"] += " -d"; | |
468 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
469 else if (arg == "-h" || arg == "-?" || arg == "-help" || arg == "--help") |
12174 | 470 { |
471 cout << usage_msg << endl; | |
472 cout << help_msg << endl; | |
473 return 0; | |
474 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
475 else if (starts_with (arg, "-I")) |
12174 | 476 { |
477 incflags += (" " + quote_path (arg)); | |
478 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
479 else if (arg == "-idirafter") |
12174 | 480 { |
481 if (i < argc-1) | |
482 { | |
483 arg = argv[++i]; | |
484 incflags += (" -idirafter " + arg); | |
485 } | |
486 else | |
487 cerr << "mkoctfile: include directory name missing" << endl; | |
488 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
489 else if (starts_with (arg, "-D")) |
12174 | 490 { |
491 defs += (" " + arg); | |
492 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
493 else if (starts_with (arg, "-Wl,") || starts_with (arg, "-l") |
12174 | 494 || starts_with (arg, "-L") || starts_with (arg, "-R")) |
495 { | |
496 ldflags += (" " + arg); | |
497 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
498 else if (arg == "-M" || arg == "-depend" || arg == "--depend") |
12174 | 499 { |
500 depend = true; | |
501 compile = false; | |
502 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
503 else if (arg == "-o" || arg == "-output" || arg == "--output") |
12174 | 504 { |
505 if (i < argc-1) | |
506 { | |
507 arg = argv[++i]; | |
508 outputfile = arg; | |
509 } | |
510 else | |
511 cerr << "mkoctfile: output file name missing" << endl; | |
512 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
513 else if (arg == "-p" || arg == "-print" || arg == "--print") |
12174 | 514 { |
515 if (i < argc-1) | |
516 { | |
517 arg = argv[++i]; | |
518 cout << vars[arg] << endl; | |
519 return 0; | |
520 } | |
521 else | |
522 cerr << "mkoctfile: --print requires argument" << endl; | |
523 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
524 else if (arg == "-s" || arg == "-strip" || arg == "--strip") |
12174 | 525 { |
526 if (no_oct_file_strip_on_this_platform) | |
527 cerr << "mkoctfile: stripping disabled on this platform" << endl; | |
528 else | |
529 strip = true; | |
530 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
531 else if (arg == "-c" || arg == "-compile" || arg == "--compile") |
12174 | 532 { |
533 link = false; | |
534 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
535 else if (arg == "-g") |
12174 | 536 { |
537 vars["ALL_CFLAGS"] += " -g"; | |
538 vars["ALL_CXXFLAGS"] += " -g"; | |
539 vars["ALL_FFLAGS"] += " -g"; | |
540 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
541 else if (arg == "-link-stand-alone" || arg == "--link-stand-alone") |
12174 | 542 { |
543 link_stand_alone = true; | |
544 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
545 else if (arg == "-mex" || arg == "--mex") |
12174 | 546 { |
547 incflags += " -I."; | |
9303
adf676387922
properly #ifdef MSVC linker specific flags
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents:
9245
diff
changeset
|
548 #ifdef _MSC_VER |
12174 | 549 ldflags += " -Wl,-export:mexFunction"; |
9303
adf676387922
properly #ifdef MSVC linker specific flags
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents:
9245
diff
changeset
|
550 #endif |
12174 | 551 output_ext = ".mex"; |
552 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
553 else if (starts_with (arg, "-W")) |
12174 | 554 { |
555 pass_on_options += (" " + arg); | |
556 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
557 else |
12174 | 558 { |
559 cerr << "mkoctfile: unrecognized argument " << arg; | |
560 return 1; | |
561 } | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
562 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
563 if (!file.empty () && octfile.empty ()) |
12174 | 564 octfile = file; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
565 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
566 |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
567 if (link_stand_alone) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
568 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
569 if (!outputfile.empty ()) |
12174 | 570 output_option = "-o " + outputfile; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
571 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
572 else |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
573 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
574 if (!outputfile.empty ()) |
9957
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
575 { |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
576 octfile = outputfile; |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
577 size_t len = octfile.length (); |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
578 size_t len_ext = output_ext.length (); |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
579 if (octfile.substr (len-len_ext) != output_ext) |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
580 octfile += output_ext; |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
581 } |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
582 else |
12174 | 583 octfile = basename (octfile, true) + output_ext; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
584 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
585 |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
586 list<string>::const_iterator it; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
587 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
588 if (depend) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
589 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
590 for (it = cfiles.begin (); it != cfiles.end (); ++it) |
12174 | 591 { |
592 string f = *it, dfile = basename (f, true) + ".d", line; | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
593 |
12174 | 594 unlink (dfile.c_str ()); |
595 string cmd = vars["CC"] + " " + vars["DEPEND_FLAGS"] + " " | |
596 + vars["CPPFLAGS"] + " " + vars["ALL_CFLAGS"] + " " | |
597 + incflags + " " + defs + " " + quote_path (f); | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
598 |
12174 | 599 FILE *fd = popen (cmd.c_str (), "r"); |
600 ofstream fo (dfile.c_str ()); | |
601 int pos; | |
602 while (!feof (fd)) | |
603 { | |
604 line = get_line (fd); | |
605 if ((pos = line.rfind (".o:")) != string::npos) | |
606 { | |
607 int spos = line.rfind ('/', pos); | |
608 string ofile = (spos == string::npos ? line.substr (0, pos+2) : line.substr (spos+1, pos-spos+1)); | |
609 fo << "pic/" << ofile << " " << ofile << " " << dfile << line.substr (pos) << endl; | |
610 } | |
611 else | |
612 fo << line << endl; | |
613 } | |
614 pclose (fd); | |
615 fo.close (); | |
616 } | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
617 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
618 for (it = ccfiles.begin (); it != ccfiles.end (); ++it) |
12174 | 619 { |
620 string f = *it, dfile = basename (f, true) + ".d", line; | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
621 |
12174 | 622 unlink (dfile.c_str ()); |
623 string cmd = vars["CC"] + " " + vars["DEPEND_FLAGS"] + " " | |
624 + vars["CPPFLAGS"] + " " + vars["ALL_CXXFLAGS"] + " " | |
625 + incflags + " " + defs + " " + quote_path (f); | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
626 |
12174 | 627 FILE *fd = popen (cmd.c_str (), "r"); |
628 ofstream fo (dfile.c_str ()); | |
629 int pos; | |
630 while (!feof (fd)) | |
631 { | |
632 line = get_line (fd); | |
633 if ((pos = line.rfind (".o:")) != string::npos) | |
634 { | |
635 int spos = line.rfind ('/', pos); | |
636 string ofile = (spos == string::npos ? line.substr (0, pos+2) : line.substr (spos+1, pos-spos+1)); | |
637 fo << "pic/" << ofile << " " << ofile << " " << dfile << line.substr (pos+2) << endl; | |
638 } | |
639 else | |
640 fo << line << endl; | |
641 } | |
642 pclose (fd); | |
643 fo.close (); | |
644 } | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
645 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
646 return 0; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
647 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
648 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
649 for (it = f77files.begin (); it != f77files.end (); ++it) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
650 { |
9956
f26a33e21db9
mkoctfile: when compiling files in subdirectories, place object files in current directory by default
John W. Eaton <jwe@octave.org>
parents:
9955
diff
changeset
|
651 string f = *it, b = basename (f, true); |
9187
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
652 if (!vars["F77"].empty ()) |
12174 | 653 { |
654 string o; | |
655 if (!outputfile.empty ()) | |
656 { | |
657 if (link) | |
658 o = b + ".o"; | |
659 else | |
660 o = outputfile; | |
661 } | |
662 else | |
663 o = b + ".o"; | |
664 objfiles += (" " + o); | |
665 string cmd = vars["F77"] + " -c " + vars["FPICFLAG"] + " " | |
666 + vars["ALL_FFLAGS"] + " " + incflags + " " + defs + " " | |
667 + pass_on_options + " " + f + " -o " + o; | |
668 result = run_command (cmd); | |
669 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
670 else |
12174 | 671 { |
672 cerr << "mkoctfile: no way to compile Fortran file " << f << endl; | |
673 return 1; | |
674 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
675 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
676 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
677 for (it = cfiles.begin (); it != cfiles.end (); ++it) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
678 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
679 string f = *it; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
680 if (!vars["CC"].empty ()) |
12174 | 681 { |
682 string b = basename (f, true), o; | |
683 if (!outputfile.empty ()) | |
684 { | |
685 if (link) | |
686 o = b + ".o"; | |
687 else | |
688 o = outputfile; | |
689 } | |
690 else | |
691 o = b + ".o"; | |
692 objfiles += (" " + o); | |
693 string cmd = vars["CC"] + " -c " + vars["CPPFLAGS"] + " " | |
694 + vars["CPICFLAG"] + " " + vars["ALL_CFLAGS"] + " " | |
695 + pass_on_options + " " + incflags + " " + defs + " " | |
696 + quote_path (f) + " -o " + quote_path (o); | |
697 result = run_command (cmd); | |
698 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
699 else |
12174 | 700 { |
701 cerr << "mkoctfile: no way to compile C file " << f << endl; | |
702 return 1; | |
703 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
704 } |
12174 | 705 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
706 for (it = ccfiles.begin (); it != ccfiles.end (); ++it) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
707 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
708 string f = *it; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
709 if (!vars["CXX"].empty ()) |
12174 | 710 { |
711 string b = basename (f, true), o; | |
712 if (!outputfile.empty ()) | |
713 { | |
714 if (link) | |
715 o = b + ".o"; | |
716 else | |
717 o = outputfile; | |
718 } | |
719 else | |
720 o = b + ".o"; | |
721 objfiles += (" " + o); | |
722 string cmd = vars["CXX"] + " -c " + vars["CPPFLAGS"] + " " | |
723 + vars["CXXPICFLAG"] + " " + vars["ALL_CXXFLAGS"] + " " | |
724 + pass_on_options + " " + incflags + " " + defs + " " | |
725 + quote_path (f) + " -o " + quote_path (o); | |
726 result = run_command (cmd); | |
727 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
728 else |
12174 | 729 { |
730 cerr << "mkoctfile: no way to compile C++ file " << f << endl; | |
731 return 1; | |
732 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
733 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
734 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
735 if (link && !objfiles.empty ()) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
736 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
737 if (link_stand_alone) |
12174 | 738 { |
739 if (!vars["LD_CXX"].empty ()) | |
740 { | |
741 string cmd = vars["LD_CXX"] + " " + vars["CPPFLAGS"] + " " | |
742 + vars["ALL_CXXFLAGS"] + " " + vars["RDYNAMIC_FLAG"] | |
743 + " " + vars["ALL_LDFLAGS"] + " " + pass_on_options | |
744 + " " + output_option + " " + objfiles + " " + libfiles | |
745 + " " + ldflags + " " + vars["LFLAGS"] + " " | |
746 + vars["RLD_FLAG"] + " " + vars["OCTAVE_LIBS"] + " " | |
747 + vars["LAPACK_LIBS"] + " " + vars["BLAS_LIBS"] + " " | |
11450
5eb10763069f
substitute and use LAPACK_LIBS in mkoctfile script
John W. Eaton <jwe@octave.org>
parents:
11251
diff
changeset
|
748 + vars["FFTW_LIBS"] + " " + vars["READLINE_LIBS"] + " " |
5eb10763069f
substitute and use LAPACK_LIBS in mkoctfile script
John W. Eaton <jwe@octave.org>
parents:
11251
diff
changeset
|
749 + vars["LIBS"] + " " + vars["FLIBS"]; |
12174 | 750 result = run_command (cmd); |
751 } | |
752 else | |
753 { | |
754 cerr << "mkoctfile: no way to link stand-alone executable file" | |
755 << endl; | |
756 return 1; | |
757 } | |
758 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
759 else |
12174 | 760 { |
761 string LINK_DEPS = vars["LFLAGS"] + " " + vars["OCTAVE_LIBS"] | |
762 + " " + vars["LDFLAGS"] + " " + vars["BLAS_LIBS"] + " " | |
763 + vars["FFTW_LIBS"] + " " + vars["LIBS"] + " " + vars["FLIBS"]; | |
764 string cmd = vars["DL_LD"] + " " + vars["DL_LDFLAGS"] + " " | |
765 + pass_on_options + " -o " + octfile + " " + objfiles + " " | |
766 + libfiles + " " + ldflags + " " + LINK_DEPS; | |
767 result = run_command (cmd); | |
768 } | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
769 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
770 if (strip) |
12174 | 771 { |
772 string cmd = "strip " + octfile; | |
773 result = run_command (cmd); | |
774 } | |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
775 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
776 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
777 return result; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
778 } |