Mercurial > octave
annotate src/mkoctfile.in.cc @ 26853:b0f359a5ad35 stable
mkoctfile: use the TMPDIR environment variable if set (bug #55814)
* mkoctfile.in.cc (get_temp_directory): Use the standard TMPDIR environment
variable when writing temporary files on all systems. Do not use the TMP
environment variable on Unixy systems, only on Windows.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Tue, 05 Mar 2019 17:53:30 -0800 |
parents | ab5cc8da283c |
children | db687716fed6 |
rev | line source |
---|---|
18360
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18349
diff
changeset
|
1 // %NO_EDIT_WARNING% |
8920 | 2 /* |
3 | |
26376
00f796120a6d
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
26370
diff
changeset
|
4 Copyright (C) 2008-2019 Michael Goffioul |
8920 | 5 |
6 This file is part of Octave. | |
7 | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23807
diff
changeset
|
8 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22599
diff
changeset
|
9 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23807
diff
changeset
|
10 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22599
diff
changeset
|
11 (at your option) any later version. |
8920 | 12 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22599
diff
changeset
|
13 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22599
diff
changeset
|
14 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22599
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22599
diff
changeset
|
16 GNU General Public License for more details. |
8920 | 17 |
18 You should have received a copy of the GNU General Public License | |
19 along with Octave; see the file COPYING. If not, see | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23807
diff
changeset
|
20 <https://www.gnu.org/licenses/>. |
8920 | 21 |
22 */ | |
23 | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
24 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21202
diff
changeset
|
25 # include "config.h" |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
26 #endif |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
27 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
28 #include <string> |
15299
8bd5c490b787
Fix mex compilation with subdirs on Windows platforms (bug #37122)
Rik <rik@octave.org>
parents:
15271
diff
changeset
|
29 #include <cstring> |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
30 #include <map> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
31 #include <list> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
32 #include <algorithm> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
33 #include <iostream> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
34 #include <fstream> |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
35 #include <sstream> |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
36 #include <vector> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
37 #include <cstdlib> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
38 |
25504
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
39 // Programming note: The CROSS macro here refers to building a |
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
40 // cross-compiler aware version of mkoctfile that can be used to cross |
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
41 // compile .oct file for Windows builds of Octave, not that mkoctfile |
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
42 // itself is being cross compiled. |
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
43 // |
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
44 // We don't use the wrapper and gnulib functions when we are building |
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
45 // with CROSS defined. This configuration is only expected to work on |
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
46 // modern systems that should not need to have gnulib to fix POSIX |
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
47 // portability problems. So we just assume a working POSIX system when |
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
48 // CROSS is defined. |
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
49 |
21961
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
50 #if defined (CROSS) |
25503
ec2492a2af6a
* mkoctfile.in.cc [CROSS]: Include <fcntl.h> for O_BINARY.
John W. Eaton <jwe@octave.org>
parents:
25497
diff
changeset
|
51 # include <stdlib.h> |
21961
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
52 # include <sys/types.h> |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
53 # include <sys/wait.h> |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
54 # include <unistd.h> |
23801
9d67bd90681b
cross tools: define OCTAVE_UNUSED if not defined
John D <john.donoghue@ieee.org>
parents:
23757
diff
changeset
|
55 # ifndef OCTAVE_UNUSED |
9d67bd90681b
cross tools: define OCTAVE_UNUSED if not defined
John D <john.donoghue@ieee.org>
parents:
23757
diff
changeset
|
56 # define OCTAVE_UNUSED |
9d67bd90681b
cross tools: define OCTAVE_UNUSED if not defined
John D <john.donoghue@ieee.org>
parents:
23757
diff
changeset
|
57 # endif |
21961
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
58 #else |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
59 # include "mkostemps-wrapper.h" |
21961
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
60 # include "unistd-wrappers.h" |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
61 # include "wait-wrappers.h" |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
62 #endif |
18916
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
18915
diff
changeset
|
63 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
64 static std::map<std::string, std::string> vars; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
65 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
66 #if ! defined (OCTAVE_VERSION) |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
67 # define OCTAVE_VERSION %OCTAVE_CONF_VERSION% |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
68 #endif |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
69 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
70 #if ! defined (OCTAVE_PREFIX) |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
71 # define OCTAVE_PREFIX %OCTAVE_CONF_PREFIX% |
18360
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18349
diff
changeset
|
72 #endif |
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18349
diff
changeset
|
73 |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
74 #if ! defined (OCTAVE_EXEC_PREFIX) |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
75 # define OCTAVE_EXEC_PREFIX %OCTAVE_CONF_EXEC_PREFIX% |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
76 #endif |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
77 |
18360
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18349
diff
changeset
|
78 #include "shared-fcns.h" |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
79 |
21961
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
80 #if defined (CROSS) |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
81 |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
82 static int |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
83 octave_mkostemps_wrapper (char *tmpl, int suffixlen) |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
84 { |
25504
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
85 return mkostemps (tmpl, suffixlen, 0); |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
86 } |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
87 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
88 static int |
21961
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
89 octave_unlink_wrapper (const char *nm) |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
90 { |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
91 return unlink (nm); |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
92 } |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
93 |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
94 static bool |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
95 octave_wifexited_wrapper (int status) |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
96 { |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
97 return WIFEXITED (status); |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
98 } |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
99 |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
100 static int |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
101 octave_wexitstatus_wrapper (int status) |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
102 { |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
103 return WEXITSTATUS (status); |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
104 } |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
105 |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
106 #endif |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
107 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
108 static std::string |
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
|
109 get_line (FILE *fp) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
110 { |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
111 std::ostringstream buf; |
8091
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 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
|
114 { |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
115 int c = std::fgetc (fp); |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
116 |
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
|
117 if (c == '\n' || c == EOF) |
12174 | 118 break; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
119 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
120 buf << static_cast<char> (c); |
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 } |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
122 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
123 return buf.str (); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
124 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
125 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
126 static std::string |
25475
245de4f12ca3
link .oct files with liboctave and libinterp on Windows systems (bug #53627)
John W. Eaton <jwe@octave.org>
parents:
25447
diff
changeset
|
127 get_variable (const char *name, const std::string& defval) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
128 { |
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
|
129 const char *val = getenv (name); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
130 |
17898
8c33abdd2f9a
maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents:
17789
diff
changeset
|
131 if (val && *val) |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
132 return std::string (val); |
17898
8c33abdd2f9a
maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents:
17789
diff
changeset
|
133 else |
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
|
134 return defval; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
135 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
136 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
137 static std::string |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
138 quote_path (const std::string& s) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
139 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
140 if (s.find (' ') != std::string::npos && s[0] != '"') |
23803
90689bdbe048
Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents:
23801
diff
changeset
|
141 return '"' + s + '"'; |
8332 | 142 else |
143 return s; | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
144 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
145 |
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
|
146 static void |
8332 | 147 initialize (void) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
148 { |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
149 set_octave_home (); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
150 |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
151 vars["OCTAVE_HOME"] = Voctave_home; |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
152 vars["OCTAVE_EXEC_HOME"] = Voctave_exec_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
|
153 |
25556
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
154 vars["API_VERSION"] = %OCTAVE_API_VERSION%; |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
155 vars["CANONICAL_HOST_TYPE"] = %OCTAVE_CANONICAL_HOST_TYPE%; |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
156 vars["DEFAULT_PAGER"] = %OCTAVE_DEFAULT_PAGER%; |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
157 vars["EXEEXT"] = %OCTAVE_EXEEXT%; |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
158 vars["MAN1EXT"] = %OCTAVE_MAN1EXT%; |
26472
86bcab2e371e
mkoctfile: use OCTAVE_VERSION instead of VERSION for API consistency
Mike Miller <mtmiller@octave.org>
parents:
26431
diff
changeset
|
159 vars["OCTAVE_VERSION"] = %OCTAVE_VERSION%; |
25556
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
160 |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
161 vars["ARCHLIBDIR"] = prepend_octave_exec_home (%OCTAVE_ARCHLIBDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
162 vars["BINDIR"] = prepend_octave_exec_home (%OCTAVE_BINDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
163 vars["DATADIR"] = prepend_octave_home (%OCTAVE_DATADIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
164 vars["DATAROOTDIR"] = prepend_octave_home (%OCTAVE_DATAROOTDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
165 vars["FCNFILEDIR"] = prepend_octave_home (%OCTAVE_FCNFILEDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
166 vars["IMAGEDIR"] = prepend_octave_home (%OCTAVE_IMAGEDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
167 vars["INFODIR"] = prepend_octave_home (%OCTAVE_INFODIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
168 vars["INFOFILE"] = prepend_octave_home (%OCTAVE_INFOFILE%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
169 vars["LIBEXECDIR"] = prepend_octave_exec_home (%OCTAVE_LIBEXECDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
170 vars["LOCALAPIARCHLIBDIR"] = prepend_octave_exec_home (%OCTAVE_LOCALAPIARCHLIBDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
171 vars["LOCALAPIFCNFILEDIR"] = prepend_octave_home (%OCTAVE_LOCALAPIFCNFILEDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
172 vars["LOCALAPIOCTFILEDIR"] = prepend_octave_exec_home (%OCTAVE_LOCALAPIOCTFILEDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
173 vars["LOCALARCHLIBDIR"] = prepend_octave_exec_home (%OCTAVE_LOCALARCHLIBDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
174 vars["LOCALFCNFILEDIR"] = prepend_octave_home (%OCTAVE_LOCALFCNFILEDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
175 vars["LOCALOCTFILEDIR"] = prepend_octave_exec_home (%OCTAVE_LOCALOCTFILEDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
176 vars["LOCALSTARTUPFILEDIR"] = prepend_octave_home (%OCTAVE_LOCALSTARTUPFILEDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
177 vars["LOCALVERARCHLIBDIR"] = prepend_octave_exec_home (%OCTAVE_LOCALVERARCHLIBDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
178 vars["LOCALVERFCNFILEDIR"] = prepend_octave_home (%OCTAVE_LOCALVERFCNFILEDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
179 vars["LOCALVEROCTFILEDIR"] = prepend_octave_exec_home (%OCTAVE_LOCALVEROCTFILEDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
180 vars["MAN1DIR"] = prepend_octave_home (%OCTAVE_MAN1DIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
181 vars["MANDIR"] = prepend_octave_home (%OCTAVE_MANDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
182 vars["OCTDATADIR"] = prepend_octave_home (%OCTAVE_OCTDATADIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
183 vars["OCTDOCDIR"] = prepend_octave_home (%OCTAVE_OCTDOCDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
184 vars["OCTFILEDIR"] = prepend_octave_exec_home (%OCTAVE_OCTFILEDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
185 vars["OCTFONTSDIR"] = prepend_octave_home (%OCTAVE_OCTFONTSDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
186 vars["STARTUPFILEDIR"] = prepend_octave_home (%OCTAVE_STARTUPFILEDIR%); |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
187 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
188 vars["OCTINCLUDEDIR"] |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
189 = get_variable ("OCTINCLUDEDIR", |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
190 prepend_octave_home (%OCTAVE_CONF_OCTINCLUDEDIR%)); |
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
|
191 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
192 vars["INCLUDEDIR"] |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
193 = get_variable ("INCLUDEDIR", |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
194 prepend_octave_home (%OCTAVE_CONF_INCLUDEDIR%)); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
195 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
196 vars["LIBDIR"] |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
197 = get_variable ("LIBDIR", prepend_octave_exec_home (%OCTAVE_CONF_LIBDIR%)); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
198 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
199 vars["OCTLIBDIR"] |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
200 = get_variable ("OCTLIBDIR", prepend_octave_exec_home (%OCTAVE_CONF_OCTLIBDIR%)); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
201 |
21979
d04da18a407a
use OCTAVE_USE_WINDOWS_API more consistently
John W. Eaton <jwe@octave.org>
parents:
21961
diff
changeset
|
202 #if defined (OCTAVE_USE_WINDOWS_API) |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
203 std::string DEFAULT_INCFLAGS |
23804
8057d3f0673d
Use C++11 raw string literals to avoid escaping backslashes in strings.
Rik <rik@octave.org>
parents:
23803
diff
changeset
|
204 = "-I" + quote_path (vars["OCTINCLUDEDIR"] + R"(\..)") |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
205 + " -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
|
206 #else |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
207 std::string DEFAULT_INCFLAGS |
9794
0d4613a736e9
convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents:
9565
diff
changeset
|
208 = "-I" + quote_path (vars["OCTINCLUDEDIR"] + "/..") |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
209 + " -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
|
210 #endif |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
211 |
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
|
212 if (vars["INCLUDEDIR"] != "/usr/include") |
8332 | 213 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
|
214 |
26422
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
215 std::string DEFAULT_LDFLAGS; |
25475
245de4f12ca3
link .oct files with liboctave and libinterp on Windows systems (bug #53627)
John W. Eaton <jwe@octave.org>
parents:
25447
diff
changeset
|
216 |
26363
16607f64eea1
Include -loctave -loctinterp and lib path to mkoctfile link command (bug #55033).
Ben Abbott <bpabbott@mac.com>
parents:
26232
diff
changeset
|
217 #if (defined (OCTAVE_USE_WINDOWS_API) || defined (CROSS)) || (defined __APPLE__ && defined __MACH__) |
25475
245de4f12ca3
link .oct files with liboctave and libinterp on Windows systems (bug #53627)
John W. Eaton <jwe@octave.org>
parents:
25447
diff
changeset
|
218 |
26431
ff6c90eb6f2d
mkoctfile.in.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26422
diff
changeset
|
219 // We'll be linking the files we compile with -loctinterp and -loctave, |
ff6c90eb6f2d
mkoctfile.in.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26422
diff
changeset
|
220 // so we need to know where to find them. |
26422
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
221 DEFAULT_LDFLAGS += "-L" + quote_path (vars["OCTLIBDIR"]); |
25475
245de4f12ca3
link .oct files with liboctave and libinterp on Windows systems (bug #53627)
John W. Eaton <jwe@octave.org>
parents:
25447
diff
changeset
|
222 #endif |
245de4f12ca3
link .oct files with liboctave and libinterp on Windows systems (bug #53627)
John W. Eaton <jwe@octave.org>
parents:
25447
diff
changeset
|
223 |
245de4f12ca3
link .oct files with liboctave and libinterp on Windows systems (bug #53627)
John W. Eaton <jwe@octave.org>
parents:
25447
diff
changeset
|
224 if (vars["LIBDIR"] != "/usr/lib") |
26422
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
225 DEFAULT_LDFLAGS += " -L" + quote_path (vars["LIBDIR"]); |
25475
245de4f12ca3
link .oct files with liboctave and libinterp on Windows systems (bug #53627)
John W. Eaton <jwe@octave.org>
parents:
25447
diff
changeset
|
226 |
8332 | 227 vars["CPPFLAGS"] = get_variable ("CPPFLAGS", %OCTAVE_CONF_CPPFLAGS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
228 |
8332 | 229 vars["INCFLAGS"] = get_variable ("INCFLAGS", DEFAULT_INCFLAGS); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
230 |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15458
diff
changeset
|
231 vars["F77"] = get_variable ("F77", %OCTAVE_CONF_MKOCTFILE_F77%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
232 |
8332 | 233 vars["FFLAGS"] = get_variable ("FFLAGS", %OCTAVE_CONF_FFLAGS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
234 |
8332 | 235 vars["FPICFLAG"] = get_variable ("FPICFLAG", %OCTAVE_CONF_FPICFLAG%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
236 |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15458
diff
changeset
|
237 vars["CC"] = get_variable ("CC", %OCTAVE_CONF_MKOCTFILE_CC%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
238 |
8332 | 239 vars["CFLAGS"] = get_variable ("CFLAGS", %OCTAVE_CONF_CFLAGS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
240 |
8332 | 241 vars["CPICFLAG"] = get_variable ("CPICFLAG", %OCTAVE_CONF_CPICFLAG%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
242 |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15458
diff
changeset
|
243 vars["CXX"] = get_variable ("CXX", %OCTAVE_CONF_MKOCTFILE_CXX%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
244 |
8332 | 245 vars["CXXFLAGS"] = get_variable ("CXXFLAGS", %OCTAVE_CONF_CXXFLAGS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
246 |
8332 | 247 vars["CXXPICFLAG"] = get_variable ("CXXPICFLAG", %OCTAVE_CONF_CXXPICFLAG%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
248 |
8332 | 249 vars["XTRA_CFLAGS"] = get_variable ("XTRA_CFLAGS", %OCTAVE_CONF_XTRA_CFLAGS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
250 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
251 vars["XTRA_CXXFLAGS"] = get_variable ("XTRA_CXXFLAGS", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
252 %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
|
253 |
15944
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
254 vars["AR"] = get_variable ("AR", %OCTAVE_CONF_MKOCTFILE_AR%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
255 |
15944
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
256 vars["RANLIB"] = get_variable ("RANLIB", %OCTAVE_CONF_MKOCTFILE_RANLIB%); |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
257 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
258 vars["DEPEND_FLAGS"] = get_variable ("DEPEND_FLAGS", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
259 %OCTAVE_CONF_DEPEND_FLAGS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
260 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
261 vars["DEPEND_EXTRA_SED_PATTERN"] |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
262 = get_variable ("DEPEND_EXTRA_SED_PATTERN", |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
263 %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
|
264 |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15458
diff
changeset
|
265 vars["DL_LD"] = get_variable ("DL_LD", %OCTAVE_CONF_MKOCTFILE_DL_LD%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
266 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
267 vars["DL_LDFLAGS"] = get_variable ("DL_LDFLAGS", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
268 %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
|
269 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
270 vars["RDYNAMIC_FLAG"] = get_variable ("RDYNAMIC_FLAG", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
271 %OCTAVE_CONF_RDYNAMIC_FLAG%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
272 |
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
|
273 vars["LIBOCTAVE"] = "-loctave"; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
274 |
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
|
275 vars["LIBOCTINTERP"] = "-loctinterp"; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
276 |
9515 | 277 vars["READLINE_LIBS"] = "-lreadline"; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
278 |
11450
5eb10763069f
substitute and use LAPACK_LIBS in mkoctfile script
John W. Eaton <jwe@octave.org>
parents:
11251
diff
changeset
|
279 vars["LAPACK_LIBS"] = get_variable ("LAPACK_LIBS", %OCTAVE_CONF_LAPACK_LIBS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
280 |
8332 | 281 vars["BLAS_LIBS"] = get_variable ("BLAS_LIBS", %OCTAVE_CONF_BLAS_LIBS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
282 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
283 vars["FFTW3_LDFLAGS"] = get_variable ("FFTW3_LDFLAGS", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
284 %OCTAVE_CONF_FFTW3_LDFLAGS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
285 |
9538
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
286 vars["FFTW3_LIBS"] = get_variable ("FFTW3_LIBS", %OCTAVE_CONF_FFTW3_LIBS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
287 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
288 vars["FFTW3F_LDFLAGS"] = get_variable ("FFTW3F_LDFLAGS", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
289 %OCTAVE_CONF_FFTW3F_LDFLAGS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
290 |
9538
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
291 vars["FFTW3F_LIBS"] = get_variable ("FFTW3F_LIBS", %OCTAVE_CONF_FFTW3F_LIBS%); |
22909
7b368d85e86c
don't include sundials libraries or options in mkoctfile flags
John W. Eaton <jwe@octave.org>
parents:
22899
diff
changeset
|
292 |
8332 | 293 vars["LIBS"] = get_variable ("LIBS", %OCTAVE_CONF_LIBS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
294 |
8332 | 295 vars["FLIBS"] = get_variable ("FLIBS", %OCTAVE_CONF_FLIBS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
296 |
18349
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
297 vars["OCTAVE_LINK_DEPS"] = get_variable ("OCTAVE_LINK_DEPS", |
23757
bba752b37f8e
use different definition for mkoctfile link deps
John W. Eaton <jwe@octave.org>
parents:
23712
diff
changeset
|
298 %OCTAVE_CONF_MKOCTFILE_OCTAVE_LINK_DEPS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
299 |
18349
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
300 vars["OCTAVE_LINK_OPTS"] = get_variable ("OCTAVE_LINK_OPTS", |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
301 %OCTAVE_CONF_OCTAVE_LINK_OPTS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
302 |
18349
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
303 vars["OCT_LINK_DEPS"] = get_variable ("OCT_LINK_DEPS", |
23757
bba752b37f8e
use different definition for mkoctfile link deps
John W. Eaton <jwe@octave.org>
parents:
23712
diff
changeset
|
304 %OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
305 |
18349
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
306 vars["OCT_LINK_OPTS"] = get_variable ("OCT_LINK_OPTS", |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
307 %OCTAVE_CONF_OCT_LINK_OPTS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
308 |
26612
ab5cc8da283c
mkoctfile: restore LDFLAGS, warn only when LFLAGS used directly (bug #55447)
Mike Miller <mtmiller@octave.org>
parents:
26487
diff
changeset
|
309 vars["LDFLAGS"] = get_variable ("LDFLAGS", %OCTAVE_CONF_LDFLAGS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
310 |
26422
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
311 vars["LD_CXX"] = get_variable ("LD_CXX", %OCTAVE_CONF_MKOCTFILE_LD_CXX%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
312 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
313 vars["LD_STATIC_FLAG"] = get_variable ("LD_STATIC_FLAG", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
314 %OCTAVE_CONF_LD_STATIC_FLAG%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
315 |
26422
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
316 // FIXME: Remove LFLAGS in Octave 7.0 |
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
317 vars["LFLAGS"] = get_variable ("LFLAGS", DEFAULT_LDFLAGS); |
26612
ab5cc8da283c
mkoctfile: restore LDFLAGS, warn only when LFLAGS used directly (bug #55447)
Mike Miller <mtmiller@octave.org>
parents:
26487
diff
changeset
|
318 if (vars["LFLAGS"] != DEFAULT_LDFLAGS) |
ab5cc8da283c
mkoctfile: restore LDFLAGS, warn only when LFLAGS used directly (bug #55447)
Mike Miller <mtmiller@octave.org>
parents:
26487
diff
changeset
|
319 std::cerr << "warning: LFLAGS is deprecated and will be removed in a future version of Octave, use LDFLAGS instead" << std::endl; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
320 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
321 vars["F77_INTEGER8_FLAG"] = get_variable ("F77_INTEGER8_FLAG", |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
322 %OCTAVE_CONF_F77_INTEGER_8_FLAG%); |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
323 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
|
324 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
325 vars["ALL_CFLAGS"] |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
326 = vars["INCFLAGS"] + ' ' + vars["XTRA_CFLAGS"] + ' ' + vars["CFLAGS"]; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
327 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
328 vars["ALL_CXXFLAGS"] |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
329 = vars["INCFLAGS"] + ' ' + vars["XTRA_CXXFLAGS"] + ' ' + vars["CXXFLAGS"]; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
330 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
331 vars["ALL_LDFLAGS"] |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
332 = vars["LD_STATIC_FLAG"] + ' ' + vars["CPICFLAG"] + ' ' + vars["LDFLAGS"]; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
333 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
334 vars["OCTAVE_LIBS"] |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
335 = (vars["LIBOCTINTERP"] + ' ' + vars["LIBOCTAVE"] + ' ' |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
336 + vars["SPECIAL_MATH_LIB"]); |
9538
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
337 |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
338 vars["FFTW_LIBS"] = vars["FFTW3_LDFLAGS"] + ' ' + vars["FFTW3_LIBS"] + ' ' |
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
339 + 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
|
340 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
341 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
342 static std::string usage_msg = "usage: mkoctfile [options] file ..."; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
343 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
344 static std::string version_msg = "mkoctfile, version " OCTAVE_VERSION; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
345 |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
346 static bool debug = false; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
347 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
348 static std::string help_msg = |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
349 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
350 "Options:\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
351 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
352 " -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
|
353 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
354 " -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
|
355 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
356 " -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
|
357 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
358 " -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
|
359 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
360 " -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
|
361 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
362 " -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
|
363 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
364 " -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
|
365 " source files.\n" |
21979
d04da18a407a
use OCTAVE_USE_WINDOWS_API more consistently
John W. Eaton <jwe@octave.org>
parents:
21961
diff
changeset
|
366 #if ! defined (OCTAVE_USE_WINDOWS_API) |
18349
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
367 "\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
368 " -pthread Add -pthread to link command.\n" |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
369 #endif |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
370 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
371 " -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
|
372 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
373 " -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
|
374 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
375 " -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
|
376 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
377 " -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
|
378 "\n" |
20713
2469d78a1d8b
Consistently use 'filename' rather than 'file name' throughout code base.
Rik <rik@octave.org>
parents:
20507
diff
changeset
|
379 " -o FILE, --output FILE Output filename. Default extension is .oct\n" |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
380 " (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
|
381 " a stand-alone executable.\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
382 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
383 " -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
|
384 "\n" |
25556
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
385 " -p VAR, --print VAR Print configuration variable VAR. There are\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
386 " three categories of variables:\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
387 "\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
388 " Octave configuration variables that users may\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
389 " override with environment variables. These are\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
390 " used in commands that mkoctfile executes.\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
391 "\n" |
26422
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
392 " ALL_CFLAGS INCLUDEDIR\n" |
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
393 " ALL_CXXFLAGS LAPACK_LIBS\n" |
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
394 " ALL_FFLAGS LDFLAGS\n" |
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
395 " ALL_LDFLAGS LD_CXX\n" |
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
396 " BLAS_LIBS LD_STATIC_FLAG\n" |
25556
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
397 " CC LIBDIR\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
398 " CFLAGS LIBOCTAVE\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
399 " CPICFLAG LIBOCTINTERP\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
400 " CPPFLAGS OCTAVE_LINK_OPTS\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
401 " CXX OCTINCLUDEDIR\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
402 " CXXFLAGS OCTAVE_LIBS\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
403 " CXXPICFLAG OCTAVE_LINK_DEPS\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
404 " DL_LD OCTLIBDIR\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
405 " DL_LDFLAGS OCT_LINK_DEPS\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
406 " F77 OCT_LINK_OPTS\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
407 " F77_INTEGER8_FLAG RDYNAMIC_FLAG\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
408 " FFLAGS SPECIAL_MATH_LIB\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
409 " FPICFLAG XTRA_CFLAGS\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
410 " INCFLAGS XTRA_CXXFLAGS\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
411 "\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
412 " Octave configuration variables as above, but\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
413 " currently unused by mkoctfile.\n" |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
414 "\n" |
26232
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
415 " AR\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
416 " DEPEND_EXTRA_SED_PATTERN\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
417 " DEPEND_FLAGS\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
418 " FFTW3F_LDFLAGS\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
419 " FFTW3F_LIBS\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
420 " FFTW3_LDFLAGS\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
421 " FFTW3_LIBS\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
422 " FFTW_LIBS\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
423 " FLIBS\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
424 " LIBS\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
425 " RANLIB\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
426 " READLINE_LIBS\n" |
25556
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
427 "\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
428 " Octave configuration variables that are provided\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
429 " for informational purposes only. Except for\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
430 " OCTAVE_HOME and OCTAVE_EXEC_HOME, users may not\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
431 " override these variables.\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
432 "\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
433 " If OCTAVE_HOME or OCTAVE_EXEC_HOME are set in\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
434 " the environment, then other variables are adjusted\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
435 " accordingly with OCTAVE_HOME or OCTAVE_EXEC_HOME\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
436 " substituted for the original value of the directory\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
437 " specified by the --prefix or --exec-prefix options\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
438 " that were used when Octave was configured.\n" |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
439 "\n" |
26232
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
440 " API_VERSION LOCALFCNFILEDIR\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
441 " ARCHLIBDIR LOCALOCTFILEDIR\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
442 " BINDIR LOCALSTARTUPFILEDIR\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
443 " CANONICAL_HOST_TYPE LOCALVERARCHLIBDIR\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
444 " DATADIR LOCALVERFCNFILEDIR\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
445 " DATAROOTDIR LOCALVEROCTFILEDIR\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
446 " DEFAULT_PAGER MAN1DIR\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
447 " EXEC_PREFIX MAN1EXT\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
448 " EXEEXT MANDIR\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
449 " FCNFILEDIR OCTAVE_EXEC_HOME\n" |
90487d5431cc
doc: bring mkoctfile command doc strings into agreement
Mike Miller <mtmiller@octave.org>
parents:
26229
diff
changeset
|
450 " IMAGEDIR OCTAVE_HOME\n" |
26472
86bcab2e371e
mkoctfile: use OCTAVE_VERSION instead of VERSION for API consistency
Mike Miller <mtmiller@octave.org>
parents:
26431
diff
changeset
|
451 " INFODIR OCTAVE_VERSION\n" |
86bcab2e371e
mkoctfile: use OCTAVE_VERSION instead of VERSION for API consistency
Mike Miller <mtmiller@octave.org>
parents:
26431
diff
changeset
|
452 " INFOFILE OCTDATADIR\n" |
86bcab2e371e
mkoctfile: use OCTAVE_VERSION instead of VERSION for API consistency
Mike Miller <mtmiller@octave.org>
parents:
26431
diff
changeset
|
453 " LIBEXECDIR OCTDOCDIR\n" |
86bcab2e371e
mkoctfile: use OCTAVE_VERSION instead of VERSION for API consistency
Mike Miller <mtmiller@octave.org>
parents:
26431
diff
changeset
|
454 " LOCALAPIARCHLIBDIR OCTFILEDIR\n" |
86bcab2e371e
mkoctfile: use OCTAVE_VERSION instead of VERSION for API consistency
Mike Miller <mtmiller@octave.org>
parents:
26431
diff
changeset
|
455 " LOCALAPIFCNFILEDIR OCTFONTSDIR\n" |
86bcab2e371e
mkoctfile: use OCTAVE_VERSION instead of VERSION for API consistency
Mike Miller <mtmiller@octave.org>
parents:
26431
diff
changeset
|
456 " LOCALAPIOCTFILEDIR STARTUPFILEDIR\n" |
25556
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
457 " LOCALARCHLIBDIR\n" |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
458 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
459 " --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
|
460 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
461 " --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
|
462 " 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
|
463 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
464 " -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
|
465 "\n" |
22481
541a20a4961c
mkoctfile: alias --dry-run option to --just-print because it's very common.
Carnë Draug <carandraug@octave.org>
parents:
22472
diff
changeset
|
466 " -n, --just-print, --dry-run\n" |
22486
6dd979aa7a2c
mkoctfile.in.cc: Align explanation of -n option with other explanations.
Rik <rik@octave.org>
parents:
22481
diff
changeset
|
467 " Print commands, but do not execute them.\n" |
22472
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
468 "\n" |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
469 " -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
|
470 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
471 " 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
|
472 "\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
473 " .c C source\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
474 " .cc C++ source\n" |
22031
2cfbb6b25428
mkoctfile: support more file extensions for C++ sources (bug #48381)
Mike Miller <mtmiller@octave.org>
parents:
22022
diff
changeset
|
475 " .cp C++ source\n" |
2cfbb6b25428
mkoctfile: support more file extensions for C++ sources (bug #48381)
Mike Miller <mtmiller@octave.org>
parents:
22022
diff
changeset
|
476 " .cpp C++ source\n" |
2cfbb6b25428
mkoctfile: support more file extensions for C++ sources (bug #48381)
Mike Miller <mtmiller@octave.org>
parents:
22022
diff
changeset
|
477 " .CPP C++ source\n" |
2cfbb6b25428
mkoctfile: support more file extensions for C++ sources (bug #48381)
Mike Miller <mtmiller@octave.org>
parents:
22022
diff
changeset
|
478 " .cxx C++ source\n" |
2cfbb6b25428
mkoctfile: support more file extensions for C++ sources (bug #48381)
Mike Miller <mtmiller@octave.org>
parents:
22022
diff
changeset
|
479 " .c++ C++ source\n" |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
480 " .C C++ source\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
481 " .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
|
482 " .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
|
483 " .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
|
484 " .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
|
485 " .o object file\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
486 " .a library file\n" |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
487 #if defined (_MSC_VER) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
488 " .lib library file\n" |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
489 #endif |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
490 "\n"; |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
491 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
492 static std::string |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
493 basename (const std::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
|
494 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
495 std::string retval; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
496 |
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
|
497 size_t pos = s.rfind ('.'); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
498 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
499 if (pos == std::string::npos) |
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
|
500 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
|
501 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
|
502 retval = s.substr (0, pos); |
15299
8bd5c490b787
Fix mex compilation with subdirs on Windows platforms (bug #37122)
Rik <rik@octave.org>
parents:
15271
diff
changeset
|
503 |
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
|
504 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
|
505 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
506 size_t p1 = retval.rfind ('/'), p2 = retval.rfind ('\\'); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
507 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
508 pos = (p1 != std::string::npos && p2 != std::string::npos |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
509 ? std::max (p1, p2) : (p2 != std::string::npos ? p2 : p1)); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
510 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
511 if (pos != std::string::npos) |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
512 retval = retval.substr (++pos, std::string::npos); |
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
|
513 } |
15299
8bd5c490b787
Fix mex compilation with subdirs on Windows platforms (bug #37122)
Rik <rik@octave.org>
parents:
15271
diff
changeset
|
514 |
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
|
515 return retval; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
516 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
517 |
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
|
518 inline bool |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
519 starts_with (const std::string& s, const std::string& prefix) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
520 { |
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
|
521 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
|
522 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
523 |
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
|
524 inline bool |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
525 ends_with (const std::string& s, const std::string& suffix) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
526 { |
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
|
527 return (s.length () >= suffix.length () |
12174 | 528 && 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
|
529 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
530 |
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
|
531 static int |
22472
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
532 run_command (const std::string& cmd, bool printonly = false) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
533 { |
22472
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
534 if (printonly) |
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
535 { |
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
536 std::cout << cmd << std::endl; |
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
537 return 0; |
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
538 } |
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
539 |
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
|
540 if (debug) |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
541 std::cout << cmd << std::endl; |
18916
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
18915
diff
changeset
|
542 |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
18915
diff
changeset
|
543 int result = system (cmd.c_str ()); |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
18915
diff
changeset
|
544 |
21927
6f62bd248919
use wrapper functions for mkoctfile and main
John W. Eaton <jwe@octave.org>
parents:
21852
diff
changeset
|
545 if (octave_wifexited_wrapper (result)) |
6f62bd248919
use wrapper functions for mkoctfile and main
John W. Eaton <jwe@octave.org>
parents:
21852
diff
changeset
|
546 result = octave_wexitstatus_wrapper (result); |
18916
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
18915
diff
changeset
|
547 |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
18915
diff
changeset
|
548 return result; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
549 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
550 |
16624
96d02808a881
Support "true" or "yes" for %NO_OCT_FILE_STRIP% in mkoctfile.in.cc.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15946
diff
changeset
|
551 bool |
96d02808a881
Support "true" or "yes" for %NO_OCT_FILE_STRIP% in mkoctfile.in.cc.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15946
diff
changeset
|
552 is_true (const std::string& s) |
96d02808a881
Support "true" or "yes" for %NO_OCT_FILE_STRIP% in mkoctfile.in.cc.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15946
diff
changeset
|
553 { |
18360
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18349
diff
changeset
|
554 return (s == "yes" || s == "true"); |
16624
96d02808a881
Support "true" or "yes" for %NO_OCT_FILE_STRIP% in mkoctfile.in.cc.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15946
diff
changeset
|
555 } |
96d02808a881
Support "true" or "yes" for %NO_OCT_FILE_STRIP% in mkoctfile.in.cc.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15946
diff
changeset
|
556 |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
557 static std::string |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
558 get_temp_directory (void) |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
559 { |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
560 std::string tempd; |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
561 |
26853
b0f359a5ad35
mkoctfile: use the TMPDIR environment variable if set (bug #55814)
Mike Miller <mtmiller@octave.org>
parents:
26612
diff
changeset
|
562 tempd = octave_getenv ("TMPDIR"); |
b0f359a5ad35
mkoctfile: use the TMPDIR environment variable if set (bug #55814)
Mike Miller <mtmiller@octave.org>
parents:
26612
diff
changeset
|
563 |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
564 #if defined (__MINGW32__) || defined (_MSC_VER) |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
565 |
26853
b0f359a5ad35
mkoctfile: use the TMPDIR environment variable if set (bug #55814)
Mike Miller <mtmiller@octave.org>
parents:
26612
diff
changeset
|
566 if (tempd.empty ()) |
b0f359a5ad35
mkoctfile: use the TMPDIR environment variable if set (bug #55814)
Mike Miller <mtmiller@octave.org>
parents:
26612
diff
changeset
|
567 tempd = octave_getenv ("TEMP"); |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
568 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
569 if (tempd.empty ()) |
26370
190702f4a075
mkoctfile.in.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26363
diff
changeset
|
570 tempd = octave_getenv ("TMP"); |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
571 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
572 #if defined (P_tmpdir) |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
573 if (tempd.empty ()) |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
574 tempd = P_tmpdir; |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
575 #endif |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
576 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
577 // Some versions of MinGW and MSVC either don't define P_tmpdir, or |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
578 // define it to a single backslash. In such cases just use C:\temp. |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
579 if (tempd.empty () || tempd == R"(\)") |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
580 tempd = R"(c:\temp)"; |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
581 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
582 #else |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
583 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
584 #if defined (P_tmpdir) |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
585 if (tempd.empty ()) |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
586 tempd = P_tmpdir; |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
587 #else |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
588 if (tempd.empty ()) |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
589 tempd = "/tmp"; |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
590 #endif |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
591 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
592 #endif |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
593 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
594 return tempd; |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
595 } |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
596 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
597 static std::string |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
598 tmp_objfile_name (void) |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
599 { |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
600 std::string tmpl = get_temp_directory () + "/oct-XXXXXX.o"; |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
601 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
602 char *ctmpl = new char [tmpl.length () + 1]; |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
603 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
604 ctmpl = strcpy (ctmpl, tmpl.c_str ()); |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
605 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
606 // mkostemps will open the file and return a file descriptor. We |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
607 // won't worry about closing it because we will need the file until we |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
608 // are done and then the file will be closed when mkoctfile exits. |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
609 octave_mkostemps_wrapper (ctmpl, 2); |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
610 |
26487 | 611 std::string retval (ctmpl); // make C++ string from filled-in template |
612 delete [] ctmpl; | |
613 | |
614 return retval; | |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
615 } |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
616 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
617 static void |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
618 clean_up_tmp_files (const std::list<std::string>& tmp_files) |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
619 { |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
620 for (const auto& file : tmp_files) |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
621 octave_unlink_wrapper (file.c_str ()); |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
622 } |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
623 |
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
|
624 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
|
625 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
|
626 { |
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
|
627 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
|
628 |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
629 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
|
630 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
631 std::cout << usage_msg << std::endl; |
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
|
632 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
|
633 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
634 |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
635 if (argc == 2 && (! strcmp (argv[1], "-v") |
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
636 || ! strcmp (argv[1], "-version") |
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
637 || ! 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
|
638 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
639 std::cout << version_msg << std::endl; |
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
|
640 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
|
641 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
642 |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
643 std::list<std::string> cfiles, ccfiles, f77files, tmp_objfiles; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
644 std::string output_ext = ".oct"; |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
645 std::string objfiles, libfiles, octfile, outputfile; |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
646 std::string incflags, defs, ldflags, pass_on_options; |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
647 bool strip = false; |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
648 bool no_oct_file_strip_on_this_platform = is_true ("%NO_OCT_FILE_STRIP%"); |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
649 bool compile_only = false; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
650 bool link_stand_alone = false; |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
651 bool depend = false; |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
652 bool printonly = false; |
25507
b61f3500651f
mkoctfile: fix check for using -o and -c with multiple source files (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25504
diff
changeset
|
653 bool output_file_option = false; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
654 |
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
|
655 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
|
656 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
657 std::string arg = argv[i]; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
658 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
659 std::string file; |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
660 |
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
|
661 if (ends_with (arg, ".c")) |
12174 | 662 { |
663 file = arg; | |
664 cfiles.push_back (file); | |
665 } | |
22031
2cfbb6b25428
mkoctfile: support more file extensions for C++ sources (bug #48381)
Mike Miller <mtmiller@octave.org>
parents:
22022
diff
changeset
|
666 else if (ends_with (arg, ".cc") || ends_with (arg, ".cp") |
2cfbb6b25428
mkoctfile: support more file extensions for C++ sources (bug #48381)
Mike Miller <mtmiller@octave.org>
parents:
22022
diff
changeset
|
667 || ends_with (arg, ".cpp") || ends_with (arg, ".CPP") |
2cfbb6b25428
mkoctfile: support more file extensions for C++ sources (bug #48381)
Mike Miller <mtmiller@octave.org>
parents:
22022
diff
changeset
|
668 || ends_with (arg, ".cxx") || ends_with (arg, ".c++") |
2cfbb6b25428
mkoctfile: support more file extensions for C++ sources (bug #48381)
Mike Miller <mtmiller@octave.org>
parents:
22022
diff
changeset
|
669 || ends_with (arg, ".C")) |
12174 | 670 { |
671 file = arg; | |
672 ccfiles.push_back (file); | |
673 } | |
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
|
674 else if (ends_with (arg, ".f") || ends_with (arg, ".F") |
12174 | 675 || ends_with (arg, "f90") || ends_with (arg, ".F90")) |
676 { | |
677 file = arg; | |
678 f77files.push_back (file); | |
679 } | |
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
|
680 else if (ends_with (arg, ".o") || ends_with (arg, ".obj")) |
12174 | 681 { |
682 file = arg; | |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
683 objfiles += (' ' + quote_path (arg)); |
12174 | 684 } |
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
|
685 else if (ends_with (arg, ".lib") || ends_with (arg, ".a")) |
12174 | 686 { |
687 file = arg; | |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
688 libfiles += (' ' + quote_path (arg)); |
12174 | 689 } |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
690 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
|
691 || arg == "-v" || arg == "-verbose" || arg == "--verbose") |
12174 | 692 { |
693 debug = true; | |
694 if (vars["CC"] == "cc-msvc") | |
695 vars["CC"] += " -d"; | |
696 if (vars["CXX"] == "cc-msvc") | |
697 vars["CXX"] += " -d"; | |
698 if (vars["DL_LD"] == "cc-msvc") | |
699 vars["DL_LD"] += " -d"; | |
700 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
701 else if (arg == "-h" || arg == "-?" || arg == "-help" || arg == "--help") |
12174 | 702 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
703 std::cout << usage_msg << std::endl; |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
704 std::cout << help_msg << std::endl; |
12174 | 705 return 0; |
706 } | |
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
|
707 else if (starts_with (arg, "-I")) |
12174 | 708 { |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
709 incflags += (' ' + quote_path (arg)); |
12174 | 710 } |
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
|
711 else if (arg == "-idirafter") |
12174 | 712 { |
713 if (i < argc-1) | |
714 { | |
715 arg = argv[++i]; | |
716 incflags += (" -idirafter " + arg); | |
717 } | |
718 else | |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
719 std::cerr << "mkoctfile: include directory name missing" |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
720 << std::endl; |
12174 | 721 } |
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
|
722 else if (starts_with (arg, "-D")) |
12174 | 723 { |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
724 defs += (' ' + arg); |
12174 | 725 } |
22461
cc4f31e8477f
Accept, but ignore, mex argument -largeArrayDims, -compatibleArrayDims (bug #39984).
Rik <rik@octave.org>
parents:
22459
diff
changeset
|
726 else if (arg == "-largeArrayDims" || arg == "-compatibleArrayDims") |
cc4f31e8477f
Accept, but ignore, mex argument -largeArrayDims, -compatibleArrayDims (bug #39984).
Rik <rik@octave.org>
parents:
22459
diff
changeset
|
727 { |
26422
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
728 std::cerr << "warning: -largeArrayDims and -compatibleArrayDims are accepted for compatibility, but ignored" << std::endl; |
22461
cc4f31e8477f
Accept, but ignore, mex argument -largeArrayDims, -compatibleArrayDims (bug #39984).
Rik <rik@octave.org>
parents:
22459
diff
changeset
|
729 } |
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
|
730 else if (starts_with (arg, "-Wl,") || starts_with (arg, "-l") |
12174 | 731 || starts_with (arg, "-L") || starts_with (arg, "-R")) |
732 { | |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
733 ldflags += (' ' + arg); |
12174 | 734 } |
21979
d04da18a407a
use OCTAVE_USE_WINDOWS_API more consistently
John W. Eaton <jwe@octave.org>
parents:
21961
diff
changeset
|
735 #if ! defined (OCTAVE_USE_WINDOWS_API) |
18349
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
736 else if (arg == "-pthread") |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
737 { |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
738 ldflags += (' ' + arg); |
18349
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
739 } |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
740 #endif |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
741 else if (arg == "-M" || arg == "-depend" || arg == "--depend") |
12174 | 742 { |
743 depend = true; | |
744 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
745 else if (arg == "-o" || arg == "-output" || arg == "--output") |
12174 | 746 { |
25507
b61f3500651f
mkoctfile: fix check for using -o and -c with multiple source files (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25504
diff
changeset
|
747 output_file_option = true; |
b61f3500651f
mkoctfile: fix check for using -o and -c with multiple source files (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25504
diff
changeset
|
748 |
12174 | 749 if (i < argc-1) |
750 { | |
751 arg = argv[++i]; | |
752 outputfile = arg; | |
753 } | |
754 else | |
20713
2469d78a1d8b
Consistently use 'filename' rather than 'file name' throughout code base.
Rik <rik@octave.org>
parents:
20507
diff
changeset
|
755 std::cerr << "mkoctfile: output filename missing" << std::endl; |
12174 | 756 } |
22481
541a20a4961c
mkoctfile: alias --dry-run option to --just-print because it's very common.
Carnë Draug <carandraug@octave.org>
parents:
22472
diff
changeset
|
757 else if (arg == "-n" || arg == "--dry-run" || arg == "--just-print") |
22472
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
758 { |
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
759 printonly = true; |
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
760 } |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
761 else if (arg == "-p" || arg == "-print" || arg == "--print") |
12174 | 762 { |
763 if (i < argc-1) | |
764 { | |
765 arg = argv[++i]; | |
26422
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
766 // FIXME: Remove LFLAGS checking in Octave 7.0 |
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
767 if (arg == "LFLAGS") |
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
768 std::cerr << "warning: LFLAGS is deprecated and will be removed in a future version of Octave, use LDFLAGS instead" << std::endl; |
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
769 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
770 std::cout << vars[arg] << std::endl; |
12174 | 771 return 0; |
772 } | |
773 else | |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
774 std::cerr << "mkoctfile: --print requires argument" << std::endl; |
12174 | 775 } |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
776 else if (arg == "-s" || arg == "-strip" || arg == "--strip") |
12174 | 777 { |
778 if (no_oct_file_strip_on_this_platform) | |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
779 std::cerr << "mkoctfile: stripping disabled on this platform" |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
780 << std::endl; |
12174 | 781 else |
782 strip = true; | |
783 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
784 else if (arg == "-c" || arg == "-compile" || arg == "--compile") |
12174 | 785 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
786 compile_only = true; |
12174 | 787 } |
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
|
788 else if (arg == "-g") |
12174 | 789 { |
790 vars["ALL_CFLAGS"] += " -g"; | |
791 vars["ALL_CXXFLAGS"] += " -g"; | |
792 vars["ALL_FFLAGS"] += " -g"; | |
793 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
794 else if (arg == "-link-stand-alone" || arg == "--link-stand-alone") |
12174 | 795 { |
796 link_stand_alone = true; | |
797 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
798 else if (arg == "-mex" || arg == "--mex") |
12174 | 799 { |
800 incflags += " -I."; | |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
801 #if defined (_MSC_VER) |
12174 | 802 ldflags += " -Wl,-export:mexFunction"; |
9303
adf676387922
properly #ifdef MSVC linker specific flags
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents:
9245
diff
changeset
|
803 #endif |
12174 | 804 output_ext = ".mex"; |
805 } | |
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
|
806 else if (starts_with (arg, "-W")) |
12174 | 807 { |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
808 pass_on_options += (' ' + arg); |
12174 | 809 } |
24742
9db2f757c7c0
Accept -O as an argument to mkoctfile (bug #53099).
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
810 else if (starts_with (arg, "-O")) |
9db2f757c7c0
Accept -O as an argument to mkoctfile (bug #53099).
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
811 { |
9db2f757c7c0
Accept -O as an argument to mkoctfile (bug #53099).
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
812 pass_on_options += (' ' + arg); |
9db2f757c7c0
Accept -O as an argument to mkoctfile (bug #53099).
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
813 } |
19711
b59aabc08e63
Pass unrecognized '-' arguments through mkoctfile to compiler (bug #34169).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
814 else if (starts_with (arg, "-")) |
b59aabc08e63
Pass unrecognized '-' arguments through mkoctfile to compiler (bug #34169).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
815 { |
24634
ab2321d4ba03
maint: strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
24622
diff
changeset
|
816 // Pass through any unrecognized options. |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
817 pass_on_options += (' ' + arg); |
24634
ab2321d4ba03
maint: strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
24622
diff
changeset
|
818 // Check for an additional argument following the option. |
24742
9db2f757c7c0
Accept -O as an argument to mkoctfile (bug #53099).
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
819 // However, don't check the final position which is typically a file |
9db2f757c7c0
Accept -O as an argument to mkoctfile (bug #53099).
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
820 if (i < argc-2) |
24622
298c6a6bd869
Accept compound unrecognized arguments to mkoctfile (bug #52928).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
821 { |
298c6a6bd869
Accept compound unrecognized arguments to mkoctfile (bug #52928).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
822 arg = argv[i+1]; |
298c6a6bd869
Accept compound unrecognized arguments to mkoctfile (bug #52928).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
823 if (arg[0] != '-') |
298c6a6bd869
Accept compound unrecognized arguments to mkoctfile (bug #52928).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
824 { |
298c6a6bd869
Accept compound unrecognized arguments to mkoctfile (bug #52928).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
825 pass_on_options += (' ' + arg); |
298c6a6bd869
Accept compound unrecognized arguments to mkoctfile (bug #52928).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
826 i++; |
298c6a6bd869
Accept compound unrecognized arguments to mkoctfile (bug #52928).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
827 } |
298c6a6bd869
Accept compound unrecognized arguments to mkoctfile (bug #52928).
Rik <rik@octave.org>
parents:
24534
diff
changeset
|
828 } |
19711
b59aabc08e63
Pass unrecognized '-' arguments through mkoctfile to compiler (bug #34169).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
829 } |
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
|
830 else |
12174 | 831 { |
18796
dd57ca9ef7e4
Add missing newline to error message from mkoctfile.
Rik <rik@octave.org>
parents:
18364
diff
changeset
|
832 std::cerr << "mkoctfile: unrecognized argument " << arg << std::endl; |
12174 | 833 return 1; |
834 } | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
835 |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
836 if (! file.empty () && octfile.empty ()) |
12174 | 837 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
|
838 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
839 |
22459
6af82fc041a4
Implement Matlab-compatible MEX functions mxAssert and mxAssertS.
Rik <rik@octave.org>
parents:
22412
diff
changeset
|
840 if (output_ext == ".mex" |
22599
51b395d24782
maint: strip tabs and trailing whitespace from C++ sources.
John W. Eaton <jwe@octave.org>
parents:
22486
diff
changeset
|
841 && vars["ALL_CFLAGS"].find ("-g") != std::string::npos) |
22459
6af82fc041a4
Implement Matlab-compatible MEX functions mxAssert and mxAssertS.
Rik <rik@octave.org>
parents:
22412
diff
changeset
|
842 { |
6af82fc041a4
Implement Matlab-compatible MEX functions mxAssert and mxAssertS.
Rik <rik@octave.org>
parents:
22412
diff
changeset
|
843 defs += " -DMEX_DEBUG"; |
6af82fc041a4
Implement Matlab-compatible MEX functions mxAssert and mxAssertS.
Rik <rik@octave.org>
parents:
22412
diff
changeset
|
844 } |
6af82fc041a4
Implement Matlab-compatible MEX functions mxAssert and mxAssertS.
Rik <rik@octave.org>
parents:
22412
diff
changeset
|
845 |
25507
b61f3500651f
mkoctfile: fix check for using -o and -c with multiple source files (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25504
diff
changeset
|
846 if (compile_only && output_file_option |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
847 && (cfiles.size () + ccfiles.size () + f77files.size ()) > 1) |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
848 { |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
849 std::cerr << "mkoctfile: may not use -c and -o with multiple source files" |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
850 << std::endl; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
851 return 1; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
852 } |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
853 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
854 std::string output_option; |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
855 |
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
|
856 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
|
857 { |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
858 if (! outputfile.empty ()) |
12174 | 859 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
|
860 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
861 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
|
862 { |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
863 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
|
864 { |
25495
92a64cb5e475
mkoctfile: Prevent invalid string indexing crash.
John W. Eaton <jwe@octave.org>
parents:
25494
diff
changeset
|
865 // FIXME: should probably do a better job of finding the |
92a64cb5e475
mkoctfile: Prevent invalid string indexing crash.
John W. Eaton <jwe@octave.org>
parents:
25494
diff
changeset
|
866 // filename extension instead of just looking at the filename |
92a64cb5e475
mkoctfile: Prevent invalid string indexing crash.
John W. Eaton <jwe@octave.org>
parents:
25494
diff
changeset
|
867 // length. |
92a64cb5e475
mkoctfile: Prevent invalid string indexing crash.
John W. Eaton <jwe@octave.org>
parents:
25494
diff
changeset
|
868 |
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
|
869 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
|
870 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
|
871 size_t len_ext = output_ext.length (); |
25495
92a64cb5e475
mkoctfile: Prevent invalid string indexing crash.
John W. Eaton <jwe@octave.org>
parents:
25494
diff
changeset
|
872 if (len <= len_ext || octfile.substr (len-len_ext) != output_ext) |
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
|
873 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
|
874 } |
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
|
875 else |
12174 | 876 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
|
877 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
878 |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
879 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
|
880 { |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
881 for (const auto& f : cfiles) |
12174 | 882 { |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
883 std::string 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
|
884 |
21927
6f62bd248919
use wrapper functions for mkoctfile and main
John W. Eaton <jwe@octave.org>
parents:
21852
diff
changeset
|
885 octave_unlink_wrapper (dfile.c_str ()); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
886 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
887 std::string cmd |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
888 = (vars["CC"] + ' ' + vars["DEPEND_FLAGS"] + ' ' |
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
889 + vars["CPPFLAGS"] + ' ' + vars["ALL_CFLAGS"] + ' ' |
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
890 + 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
|
891 |
12174 | 892 FILE *fd = popen (cmd.c_str (), "r"); |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
893 std::ofstream fo (dfile.c_str ()); |
15458
1cc42df8ede7
mkoctfile.in.cc: Change variable types to stop compilation warnings.
Rik <rik@octave.org>
parents:
15309
diff
changeset
|
894 size_t pos; |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
895 while (! feof (fd)) |
12174 | 896 { |
897 line = get_line (fd); | |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
898 if ((pos = line.rfind (".o:")) != std::string::npos) |
12174 | 899 { |
15458
1cc42df8ede7
mkoctfile.in.cc: Change variable types to stop compilation warnings.
Rik <rik@octave.org>
parents:
15309
diff
changeset
|
900 size_t spos = line.rfind ('/', pos); |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
901 std::string ofile = |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19711
diff
changeset
|
902 (spos == std::string::npos |
22412
2bc07741efa0
maint: Style check C++ code in src/ directory.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
903 ? line.substr (0, pos+2) |
2bc07741efa0
maint: Style check C++ code in src/ directory.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
904 : line.substr (spos+1, pos-spos+1)); |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
905 fo << "pic/" << ofile << ' ' << ofile << ' ' |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
906 << dfile << line.substr (pos) << std::endl; |
12174 | 907 } |
908 else | |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
909 fo << line << std::endl; |
12174 | 910 } |
911 pclose (fd); | |
912 fo.close (); | |
913 } | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
914 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
915 for (const auto& f : ccfiles) |
12174 | 916 { |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
917 std::string 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
|
918 |
21927
6f62bd248919
use wrapper functions for mkoctfile and main
John W. Eaton <jwe@octave.org>
parents:
21852
diff
changeset
|
919 octave_unlink_wrapper (dfile.c_str ()); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
920 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
921 std::string cmd |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
922 = (vars["CXX"] + ' ' + vars["DEPEND_FLAGS"] + ' ' |
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
923 + vars["CPPFLAGS"] + ' ' + vars["ALL_CXXFLAGS"] + ' ' |
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
924 + 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
|
925 |
12174 | 926 FILE *fd = popen (cmd.c_str (), "r"); |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
927 std::ofstream fo (dfile.c_str ()); |
15458
1cc42df8ede7
mkoctfile.in.cc: Change variable types to stop compilation warnings.
Rik <rik@octave.org>
parents:
15309
diff
changeset
|
928 size_t pos; |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
929 while (! feof (fd)) |
12174 | 930 { |
931 line = get_line (fd); | |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
932 if ((pos = line.rfind (".o:")) != std::string::npos) |
12174 | 933 { |
15458
1cc42df8ede7
mkoctfile.in.cc: Change variable types to stop compilation warnings.
Rik <rik@octave.org>
parents:
15309
diff
changeset
|
934 size_t spos = line.rfind ('/', pos); |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
935 std::string ofile = |
19861
19755f4fc851
maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19711
diff
changeset
|
936 (spos == std::string::npos |
22412
2bc07741efa0
maint: Style check C++ code in src/ directory.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
937 ? line.substr (0, pos+2) |
2bc07741efa0
maint: Style check C++ code in src/ directory.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
938 : line.substr (spos+1, pos-spos+1)); |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
939 fo << "pic/" << ofile << ' ' << ofile << ' ' |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
940 << dfile << line.substr (pos+2) << std::endl; |
12174 | 941 } |
942 else | |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
943 fo << line << std::endl; |
12174 | 944 } |
945 pclose (fd); | |
946 fo.close (); | |
947 } | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
948 |
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
|
949 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
|
950 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
951 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
952 for (const auto& f : f77files) |
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
|
953 { |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
954 if (! vars["F77"].empty ()) |
12174 | 955 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
956 std::string o; |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
957 if (compile_only) |
12174 | 958 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
959 if (! outputfile.empty ()) |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
960 o = outputfile; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
961 else |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
962 o = basename (f, true) + ".o"; |
12174 | 963 } |
964 else | |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
965 { |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
966 o = tmp_objfile_name (); |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
967 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
968 tmp_objfiles.push_back (o); |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
969 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
970 objfiles += (' ' + o); |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
971 } |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
972 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
973 std::string cmd |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
974 = (vars["F77"] + " -c " + vars["FPICFLAG"] + ' ' |
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
975 + vars["ALL_FFLAGS"] + ' ' + incflags + ' ' + defs + ' ' |
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
976 + pass_on_options + ' ' + f + " -o " + o); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
977 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
978 int status = run_command (cmd, printonly); |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
979 |
25510
2710440ea566
mkoctfile: fix logic error with handling of -c option (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25507
diff
changeset
|
980 if (status) |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
981 return status; |
12174 | 982 } |
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
|
983 else |
12174 | 984 { |
18796
dd57ca9ef7e4
Add missing newline to error message from mkoctfile.
Rik <rik@octave.org>
parents:
18364
diff
changeset
|
985 std::cerr << "mkoctfile: no way to compile Fortran file " << f |
dd57ca9ef7e4
Add missing newline to error message from mkoctfile.
Rik <rik@octave.org>
parents:
18364
diff
changeset
|
986 << std::endl; |
12174 | 987 return 1; |
988 } | |
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
|
989 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
990 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
991 for (const auto& f : cfiles) |
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
|
992 { |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
993 if (! vars["CC"].empty ()) |
12174 | 994 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
995 std::string o; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
996 if (compile_only) |
12174 | 997 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
998 if (! outputfile.empty ()) |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
999 o = outputfile; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1000 else |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1001 o = basename (f, true) + ".o"; |
12174 | 1002 } |
1003 else | |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1004 { |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1005 o = tmp_objfile_name (); |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1006 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1007 tmp_objfiles.push_back (o); |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1008 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1009 objfiles += (' ' + o); |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1010 } |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1011 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1012 std::string cmd |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
1013 = (vars["CC"] + " -c " + vars["CPPFLAGS"] + ' ' |
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
1014 + vars["CPICFLAG"] + ' ' + vars["ALL_CFLAGS"] + ' ' |
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
1015 + pass_on_options + ' ' + incflags + ' ' + defs + ' ' |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1016 + quote_path (f) + " -o " + quote_path (o)); |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1017 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1018 int status = run_command (cmd, printonly); |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1019 |
25510
2710440ea566
mkoctfile: fix logic error with handling of -c option (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25507
diff
changeset
|
1020 if (status) |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1021 return status; |
12174 | 1022 } |
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
|
1023 else |
12174 | 1024 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
1025 std::cerr << "mkoctfile: no way to compile C file " << f |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
1026 << std::endl; |
12174 | 1027 return 1; |
1028 } | |
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
|
1029 } |
12174 | 1030 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1031 for (const auto& f : ccfiles) |
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
|
1032 { |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
1033 if (! vars["CXX"].empty ()) |
12174 | 1034 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1035 std::string o; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1036 if (compile_only) |
12174 | 1037 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1038 if (! outputfile.empty ()) |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1039 o = outputfile; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1040 else |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1041 o = basename (f, true) + ".o"; |
12174 | 1042 } |
1043 else | |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1044 { |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1045 o = tmp_objfile_name (); |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1046 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1047 tmp_objfiles.push_back (o); |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1048 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1049 objfiles += (' ' + o); |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1050 } |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1051 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1052 std::string cmd |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
1053 = (vars["CXX"] + " -c " + vars["CPPFLAGS"] + ' ' |
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
1054 + vars["CXXPICFLAG"] + ' ' + vars["ALL_CXXFLAGS"] + ' ' |
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
1055 + pass_on_options + ' ' + incflags + ' ' + defs + ' ' |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1056 + quote_path (f) + " -o " + quote_path (o)); |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1057 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1058 int status = run_command (cmd, printonly); |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1059 |
25510
2710440ea566
mkoctfile: fix logic error with handling of -c option (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25507
diff
changeset
|
1060 if (status) |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1061 return status; |
12174 | 1062 } |
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
|
1063 else |
12174 | 1064 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
1065 std::cerr << "mkoctfile: no way to compile C++ file " << f |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
1066 << std::endl; |
12174 | 1067 return 1; |
1068 } | |
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
|
1069 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
1070 |
26422
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
1071 // If we are only compiling, we are done. |
25511
49d3c6344afe
mkoctfile: fix one more logic error
John W. Eaton <jwe@octave.org>
parents:
25510
diff
changeset
|
1072 |
49d3c6344afe
mkoctfile: fix one more logic error
John W. Eaton <jwe@octave.org>
parents:
25510
diff
changeset
|
1073 if (compile_only) |
49d3c6344afe
mkoctfile: fix one more logic error
John W. Eaton <jwe@octave.org>
parents:
25510
diff
changeset
|
1074 return 0; |
49d3c6344afe
mkoctfile: fix one more logic error
John W. Eaton <jwe@octave.org>
parents:
25510
diff
changeset
|
1075 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1076 if (objfiles.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
|
1077 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1078 std::cerr << "mkoctfile: no objects to link" << std::endl; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1079 return 1; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1080 } |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1081 |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1082 std::string octave_libs; |
25475
245de4f12ca3
link .oct files with liboctave and libinterp on Windows systems (bug #53627)
John W. Eaton <jwe@octave.org>
parents:
25447
diff
changeset
|
1083 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1084 if (link_stand_alone) |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1085 { |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1086 if (! vars["LD_CXX"].empty ()) |
12174 | 1087 { |
26612
ab5cc8da283c
mkoctfile: restore LDFLAGS, warn only when LFLAGS used directly (bug #55447)
Mike Miller <mtmiller@octave.org>
parents:
26487
diff
changeset
|
1088 octave_libs = "-L" + quote_path (vars["OCTLIBDIR"]) |
ab5cc8da283c
mkoctfile: restore LDFLAGS, warn only when LFLAGS used directly (bug #55447)
Mike Miller <mtmiller@octave.org>
parents:
26487
diff
changeset
|
1089 + ' ' + vars["OCTAVE_LIBS"]; |
26431
ff6c90eb6f2d
mkoctfile.in.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26422
diff
changeset
|
1090 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1091 std::string cmd |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1092 = (vars["LD_CXX"] + ' ' + vars["CPPFLAGS"] + ' ' |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1093 + vars["ALL_CXXFLAGS"] + ' ' + vars["RDYNAMIC_FLAG"] + ' ' |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1094 + vars["ALL_LDFLAGS"] + ' ' + pass_on_options + ' ' |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1095 + output_option + ' ' + objfiles + ' ' + libfiles + ' ' |
26612
ab5cc8da283c
mkoctfile: restore LDFLAGS, warn only when LFLAGS used directly (bug #55447)
Mike Miller <mtmiller@octave.org>
parents:
26487
diff
changeset
|
1096 + ldflags + ' ' + vars["LFLAGS"] + ' ' + octave_libs + ' ' |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1097 + vars["OCTAVE_LINK_OPTS"] + ' ' + vars["OCTAVE_LINK_DEPS"]); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1098 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1099 int status = run_command (cmd, printonly); |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1100 |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1101 clean_up_tmp_files (tmp_objfiles); |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1102 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1103 if (status) |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1104 return status; |
12174 | 1105 } |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1106 else |
12174 | 1107 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1108 std::cerr |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1109 << "mkoctfile: no way to link stand-alone executable file" |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1110 << std::endl; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1111 return 1; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1112 } |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1113 } |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1114 else |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1115 { |
26431
ff6c90eb6f2d
mkoctfile.in.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26422
diff
changeset
|
1116 #if defined (OCTAVE_USE_WINDOWS_API) || defined(CROSS) |
26612
ab5cc8da283c
mkoctfile: restore LDFLAGS, warn only when LFLAGS used directly (bug #55447)
Mike Miller <mtmiller@octave.org>
parents:
26487
diff
changeset
|
1117 octave_libs = "-L" + quote_path (vars["OCTLIBDIR"]) |
ab5cc8da283c
mkoctfile: restore LDFLAGS, warn only when LFLAGS used directly (bug #55447)
Mike Miller <mtmiller@octave.org>
parents:
26487
diff
changeset
|
1118 + ' ' + vars["OCTAVE_LIBS"]; |
26431
ff6c90eb6f2d
mkoctfile.in.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26422
diff
changeset
|
1119 #endif |
ff6c90eb6f2d
mkoctfile.in.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26422
diff
changeset
|
1120 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1121 std::string cmd |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1122 = (vars["DL_LD"] + ' ' + vars["ALL_CXXFLAGS"] + ' ' |
26612
ab5cc8da283c
mkoctfile: restore LDFLAGS, warn only when LFLAGS used directly (bug #55447)
Mike Miller <mtmiller@octave.org>
parents:
26487
diff
changeset
|
1123 + vars["DL_LDFLAGS"] + ' ' + vars["LDFLAGS"] + ' ' + pass_on_options |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1124 + " -o " + octfile + ' ' + objfiles + ' ' + libfiles + ' ' |
26612
ab5cc8da283c
mkoctfile: restore LDFLAGS, warn only when LFLAGS used directly (bug #55447)
Mike Miller <mtmiller@octave.org>
parents:
26487
diff
changeset
|
1125 + ldflags + ' ' + vars["LFLAGS"] + ' ' + octave_libs + ' ' |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1126 + vars["OCT_LINK_OPTS"] + ' ' + vars["OCT_LINK_DEPS"]); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1127 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1128 int status = run_command (cmd, printonly); |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1129 |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1130 clean_up_tmp_files (tmp_objfiles); |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1131 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1132 if (status) |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1133 return status; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1134 } |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1135 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1136 if (strip) |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1137 { |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1138 std::string cmd = "strip " + octfile; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1139 |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1140 int status = run_command (cmd, printonly); |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1141 |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1142 if (status) |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1143 return status; |
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
|
1144 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
1145 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1146 return 0; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
1147 } |