Mercurial > octave
annotate src/mkoctfile.in.cc @ 33543:8f73f8534d42 default tip @
Return early if sort dimension exceeds array dimension (bug #65712)
It turn out that calling `sort (A, dim)` where dim is greater than `ndims (A)`
was creating a larger temp array to accommodate dim, so `sort (A, 1e9)` was
transiently using 8GB, while `sort (A, inf)` was causing either OOM or
a segfault, depending on the compiler and its settings.
This patch changes the internal code for array sorting so that when the sort
dimension exceeds the array's dimensions, the array is returned unchanged.
This is analogous to `all (true(3,3), 100)` and similar expressions.
* Array-base.cc (in function `Array<T, Alloc>::sort (int, sortmode)`):
Copy array and return early if sort dimension exceeds array dimension.
* data.cc (in Fsort): Add BISTs.
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Wed, 08 May 2024 08:07:49 -0400 |
parents | e20624df2cd2 |
children |
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 |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
3 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
32360
diff
changeset
|
5 // Copyright (C) 2008-2024 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
25 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
26 //////////////////////////////////////////////////////////////////////// |
8920 | 27 |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
28 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21202
diff
changeset
|
29 # include "config.h" |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
30 #endif |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
31 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
32 #include <string> |
15299
8bd5c490b787
Fix mex compilation with subdirs on Windows platforms (bug #37122)
Rik <rik@octave.org>
parents:
15271
diff
changeset
|
33 #include <cstring> |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
34 #include <map> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
35 #include <list> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
36 #include <algorithm> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
37 #include <iostream> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
38 #include <fstream> |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
39 #include <sstream> |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
40 #include <vector> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
41 #include <cstdlib> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
42 |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
43 #if defined (OCTAVE_USE_WINDOWS_API) |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
44 # include <locale> |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
45 # include <codecvt> |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
46 #endif |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
47 |
25504
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
48 // 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
|
49 // 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
|
50 // 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
|
51 // 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
|
52 // |
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
53 // 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
|
54 // 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
|
55 // 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
|
56 // 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
|
57 // CROSS is defined. |
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
58 |
21961
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
59 #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
|
60 # include <stdlib.h> |
21961
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
61 # include <sys/types.h> |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
62 # include <sys/wait.h> |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
63 # include <unistd.h> |
23801
9d67bd90681b
cross tools: define OCTAVE_UNUSED if not defined
John D <john.donoghue@ieee.org>
parents:
23757
diff
changeset
|
64 # ifndef OCTAVE_UNUSED |
9d67bd90681b
cross tools: define OCTAVE_UNUSED if not defined
John D <john.donoghue@ieee.org>
parents:
23757
diff
changeset
|
65 # define OCTAVE_UNUSED |
9d67bd90681b
cross tools: define OCTAVE_UNUSED if not defined
John D <john.donoghue@ieee.org>
parents:
23757
diff
changeset
|
66 # endif |
21961
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
67 #else |
29237
1af06a145d40
Un-set API flags when using functions without linking to shared library (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29141
diff
changeset
|
68 // We are linking against static libs so do not decorate with dllimport. |
1af06a145d40
Un-set API flags when using functions without linking to shared library (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29141
diff
changeset
|
69 // FIXME: This should be done by the build system. |
1af06a145d40
Un-set API flags when using functions without linking to shared library (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29141
diff
changeset
|
70 # undef OCTAVE_API |
1af06a145d40
Un-set API flags when using functions without linking to shared library (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29141
diff
changeset
|
71 # define OCTAVE_API |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
72 # include "mkostemps-wrapper.h" |
29006
139df373c107
Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents:
28882
diff
changeset
|
73 # include "uniconv-wrappers.h" |
21961
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
74 # include "unistd-wrappers.h" |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
75 # include "wait-wrappers.h" |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
76 #endif |
18916
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
18915
diff
changeset
|
77 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
78 #if ! defined (OCTAVE_VERSION) |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
79 # 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
|
80 #endif |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
81 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
82 #if ! defined (OCTAVE_PREFIX) |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
20955
diff
changeset
|
83 # 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
|
84 #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
|
85 |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
86 #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
|
87 # 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
|
88 #endif |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
89 |
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
|
90 #include "shared-fcns.h" |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
91 |
21961
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
92 #if defined (CROSS) |
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 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
|
95 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
|
96 { |
25504
ace13ff63b90
undo previous change; use 0 instead of O_BINARY
John W. Eaton <jwe@octave.org>
parents:
25503
diff
changeset
|
97 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
|
98 } |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
99 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
100 static int |
21961
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
101 octave_unlink_wrapper (const char *nm) |
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 unlink (nm); |
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 static bool |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
107 octave_wifexited_wrapper (int status) |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
108 { |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
109 return WIFEXITED (status); |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
110 } |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
111 |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
112 static int |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
113 octave_wexitstatus_wrapper (int status) |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
114 { |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
115 return WEXITSTATUS (status); |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
116 } |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
117 |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
118 #endif |
307a2d7ff29b
fix cross build of mkoctfile
John W. Eaton <jwe@octave.org>
parents:
21942
diff
changeset
|
119 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
120 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
|
121 get_line (FILE *fp) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
122 { |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
123 std::ostringstream buf; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
124 |
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
|
125 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
|
126 { |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
127 int c = std::fgetc (fp); |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
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 if (c == '\n' || c == EOF) |
12174 | 130 break; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
131 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
132 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
|
133 } |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
134 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
135 return buf.str (); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
136 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
137 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
138 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
|
139 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
|
140 { |
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
|
141 const char *val = getenv (name); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
142 |
17898
8c33abdd2f9a
maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents:
17789
diff
changeset
|
143 if (val && *val) |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
144 return std::string (val); |
17898
8c33abdd2f9a
maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents:
17789
diff
changeset
|
145 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
|
146 return defval; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
147 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
148 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
149 static std::string |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
150 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
|
151 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
152 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
|
153 return '"' + s + '"'; |
8332 | 154 else |
155 return s; | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
156 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
157 |
28882
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
158 static std::string |
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
159 replace_prefix (std::string s) |
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
160 { |
29554
99e3912441ec
build: Make relocation of dependencies with Octave optional (bug #60413).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
161 #if defined (OCTAVE_REPLACE_PREFIX) |
28882
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
162 const std::string match = "${prefix}"; |
30368
15ae4d97a632
mkoctfile: Correctly handle relocation in cross-compiler.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29699
diff
changeset
|
163 const std::string repl = Voctave_exec_home; |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29554
diff
changeset
|
164 std::size_t pos = s.find (match); |
28882
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
165 while (pos != std::string::npos ) |
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
166 { |
32284
265930c2158b
mkoctfile: Attempt to quote any replaced prefix parts (bug #64609).
John Donoghue <john.donoghue@ieee.org>
parents:
32282
diff
changeset
|
167 // Quote replacement path if the input isn't quoted. |
265930c2158b
mkoctfile: Attempt to quote any replaced prefix parts (bug #64609).
John Donoghue <john.donoghue@ieee.org>
parents:
32282
diff
changeset
|
168 if (pos > 0 && s[pos-1] != '"' && s[pos-1] != '\'') |
265930c2158b
mkoctfile: Attempt to quote any replaced prefix parts (bug #64609).
John Donoghue <john.donoghue@ieee.org>
parents:
32282
diff
changeset
|
169 s.replace (pos, match.length (), quote_path (repl)); |
265930c2158b
mkoctfile: Attempt to quote any replaced prefix parts (bug #64609).
John Donoghue <john.donoghue@ieee.org>
parents:
32282
diff
changeset
|
170 else |
265930c2158b
mkoctfile: Attempt to quote any replaced prefix parts (bug #64609).
John Donoghue <john.donoghue@ieee.org>
parents:
32282
diff
changeset
|
171 s.replace (pos, match.length (), repl); |
28882
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
172 pos = s.find (match); |
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
173 } |
29554
99e3912441ec
build: Make relocation of dependencies with Octave optional (bug #60413).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
174 #endif |
28882
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
175 |
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
176 return s; |
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
177 } |
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
178 |
28964
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
179 static std::map<std::string, std::string> |
28965
d24e34e179ab
mkoctfile: don't add DL_LDFLAGS to LDFLAGS if linking stand alone program
John W. Eaton <jwe@octave.org>
parents:
28964
diff
changeset
|
180 make_vars_map (bool link_stand_alone, bool verbose, bool debug) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
181 { |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
182 set_octave_home (); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
183 |
28964
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
184 std::map<std::string, std::string> vars; |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
185 |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
186 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
|
187 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
|
188 |
25556
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
189 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
|
190 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
|
191 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
|
192 vars["EXEEXT"] = %OCTAVE_EXEEXT%; |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
193 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
|
194 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
|
195 |
cbef9fc53fef
include all octave-config vars in mkoctfile (bug #54260)
John W. Eaton <jwe@octave.org>
parents:
25511
diff
changeset
|
196 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 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
|
202 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
|
203 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
|
204 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
|
205 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
|
206 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
|
207 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
|
208 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
|
209 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
|
210 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
|
211 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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 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
|
217 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
|
218 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
|
219 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
|
220 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
|
221 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
|
222 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
223 vars["OCTINCLUDEDIR"] |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
224 = 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
|
225 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
|
226 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
227 vars["INCLUDEDIR"] |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
228 = 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
|
229 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
|
230 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
231 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
|
232 = 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
|
233 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
234 vars["OCTLIBDIR"] |
27934
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
235 = get_variable ("OCTLIBDIR", |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
236 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
|
237 |
28831
bf427855cc9a
Change mkoctfile to print a usable default LDFLAGS on Windows platforms (bug #59173).
Rik <rik@octave.org>
parents:
28830
diff
changeset
|
238 std::string DEFAULT_INCFLAGS; |
bf427855cc9a
Change mkoctfile to print a usable default LDFLAGS on Windows platforms (bug #59173).
Rik <rik@octave.org>
parents:
28830
diff
changeset
|
239 |
21979
d04da18a407a
use OCTAVE_USE_WINDOWS_API more consistently
John W. Eaton <jwe@octave.org>
parents:
21961
diff
changeset
|
240 #if defined (OCTAVE_USE_WINDOWS_API) |
28831
bf427855cc9a
Change mkoctfile to print a usable default LDFLAGS on Windows platforms (bug #59173).
Rik <rik@octave.org>
parents:
28830
diff
changeset
|
241 DEFAULT_INCFLAGS = "-I" + quote_path (vars["OCTINCLUDEDIR"] + R"(\..)") |
bf427855cc9a
Change mkoctfile to print a usable default LDFLAGS on Windows platforms (bug #59173).
Rik <rik@octave.org>
parents:
28830
diff
changeset
|
242 + " -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
|
243 #else |
28831
bf427855cc9a
Change mkoctfile to print a usable default LDFLAGS on Windows platforms (bug #59173).
Rik <rik@octave.org>
parents:
28830
diff
changeset
|
244 DEFAULT_INCFLAGS = "-I" + quote_path (vars["OCTINCLUDEDIR"] + "/..") |
bf427855cc9a
Change mkoctfile to print a usable default LDFLAGS on Windows platforms (bug #59173).
Rik <rik@octave.org>
parents:
28830
diff
changeset
|
245 + " -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
|
246 #endif |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
247 |
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
|
248 if (vars["INCLUDEDIR"] != "/usr/include") |
8332 | 249 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
|
250 |
26422
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
251 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
|
252 |
29588
b4cb9d04f3cf
build: Use dynamic symbol lookup for functions in libraries on macOS (bug #53627).
Andrew Janke <andrew@apjanke.net>
parents:
29572
diff
changeset
|
253 #if (defined (OCTAVE_USE_WINDOWS_API) || defined (CROSS) || defined (OCTAVE_LINK_ALL_DEPS)) |
26431
ff6c90eb6f2d
mkoctfile.in.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26422
diff
changeset
|
254 // 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
|
255 // 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
|
256 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
|
257 #endif |
245de4f12ca3
link .oct files with liboctave and libinterp on Windows systems (bug #53627)
John W. Eaton <jwe@octave.org>
parents:
25447
diff
changeset
|
258 |
245de4f12ca3
link .oct files with liboctave and libinterp on Windows systems (bug #53627)
John W. Eaton <jwe@octave.org>
parents:
25447
diff
changeset
|
259 if (vars["LIBDIR"] != "/usr/lib") |
26422
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
260 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
|
261 |
28882
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
262 vars["CPPFLAGS"] = get_variable ("CPPFLAGS", |
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
263 replace_prefix (%OCTAVE_CONF_CPPFLAGS%)); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
264 |
8332 | 265 vars["INCFLAGS"] = get_variable ("INCFLAGS", DEFAULT_INCFLAGS); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
266 |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15458
diff
changeset
|
267 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
|
268 |
8332 | 269 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
|
270 |
8332 | 271 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
|
272 |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15458
diff
changeset
|
273 vars["CC"] = get_variable ("CC", %OCTAVE_CONF_MKOCTFILE_CC%); |
28964
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
274 if (verbose && vars["CC"] == "cc-msvc") |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
275 vars["CC"] += " -d"; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
276 |
8332 | 277 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
|
278 |
8332 | 279 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
|
280 |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15458
diff
changeset
|
281 vars["CXX"] = get_variable ("CXX", %OCTAVE_CONF_MKOCTFILE_CXX%); |
28964
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
282 if (verbose && vars["CXX"] == "cc-msvc") |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
283 vars["CXX"] += " -d"; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
284 |
8332 | 285 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
|
286 |
27425
633f7a8347c8
Clean up implementation of CXXLD in build scripts (bug #56505).
Rik <rik@octave.org>
parents:
27277
diff
changeset
|
287 vars["CXXLD"] = get_variable ("CXXLD", vars["CXX"]); |
28964
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
288 if (verbose && vars["CXXLD"] == "cc-msvc") |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
289 vars["CXXLD"] += " -d"; |
27425
633f7a8347c8
Clean up implementation of CXXLD in build scripts (bug #56505).
Rik <rik@octave.org>
parents:
27277
diff
changeset
|
290 |
8332 | 291 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
|
292 |
8332 | 293 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
|
294 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
295 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
|
296 %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
|
297 |
15944
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
298 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
|
299 |
15944
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
300 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
|
301 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
302 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
|
303 %OCTAVE_CONF_DEPEND_FLAGS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
304 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
305 vars["DEPEND_EXTRA_SED_PATTERN"] |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
306 = get_variable ("DEPEND_EXTRA_SED_PATTERN", |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
307 %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
|
308 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
309 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
|
310 %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
|
311 |
28965
d24e34e179ab
mkoctfile: don't add DL_LDFLAGS to LDFLAGS if linking stand alone program
John W. Eaton <jwe@octave.org>
parents:
28964
diff
changeset
|
312 if (! link_stand_alone) |
d24e34e179ab
mkoctfile: don't add DL_LDFLAGS to LDFLAGS if linking stand alone program
John W. Eaton <jwe@octave.org>
parents:
28964
diff
changeset
|
313 DEFAULT_LDFLAGS += ' ' + vars["DL_LDFLAGS"]; |
28832
6d50f931e810
mkoctfile.in.cc: Add DL_LDFLAGS to DEFAULT_LDFLAGS (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28831
diff
changeset
|
314 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
315 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
|
316 %OCTAVE_CONF_RDYNAMIC_FLAG%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
317 |
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
|
318 vars["LIBOCTAVE"] = "-loctave"; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
319 |
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
|
320 vars["LIBOCTINTERP"] = "-loctinterp"; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
321 |
31418
0c48b7e6f3cf
mkoctfile: Return configure result for READLINE_LIBS.
Markus Mützel <markus.muetzel@gmx.de>
parents:
30565
diff
changeset
|
322 vars["READLINE_LIBS"] = %OCTAVE_CONF_READLINE_LIBS%; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
323 |
11450
5eb10763069f
substitute and use LAPACK_LIBS in mkoctfile script
John W. Eaton <jwe@octave.org>
parents:
11251
diff
changeset
|
324 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
|
325 |
8332 | 326 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
|
327 |
28882
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
328 vars["FFTW3_LDFLAGS"] |
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
329 = get_variable ("FFTW3_LDFLAGS", |
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
330 replace_prefix (%OCTAVE_CONF_FFTW3_LDFLAGS%)); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
331 |
9538
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
332 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
|
333 |
28882
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
334 vars["FFTW3F_LDFLAGS"] |
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
335 = get_variable ("FFTW3F_LDFLAGS", |
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
336 replace_prefix (%OCTAVE_CONF_FFTW3F_LDFLAGS%)); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
337 |
9538
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
338 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
|
339 |
8332 | 340 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
|
341 |
28882
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
342 vars["FLIBS"] = get_variable ("FLIBS", |
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
343 replace_prefix (%OCTAVE_CONF_FLIBS%)); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
344 |
18349
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
345 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
|
346 %OCTAVE_CONF_MKOCTFILE_OCTAVE_LINK_DEPS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
347 |
18349
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
348 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
|
349 %OCTAVE_CONF_OCTAVE_LINK_OPTS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
350 |
18349
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
351 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
|
352 %OCTAVE_CONF_MKOCTFILE_OCT_LINK_DEPS%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
353 |
28882
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
354 vars["OCT_LINK_OPTS"] |
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
355 = get_variable ("OCT_LINK_OPTS", |
d7169f012ee1
mkoctfile: Account for different prefix on build and host system (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28860
diff
changeset
|
356 replace_prefix (%OCTAVE_CONF_OCT_LINK_OPTS%)); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
357 |
28831
bf427855cc9a
Change mkoctfile to print a usable default LDFLAGS on Windows platforms (bug #59173).
Rik <rik@octave.org>
parents:
28830
diff
changeset
|
358 vars["LDFLAGS"] = get_variable ("LDFLAGS", DEFAULT_LDFLAGS); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
359 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
360 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
|
361 %OCTAVE_CONF_LD_STATIC_FLAG%); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
362 |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
363 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
|
364 %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
|
365 vars["ALL_FFLAGS"] = vars["FFLAGS"] + ' ' + vars["F77_INTEGER8_FLAG"]; |
28964
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
366 if (debug) |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
367 vars["ALL_FFLAGS"] += " -g"; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
368 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
369 vars["ALL_CFLAGS"] |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
370 = vars["INCFLAGS"] + ' ' + vars["XTRA_CFLAGS"] + ' ' + vars["CFLAGS"]; |
28964
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
371 if (debug) |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
372 vars["ALL_CFLAGS"] += " -g"; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
373 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
374 vars["ALL_CXXFLAGS"] |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
375 = vars["INCFLAGS"] + ' ' + vars["XTRA_CXXFLAGS"] + ' ' + vars["CXXFLAGS"]; |
28964
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
376 if (debug) |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
377 vars["ALL_CXXFLAGS"] += " -g"; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
378 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
379 vars["ALL_LDFLAGS"] |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
380 = 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
|
381 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
382 vars["OCTAVE_LIBS"] |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
383 = (vars["LIBOCTINTERP"] + ' ' + vars["LIBOCTAVE"] + ' ' |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
384 + vars["SPECIAL_MATH_LIB"]); |
9538
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
385 |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
386 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
|
387 + vars["FFTW3F_LDFLAGS"] + ' ' + vars["FFTW3F_LIBS"]; |
28964
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
388 |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
389 return vars; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
390 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
391 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
392 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
|
393 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
394 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
|
395 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
396 static std::string help_msg = |
27934
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
397 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
398 "Options:\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
399 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
400 " -h, -?, --help Print this message.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
401 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
402 " -IDIR Add -IDIR to compile commands.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
403 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
404 " -idirafter DIR Add -idirafter DIR to compile commands.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
405 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
406 " -DDEF Add -DDEF to compile commands.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
407 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
408 " -lLIB Add library LIB to link command.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
409 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
410 " -LDIR Add -LDIR to link command.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
411 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
412 " -M, --depend Generate dependency files (.d) for C and C++\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
413 " source files.\n" |
21979
d04da18a407a
use OCTAVE_USE_WINDOWS_API more consistently
John W. Eaton <jwe@octave.org>
parents:
21961
diff
changeset
|
414 #if ! defined (OCTAVE_USE_WINDOWS_API) |
27934
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
415 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
416 " -pthread Add -pthread to link command.\n" |
18349
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
417 #endif |
27934
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
418 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
419 " -RDIR Add -RDIR to link command.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
420 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
421 " -Wl,... Pass flags though the linker like -Wl,-rpath=...\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
422 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
423 " -W... Pass flags though the compiler like -Wa,OPTION.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
424 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
425 " -c, --compile Compile, but do not link.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
426 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
427 " -o FILE, --output FILE Output filename. Default extension is .oct\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
428 " (or .mex if --mex is specified) unless linking\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
429 " a stand-alone executable.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
430 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
431 " -g Enable debugging options for compilers.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
432 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
433 " -p VAR, --print VAR Print configuration variable VAR. There are\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
434 " three categories of variables:\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
435 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
436 " Octave configuration variables that users may\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
437 " override with environment variables. These are\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
438 " used in commands that mkoctfile executes.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
439 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
440 " ALL_CFLAGS INCLUDEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
441 " ALL_CXXFLAGS LAPACK_LIBS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
442 " ALL_FFLAGS LDFLAGS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
443 " ALL_LDFLAGS LD_STATIC_FLAG\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
444 " BLAS_LIBS LIBDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
445 " CC LIBOCTAVE\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
446 " CFLAGS LIBOCTINTERP\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
447 " CPICFLAG OCTAVE_LINK_OPTS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
448 " CPPFLAGS OCTINCLUDEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
449 " CXX OCTAVE_LIBS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
450 " CXXFLAGS OCTAVE_LINK_DEPS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
451 " CXXLD OCTLIBDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
452 " CXXPICFLAG OCT_LINK_DEPS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
453 " DL_LDFLAGS OCT_LINK_OPTS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
454 " F77 RDYNAMIC_FLAG\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
455 " F77_INTEGER8_FLAG SPECIAL_MATH_LIB\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
456 " FFLAGS XTRA_CFLAGS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
457 " FPICFLAG XTRA_CXXFLAGS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
458 " INCFLAGS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
459 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
460 " Octave configuration variables as above, but\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
461 " currently unused by mkoctfile.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
462 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
463 " AR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
464 " DEPEND_EXTRA_SED_PATTERN\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
465 " DEPEND_FLAGS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
466 " FFTW3F_LDFLAGS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
467 " FFTW3F_LIBS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
468 " FFTW3_LDFLAGS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
469 " FFTW3_LIBS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
470 " FFTW_LIBS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
471 " FLIBS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
472 " LIBS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
473 " RANLIB\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
474 " READLINE_LIBS\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
475 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
476 " Octave configuration variables that are provided\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
477 " for informational purposes only. Except for\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
478 " OCTAVE_HOME and OCTAVE_EXEC_HOME, users may not\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
479 " override these variables.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
480 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
481 " If OCTAVE_HOME or OCTAVE_EXEC_HOME are set in\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
482 " the environment, then other variables are adjusted\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
483 " accordingly with OCTAVE_HOME or OCTAVE_EXEC_HOME\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
484 " substituted for the original value of the directory\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
485 " specified by the --prefix or --exec-prefix options\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
486 " that were used when Octave was configured.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
487 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
488 " API_VERSION LOCALFCNFILEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
489 " ARCHLIBDIR LOCALOCTFILEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
490 " BINDIR LOCALSTARTUPFILEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
491 " CANONICAL_HOST_TYPE LOCALVERARCHLIBDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
492 " DATADIR LOCALVERFCNFILEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
493 " DATAROOTDIR LOCALVEROCTFILEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
494 " DEFAULT_PAGER MAN1DIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
495 " EXEC_PREFIX MAN1EXT\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
496 " EXEEXT MANDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
497 " FCNFILEDIR OCTAVE_EXEC_HOME\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
498 " IMAGEDIR OCTAVE_HOME\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
499 " INFODIR OCTAVE_VERSION\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
500 " INFOFILE OCTDATADIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
501 " LIBEXECDIR OCTDOCDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
502 " LOCALAPIARCHLIBDIR OCTFILEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
503 " LOCALAPIFCNFILEDIR OCTFONTSDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
504 " LOCALAPIOCTFILEDIR STARTUPFILEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
505 " LOCALARCHLIBDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
506 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
507 " --link-stand-alone Link a stand-alone executable file.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
508 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
509 " --mex Assume we are creating a MEX file. Set the\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
510 " default output extension to \".mex\".\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
511 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
512 " -s, --strip Strip output file.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
513 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
514 " -n, --just-print, --dry-run\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
515 " Print commands, but do not execute them.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
516 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
517 " -v, --verbose Echo commands as they are executed.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
518 "\n" |
32680
25e8f63da459
Prefer --quiet to --silent in Octave.
Rik <rik@octave.org>
parents:
32632
diff
changeset
|
519 " --quiet Ignored. Intended to suppress output from\n" |
28058
cf59b503db2a
* mkoctfile.in.cc (main): Accept --silent option.
John W. Eaton <jwe@octave.org>
parents:
28048
diff
changeset
|
520 " compiler steps.\n" |
cf59b503db2a
* mkoctfile.in.cc (main): Accept --silent option.
John W. Eaton <jwe@octave.org>
parents:
28048
diff
changeset
|
521 "\n" |
27934
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
522 " FILE Compile or link FILE. Recognized file types are:\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
523 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
524 " .c C source\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
525 " .cc C++ source\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
526 " .cp C++ source\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
527 " .cpp C++ source\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
528 " .CPP C++ source\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
529 " .cxx C++ source\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
530 " .c++ C++ source\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
531 " .C C++ source\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
532 " .f Fortran source (fixed form)\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
533 " .F Fortran source (fixed form)\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
534 " .f90 Fortran source (free form)\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
535 " .F90 Fortran source (free form)\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
536 " .o object file\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
537 " .a library file\n" |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
538 #if defined (_MSC_VER) |
27934
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
539 " .lib library file\n" |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
540 #endif |
27934
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
541 "\n"; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
542 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
543 static std::string |
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
544 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
|
545 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
546 std::string retval; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
547 |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29554
diff
changeset
|
548 std::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
|
549 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
550 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
|
551 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
|
552 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
|
553 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
|
554 |
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
|
555 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
|
556 { |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29554
diff
changeset
|
557 std::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
|
558 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
559 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
|
560 ? 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
|
561 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
562 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
|
563 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
|
564 } |
15299
8bd5c490b787
Fix mex compilation with subdirs on Windows platforms (bug #37122)
Rik <rik@octave.org>
parents:
15271
diff
changeset
|
565 |
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
|
566 return retval; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
567 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
568 |
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
|
569 inline bool |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
570 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
|
571 { |
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
|
572 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
|
573 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
574 |
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
|
575 inline bool |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
576 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
|
577 { |
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
|
578 return (s.length () >= suffix.length () |
12174 | 579 && 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
|
580 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
581 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
582 static int |
28963
f29e4791a792
mkoctfile: eliminate global debug variable
John W. Eaton <jwe@octave.org>
parents:
28883
diff
changeset
|
583 run_command (const std::string& cmd, bool verbose, bool printonly = false) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
584 { |
22472
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
585 if (printonly) |
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
586 { |
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
587 std::cout << cmd << std::endl; |
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
588 return 0; |
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
589 } |
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
590 |
28963
f29e4791a792
mkoctfile: eliminate global debug variable
John W. Eaton <jwe@octave.org>
parents:
28883
diff
changeset
|
591 if (verbose) |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
592 std::cout << cmd << std::endl; |
18916
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
18915
diff
changeset
|
593 |
29141
f873857f5f86
system: Support executing commands with non-ASCII characters on Windows (bug #59572).
Markus Mützel <markus.muetzel@gmx.de>
parents:
29007
diff
changeset
|
594 // FIXME: Call _wsystem on Windows or octave::sys::system. |
18916
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
18915
diff
changeset
|
595 int result = system (cmd.c_str ()); |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
18915
diff
changeset
|
596 |
21927
6f62bd248919
use wrapper functions for mkoctfile and main
John W. Eaton <jwe@octave.org>
parents:
21852
diff
changeset
|
597 if (octave_wifexited_wrapper (result)) |
6f62bd248919
use wrapper functions for mkoctfile and main
John W. Eaton <jwe@octave.org>
parents:
21852
diff
changeset
|
598 result = octave_wexitstatus_wrapper (result); |
18916
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
18915
diff
changeset
|
599 |
5999e654f256
WIFEXITED and WEXITSTATUS macros for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
18915
diff
changeset
|
600 return result; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
601 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
602 |
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
|
603 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
|
604 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
|
605 { |
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
|
606 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
|
607 } |
96d02808a881
Support "true" or "yes" for %NO_OCT_FILE_STRIP% in mkoctfile.in.cc.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
15946
diff
changeset
|
608 |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
609 static std::string |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
610 get_temp_directory () |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
611 { |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
612 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
|
613 |
26853
b0f359a5ad35
mkoctfile: use the TMPDIR environment variable if set (bug #55814)
Mike Miller <mtmiller@octave.org>
parents:
26612
diff
changeset
|
614 tempd = octave_getenv ("TMPDIR"); |
b0f359a5ad35
mkoctfile: use the TMPDIR environment variable if set (bug #55814)
Mike Miller <mtmiller@octave.org>
parents:
26612
diff
changeset
|
615 |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
616 #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
|
617 |
26853
b0f359a5ad35
mkoctfile: use the TMPDIR environment variable if set (bug #55814)
Mike Miller <mtmiller@octave.org>
parents:
26612
diff
changeset
|
618 if (tempd.empty ()) |
b0f359a5ad35
mkoctfile: use the TMPDIR environment variable if set (bug #55814)
Mike Miller <mtmiller@octave.org>
parents:
26612
diff
changeset
|
619 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
|
620 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
621 if (tempd.empty ()) |
26370
190702f4a075
mkoctfile.in.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26363
diff
changeset
|
622 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
|
623 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
624 #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
|
625 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
|
626 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
|
627 #endif |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
628 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
629 // 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
|
630 // 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
|
631 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
|
632 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
|
633 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
634 #else |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
635 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
636 #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
|
637 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
|
638 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
|
639 #else |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
640 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
|
641 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
|
642 #endif |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
643 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
644 #endif |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
645 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
646 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
|
647 } |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
648 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
649 static std::string |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
650 create_interleaved_complex_file () |
28124
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
651 { |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
652 std::string tmpl = get_temp_directory () + "/oct-XXXXXX.c"; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
653 |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
654 char *ctmpl = new char [tmpl.length () + 1]; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
655 |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
656 ctmpl = strcpy (ctmpl, tmpl.c_str ()); |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
657 |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
658 // mkostemps will open the file and return a file descriptor. We |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
659 // won't worry about closing it because we will need the file until we |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
660 // are done and then the file will be closed when mkoctfile exits. |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
661 int fd = octave_mkostemps_wrapper (ctmpl, 2); |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
662 |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
663 // Make C++ string from filled-in template. |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
664 std::string retval (ctmpl); |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
665 delete [] ctmpl; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
666 |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
667 // Write symbol definition to file. |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
668 FILE *fid = fdopen (fd, "w"); |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
669 fputs ("const int __mx_has_interleaved_complex__ = 1;\n", fid); |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
670 fclose (fid); |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
671 |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
672 return retval; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
673 } |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
674 |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
675 static std::string |
31771
21f9b34eb893
maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents:
31707
diff
changeset
|
676 tmp_objfile_name () |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
677 { |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
678 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
|
679 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
680 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
|
681 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
682 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
|
683 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
684 // 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
|
685 // 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
|
686 // 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
|
687 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
|
688 |
26487 | 689 std::string retval (ctmpl); // make C++ string from filled-in template |
690 delete [] ctmpl; | |
691 | |
692 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
|
693 } |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
694 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
695 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
|
696 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
|
697 { |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
698 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
|
699 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
|
700 } |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
701 |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
702 #if defined (OCTAVE_USE_WINDOWS_API) && defined (_UNICODE) |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
703 extern "C" |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
704 int |
29699
b98ae05c6b7e
avoid possible buffer corruption introduced in b6f80b1d448f
John W. Eaton <jwe@octave.org>
parents:
29657
diff
changeset
|
705 wmain (int argc, wchar_t **sys_argv) |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
706 { |
29699
b98ae05c6b7e
avoid possible buffer corruption introduced in b6f80b1d448f
John W. Eaton <jwe@octave.org>
parents:
29657
diff
changeset
|
707 std::vector<std::string> argv; |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
708 |
29699
b98ae05c6b7e
avoid possible buffer corruption introduced in b6f80b1d448f
John W. Eaton <jwe@octave.org>
parents:
29657
diff
changeset
|
709 // Convert wide character strings to multibyte UTF-8 strings and save |
b98ae05c6b7e
avoid possible buffer corruption introduced in b6f80b1d448f
John W. Eaton <jwe@octave.org>
parents:
29657
diff
changeset
|
710 // them in a vector of std::string objects for later processing. |
b98ae05c6b7e
avoid possible buffer corruption introduced in b6f80b1d448f
John W. Eaton <jwe@octave.org>
parents:
29657
diff
changeset
|
711 |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
712 std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> wchar_conv; |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
713 for (int i_arg = 0; i_arg < argc; i_arg++) |
29699
b98ae05c6b7e
avoid possible buffer corruption introduced in b6f80b1d448f
John W. Eaton <jwe@octave.org>
parents:
29657
diff
changeset
|
714 argv.push_back (wchar_conv.to_bytes (sys_argv[i_arg])); |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
715 #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
|
716 int |
29699
b98ae05c6b7e
avoid possible buffer corruption introduced in b6f80b1d448f
John W. Eaton <jwe@octave.org>
parents:
29657
diff
changeset
|
717 main (int argc, char **sys_argv) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
718 { |
29699
b98ae05c6b7e
avoid possible buffer corruption introduced in b6f80b1d448f
John W. Eaton <jwe@octave.org>
parents:
29657
diff
changeset
|
719 std::vector<std::string> argv; |
b98ae05c6b7e
avoid possible buffer corruption introduced in b6f80b1d448f
John W. Eaton <jwe@octave.org>
parents:
29657
diff
changeset
|
720 |
b98ae05c6b7e
avoid possible buffer corruption introduced in b6f80b1d448f
John W. Eaton <jwe@octave.org>
parents:
29657
diff
changeset
|
721 // Save args as vector of std::string objects for later processing. |
b98ae05c6b7e
avoid possible buffer corruption introduced in b6f80b1d448f
John W. Eaton <jwe@octave.org>
parents:
29657
diff
changeset
|
722 for (int i_arg = 0; i_arg < argc; i_arg++) |
b98ae05c6b7e
avoid possible buffer corruption introduced in b6f80b1d448f
John W. Eaton <jwe@octave.org>
parents:
29657
diff
changeset
|
723 argv.push_back (sys_argv[i_arg]); |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
724 #endif |
29699
b98ae05c6b7e
avoid possible buffer corruption introduced in b6f80b1d448f
John W. Eaton <jwe@octave.org>
parents:
29657
diff
changeset
|
725 |
30398
d4d83344d653
maint: style check C++ files in src/ and libgui/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
30386
diff
changeset
|
726 if (argc == 1) |
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
|
727 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
728 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
|
729 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
|
730 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
731 |
29699
b98ae05c6b7e
avoid possible buffer corruption introduced in b6f80b1d448f
John W. Eaton <jwe@octave.org>
parents:
29657
diff
changeset
|
732 if (argc == 2 && (argv[1] == "-v" || argv[1] == "-version" |
b98ae05c6b7e
avoid possible buffer corruption introduced in b6f80b1d448f
John W. Eaton <jwe@octave.org>
parents:
29657
diff
changeset
|
733 || 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
|
734 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
735 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
|
736 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
|
737 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
738 |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
739 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
|
740 std::string output_ext = ".oct"; |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
741 std::string objfiles, libfiles, octfile, outputfile; |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
742 std::string incflags, defs, ldflags, pass_on_options; |
28964
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
743 std::string var_to_print; |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
744 bool debug = false; |
28963
f29e4791a792
mkoctfile: eliminate global debug variable
John W. Eaton <jwe@octave.org>
parents:
28883
diff
changeset
|
745 bool verbose = false; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
746 bool strip = false; |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
747 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
|
748 bool compile_only = false; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
749 bool link_stand_alone = false; |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
750 bool depend = false; |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
751 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
|
752 bool output_file_option = false; |
28124
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
753 bool creating_mex_file = false; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
754 bool r2017b_option = false; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
755 bool r2018a_option = false; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
756 // The default for this may change in the future. |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
757 bool mx_has_interleaved_complex = false; |
32359
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
758 bool pass_on_followup = false; |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
759 |
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
|
760 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
|
761 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
762 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
|
763 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
764 std::string file; |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
765 |
32359
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
766 bool found_unknown_dash_arg = false; |
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
767 |
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
|
768 if (ends_with (arg, ".c")) |
12174 | 769 { |
770 file = arg; | |
771 cfiles.push_back (file); | |
772 } | |
22031
2cfbb6b25428
mkoctfile: support more file extensions for C++ sources (bug #48381)
Mike Miller <mtmiller@octave.org>
parents:
22022
diff
changeset
|
773 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
|
774 || 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
|
775 || 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
|
776 || ends_with (arg, ".C")) |
12174 | 777 { |
778 file = arg; | |
779 ccfiles.push_back (file); | |
780 } | |
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
|
781 else if (ends_with (arg, ".f") || ends_with (arg, ".F") |
12174 | 782 || ends_with (arg, "f90") || ends_with (arg, ".F90")) |
783 { | |
784 file = arg; | |
785 f77files.push_back (file); | |
786 } | |
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
|
787 else if (ends_with (arg, ".o") || ends_with (arg, ".obj")) |
12174 | 788 { |
789 file = arg; | |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
790 objfiles += (' ' + quote_path (arg)); |
12174 | 791 } |
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
|
792 else if (ends_with (arg, ".lib") || ends_with (arg, ".a")) |
12174 | 793 { |
794 file = arg; | |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
795 libfiles += (' ' + quote_path (arg)); |
12174 | 796 } |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
797 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
|
798 || arg == "-v" || arg == "-verbose" || arg == "--verbose") |
12174 | 799 { |
28963
f29e4791a792
mkoctfile: eliminate global debug variable
John W. Eaton <jwe@octave.org>
parents:
28883
diff
changeset
|
800 verbose = true; |
12174 | 801 } |
32680
25e8f63da459
Prefer --quiet to --silent in Octave.
Rik <rik@octave.org>
parents:
32632
diff
changeset
|
802 else if (arg == "-silent" || arg == "--silent" |
25e8f63da459
Prefer --quiet to --silent in Octave.
Rik <rik@octave.org>
parents:
32632
diff
changeset
|
803 || arg == "-quiet" || arg == "--quiet") |
28058
cf59b503db2a
* mkoctfile.in.cc (main): Accept --silent option.
John W. Eaton <jwe@octave.org>
parents:
28048
diff
changeset
|
804 { |
cf59b503db2a
* mkoctfile.in.cc (main): Accept --silent option.
John W. Eaton <jwe@octave.org>
parents:
28048
diff
changeset
|
805 // Ignored for now. |
cf59b503db2a
* mkoctfile.in.cc (main): Accept --silent option.
John W. Eaton <jwe@octave.org>
parents:
28048
diff
changeset
|
806 } |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
807 else if (arg == "-h" || arg == "-?" || arg == "-help" || arg == "--help") |
12174 | 808 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
809 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
|
810 std::cout << help_msg << std::endl; |
12174 | 811 return 0; |
812 } | |
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
|
813 else if (starts_with (arg, "-I")) |
12174 | 814 { |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
815 incflags += (' ' + quote_path (arg)); |
12174 | 816 } |
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
|
817 else if (arg == "-idirafter") |
12174 | 818 { |
819 if (i < argc-1) | |
820 { | |
821 arg = argv[++i]; | |
822 incflags += (" -idirafter " + arg); | |
823 } | |
824 else | |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
825 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
|
826 << std::endl; |
12174 | 827 } |
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
|
828 else if (starts_with (arg, "-D")) |
12174 | 829 { |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
830 defs += (' ' + arg); |
12174 | 831 } |
22461
cc4f31e8477f
Accept, but ignore, mex argument -largeArrayDims, -compatibleArrayDims (bug #39984).
Rik <rik@octave.org>
parents:
22459
diff
changeset
|
832 else if (arg == "-largeArrayDims" || arg == "-compatibleArrayDims") |
cc4f31e8477f
Accept, but ignore, mex argument -largeArrayDims, -compatibleArrayDims (bug #39984).
Rik <rik@octave.org>
parents:
22459
diff
changeset
|
833 { |
28966
b02d9109fb6e
mkoctfile: prefix warning messages with program name
John W. Eaton <jwe@octave.org>
parents:
28965
diff
changeset
|
834 std::cerr << "mkoctfile: 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
|
835 } |
28124
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
836 else if (arg == "-R2017b") |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
837 { |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
838 if (r2018a_option) |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
839 { |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
840 std::cerr << "mkoctfile: only one of -R2017b and -R2018a may be used" << std::endl; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
841 return 1; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
842 } |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
843 |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
844 r2017b_option = true; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
845 } |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
846 else if (arg == "-R2018a") |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
847 { |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
848 if (r2017b_option) |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
849 { |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
850 std::cerr << "mkoctfile: only one of -R2017b and -R2018a may be used" << std::endl; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
851 return 1; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
852 } |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
853 |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
854 r2018a_option = true; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
855 mx_has_interleaved_complex = true; |
22461
cc4f31e8477f
Accept, but ignore, mex argument -largeArrayDims, -compatibleArrayDims (bug #39984).
Rik <rik@octave.org>
parents:
22459
diff
changeset
|
856 } |
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
|
857 else if (starts_with (arg, "-Wl,") || starts_with (arg, "-l") |
12174 | 858 || starts_with (arg, "-L") || starts_with (arg, "-R")) |
859 { | |
28129
16ccaebe250a
mkoctfile: quote linker arguments that may contain spaces (bug #57878)
Mike Miller <mtmiller@octave.org>
parents:
28058
diff
changeset
|
860 ldflags += (' ' + quote_path (arg)); |
12174 | 861 } |
21979
d04da18a407a
use OCTAVE_USE_WINDOWS_API more consistently
John W. Eaton <jwe@octave.org>
parents:
21961
diff
changeset
|
862 #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
|
863 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
|
864 { |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
865 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
|
866 } |
50505bf88b82
make octave-config and mkoctfile consistent with last shell script versions
John W. Eaton <jwe@octave.org>
parents:
18342
diff
changeset
|
867 #endif |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
868 else if (arg == "-M" || arg == "-depend" || arg == "--depend") |
12174 | 869 { |
870 depend = true; | |
871 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
872 else if (arg == "-o" || arg == "-output" || arg == "--output") |
12174 | 873 { |
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
|
874 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
|
875 |
12174 | 876 if (i < argc-1) |
877 { | |
878 arg = argv[++i]; | |
879 outputfile = arg; | |
880 } | |
881 else | |
20713
2469d78a1d8b
Consistently use 'filename' rather than 'file name' throughout code base.
Rik <rik@octave.org>
parents:
20507
diff
changeset
|
882 std::cerr << "mkoctfile: output filename missing" << std::endl; |
12174 | 883 } |
22481
541a20a4961c
mkoctfile: alias --dry-run option to --just-print because it's very common.
Carnë Draug <carandraug@octave.org>
parents:
22472
diff
changeset
|
884 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
|
885 { |
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
886 printonly = true; |
76f2b0436423
Add -n option to print, not execute, mkoctfile commands.
Rik <rik@octave.org>
parents:
22461
diff
changeset
|
887 } |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
888 else if (arg == "-p" || arg == "-print" || arg == "--print") |
12174 | 889 { |
890 if (i < argc-1) | |
891 { | |
28964
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
892 ++i; |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
893 |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
894 if (! var_to_print.empty ()) |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
895 std::cerr << "mkoctfile: warning: only one '" << arg |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
896 << "' option will be processed" << std::endl; |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
897 else |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
898 var_to_print = argv[i]; |
12174 | 899 } |
900 else | |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
901 std::cerr << "mkoctfile: --print requires argument" << std::endl; |
12174 | 902 } |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
903 else if (arg == "-s" || arg == "-strip" || arg == "--strip") |
12174 | 904 { |
905 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
|
906 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
|
907 << std::endl; |
12174 | 908 else |
909 strip = true; | |
910 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
911 else if (arg == "-c" || arg == "-compile" || arg == "--compile") |
12174 | 912 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
913 compile_only = true; |
12174 | 914 } |
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
|
915 else if (arg == "-g") |
12174 | 916 { |
28964
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
917 debug = true; |
12174 | 918 } |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
919 else if (arg == "-link-stand-alone" || arg == "--link-stand-alone") |
12174 | 920 { |
921 link_stand_alone = true; | |
922 } | |
9955
33537a4d223f
mkoctfile.cc.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
923 else if (arg == "-mex" || arg == "--mex") |
12174 | 924 { |
28124
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
925 creating_mex_file = true; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
926 |
12174 | 927 incflags += " -I."; |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
928 #if defined (_MSC_VER) |
12174 | 929 ldflags += " -Wl,-export:mexFunction"; |
9303
adf676387922
properly #ifdef MSVC linker specific flags
Benjamin Lindner <lindnerb@users.sourceforge.net>
parents:
9245
diff
changeset
|
930 #endif |
12174 | 931 output_ext = ".mex"; |
932 } | |
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
|
933 else if (starts_with (arg, "-W")) |
12174 | 934 { |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
935 pass_on_options += (' ' + arg); |
12174 | 936 } |
24742
9db2f757c7c0
Accept -O as an argument to mkoctfile (bug #53099).
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
937 else if (starts_with (arg, "-O")) |
9db2f757c7c0
Accept -O as an argument to mkoctfile (bug #53099).
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
938 { |
9db2f757c7c0
Accept -O as an argument to mkoctfile (bug #53099).
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
939 pass_on_options += (' ' + arg); |
9db2f757c7c0
Accept -O as an argument to mkoctfile (bug #53099).
Rik <rik@octave.org>
parents:
24634
diff
changeset
|
940 } |
19711
b59aabc08e63
Pass unrecognized '-' arguments through mkoctfile to compiler (bug #34169).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
941 else if (starts_with (arg, "-")) |
b59aabc08e63
Pass unrecognized '-' arguments through mkoctfile to compiler (bug #34169).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
942 { |
32359
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
943 found_unknown_dash_arg = true; |
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
944 |
24634
ab2321d4ba03
maint: strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
24622
diff
changeset
|
945 // 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
|
946 pass_on_options += (' ' + arg); |
32359
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
947 |
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
948 // Don't pass on the final position which is typically a file. |
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
949 // FIXME: Does it make sense to have that exception for the last |
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
950 // argument? |
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
951 if (i < argc-2) |
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
952 pass_on_followup = true; |
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
953 } |
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
954 else if (pass_on_followup) |
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
955 { |
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
956 // Pass through a followup argument. |
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
957 pass_on_options += (' ' + arg); |
19711
b59aabc08e63
Pass unrecognized '-' arguments through mkoctfile to compiler (bug #34169).
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
958 } |
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
|
959 else |
12174 | 960 { |
18796
dd57ca9ef7e4
Add missing newline to error message from mkoctfile.
Rik <rik@octave.org>
parents:
18364
diff
changeset
|
961 std::cerr << "mkoctfile: unrecognized argument " << arg << std::endl; |
12174 | 962 return 1; |
963 } | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
964 |
32359
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
965 // reset pass_on_followup if anything but an unknown argument was found |
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
966 if (! found_unknown_dash_arg) |
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
967 pass_on_followup = false; |
f760ab971d40
mkoctfile: Prefer parsing over passing on argument after unknown argument (bug #64725).
Markus Mützel <markus.muetzel@gmx.de>
parents:
32281
diff
changeset
|
968 |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
969 if (! file.empty () && octfile.empty ()) |
12174 | 970 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
|
971 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
972 |
28965
d24e34e179ab
mkoctfile: don't add DL_LDFLAGS to LDFLAGS if linking stand alone program
John W. Eaton <jwe@octave.org>
parents:
28964
diff
changeset
|
973 std::map<std::string, std::string> vars |
d24e34e179ab
mkoctfile: don't add DL_LDFLAGS to LDFLAGS if linking stand alone program
John W. Eaton <jwe@octave.org>
parents:
28964
diff
changeset
|
974 = make_vars_map (link_stand_alone, verbose, debug); |
28964
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
975 |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
976 if (! var_to_print.empty ()) |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
977 { |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
978 if (vars.find (var_to_print) == vars.end ()) |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
979 { |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
980 std::cerr << "mkoctfile: unknown variable '" << var_to_print << "'" |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
981 << std::endl; |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
982 return 1; |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
983 } |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
984 |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
985 std::cout << vars[var_to_print] << std::endl; |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
986 |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
987 return 0; |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
988 } |
091aeae73b60
mkoctfile: revamp argument parsing
John W. Eaton <jwe@octave.org>
parents:
28963
diff
changeset
|
989 |
28124
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
990 if (creating_mex_file) |
22459
6af82fc041a4
Implement Matlab-compatible MEX functions mxAssert and mxAssertS.
Rik <rik@octave.org>
parents:
22412
diff
changeset
|
991 { |
28124
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
992 if (vars["ALL_CFLAGS"].find ("-g") != std::string::npos) |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
993 defs += " -DMEX_DEBUG"; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
994 |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
995 if (mx_has_interleaved_complex) |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
996 { |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
997 defs += " -DMX_HAS_INTERLEAVED_COMPLEX=1"; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
998 |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
999 if (! compile_only) |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1000 { |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1001 // Create tmp C source file that defines an extern symbol |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1002 // that can be checked when loading the mex file to |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1003 // determine that the file was compiled expecting |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1004 // interleaved complex values. |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1005 |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1006 std::string tmp_file = create_interleaved_complex_file (); |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1007 |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1008 cfiles.push_back (tmp_file); |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1009 } |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1010 } |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1011 } |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1012 else |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1013 { |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1014 if (r2017b_option) |
28966
b02d9109fb6e
mkoctfile: prefix warning messages with program name
John W. Eaton <jwe@octave.org>
parents:
28965
diff
changeset
|
1015 std::cerr << "mkoctfile: warning: -R2017b option ignored unless creating mex file" |
28124
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1016 << std::endl; |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1017 |
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1018 if (r2018a_option) |
28966
b02d9109fb6e
mkoctfile: prefix warning messages with program name
John W. Eaton <jwe@octave.org>
parents:
28965
diff
changeset
|
1019 std::cerr << "mkoctfile: warning: -R2018a option ignored unless creating mex file" |
28124
5b37e5e03bb5
mkoctfile.cc: accept -R2017b and -R2018a mex options
John W. Eaton <jwe@octave.org>
parents:
28058
diff
changeset
|
1020 << std::endl; |
22459
6af82fc041a4
Implement Matlab-compatible MEX functions mxAssert and mxAssertS.
Rik <rik@octave.org>
parents:
22412
diff
changeset
|
1021 } |
6af82fc041a4
Implement Matlab-compatible MEX functions mxAssert and mxAssertS.
Rik <rik@octave.org>
parents:
22412
diff
changeset
|
1022 |
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
|
1023 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
|
1024 && (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
|
1025 { |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1026 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
|
1027 << std::endl; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1028 return 1; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1029 } |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1030 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1031 std::string output_option; |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1032 |
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
|
1033 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
|
1034 { |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
1035 if (! outputfile.empty ()) |
12174 | 1036 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
|
1037 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
1038 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
|
1039 { |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
1040 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
|
1041 { |
25495
92a64cb5e475
mkoctfile: Prevent invalid string indexing crash.
John W. Eaton <jwe@octave.org>
parents:
25494
diff
changeset
|
1042 // 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
|
1043 // 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
|
1044 // length. |
92a64cb5e475
mkoctfile: Prevent invalid string indexing crash.
John W. Eaton <jwe@octave.org>
parents:
25494
diff
changeset
|
1045 |
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
|
1046 octfile = outputfile; |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29554
diff
changeset
|
1047 std::size_t len = octfile.length (); |
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29554
diff
changeset
|
1048 std::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
|
1049 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
|
1050 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
|
1051 } |
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
|
1052 else |
12174 | 1053 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
|
1054 } |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
1055 |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
1056 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
|
1057 { |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1058 #if defined (OCTAVE_USE_WINDOWS_API) && ! defined (_UNICODE) |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1059 std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> wchar_conv; |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1060 #endif |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1061 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1062 for (const auto& f : cfiles) |
12174 | 1063 { |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1064 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
|
1065 |
21927
6f62bd248919
use wrapper functions for mkoctfile and main
John W. Eaton <jwe@octave.org>
parents:
21852
diff
changeset
|
1066 octave_unlink_wrapper (dfile.c_str ()); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1067 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1068 std::string cmd |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
1069 = (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
|
1070 + 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
|
1071 + 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
|
1072 |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1073 #if defined (OCTAVE_USE_WINDOWS_API) |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1074 FILE *fd; |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1075 try |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1076 { |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1077 std::wstring wcmd = wchar_conv.from_bytes (cmd); |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1078 fd = ::_wpopen (wcmd.c_str (), L"r"); |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1079 } |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1080 catch (const std::range_error& e) |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1081 { |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1082 fd = ::popen (cmd.c_str (), "r"); |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1083 } |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1084 |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1085 std::ofstream fo; |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1086 try |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1087 { |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1088 std::wstring wfile = wchar_conv.from_bytes (dfile); |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1089 fo.open (wfile.c_str ()); |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1090 } |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1091 catch (const std::range_error& e) |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1092 { |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1093 fo.open (dfile.c_str ()); |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1094 } |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1095 #else |
12174 | 1096 FILE *fd = popen (cmd.c_str (), "r"); |
29006
139df373c107
Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents:
28882
diff
changeset
|
1097 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
1098 std::ofstream fo (dfile.c_str ()); |
29006
139df373c107
Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents:
28882
diff
changeset
|
1099 #endif |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1100 |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29554
diff
changeset
|
1101 std::size_t pos; |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
1102 while (! feof (fd)) |
12174 | 1103 { |
1104 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
|
1105 if ((pos = line.rfind (".o:")) != std::string::npos) |
12174 | 1106 { |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29554
diff
changeset
|
1107 std::size_t spos = line.rfind ('/', pos); |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26853
diff
changeset
|
1108 std::string ofile |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26853
diff
changeset
|
1109 = (spos == std::string::npos |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26853
diff
changeset
|
1110 ? line.substr (0, pos+2) |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26853
diff
changeset
|
1111 : 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
|
1112 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
|
1113 << dfile << line.substr (pos) << std::endl; |
12174 | 1114 } |
1115 else | |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
1116 fo << line << std::endl; |
12174 | 1117 } |
1118 pclose (fd); | |
1119 fo.close (); | |
1120 } | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
1121 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1122 for (const auto& f : ccfiles) |
12174 | 1123 { |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1124 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
|
1125 |
21927
6f62bd248919
use wrapper functions for mkoctfile and main
John W. Eaton <jwe@octave.org>
parents:
21852
diff
changeset
|
1126 octave_unlink_wrapper (dfile.c_str ()); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1127 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1128 std::string cmd |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
1129 = (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
|
1130 + 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
|
1131 + 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
|
1132 |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1133 #if defined (OCTAVE_USE_WINDOWS_API) |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1134 FILE *fd; |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1135 try |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1136 { |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1137 std::wstring wcmd = wchar_conv.from_bytes (cmd); |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1138 fd = ::_wpopen (wcmd.c_str (), L"r"); |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1139 } |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1140 catch (const std::range_error& e) |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1141 { |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1142 fd = ::popen (cmd.c_str (), "r"); |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1143 } |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1144 |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1145 std::ofstream fo; |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1146 try |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1147 { |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1148 std::wstring wfile = wchar_conv.from_bytes (dfile); |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1149 fo.open (wfile.c_str ()); |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1150 } |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1151 catch (const std::range_error& e) |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1152 { |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1153 fo.open (dfile.c_str ()); |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1154 } |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1155 #else |
12174 | 1156 FILE *fd = popen (cmd.c_str (), "r"); |
29006
139df373c107
Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents:
28882
diff
changeset
|
1157 |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
1158 std::ofstream fo (dfile.c_str ()); |
29006
139df373c107
Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents:
28882
diff
changeset
|
1159 #endif |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29359
diff
changeset
|
1160 |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29554
diff
changeset
|
1161 std::size_t pos; |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
1162 while (! feof (fd)) |
12174 | 1163 { |
1164 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
|
1165 if ((pos = line.rfind (".o:")) != std::string::npos) |
12174 | 1166 { |
29654
d13d090cb03a
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29554
diff
changeset
|
1167 std::size_t spos = line.rfind ('/', pos); |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26853
diff
changeset
|
1168 std::string ofile |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26853
diff
changeset
|
1169 = (spos == std::string::npos |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26853
diff
changeset
|
1170 ? line.substr (0, pos+2) |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
26853
diff
changeset
|
1171 : 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
|
1172 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
|
1173 << dfile << line.substr (pos+2) << std::endl; |
12174 | 1174 } |
1175 else | |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
1176 fo << line << std::endl; |
12174 | 1177 } |
1178 pclose (fd); | |
1179 fo.close (); | |
1180 } | |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
1181 |
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
|
1182 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
|
1183 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
1184 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1185 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
|
1186 { |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
1187 if (! vars["F77"].empty ()) |
12174 | 1188 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
1189 std::string o; |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1190 if (compile_only) |
12174 | 1191 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1192 if (! outputfile.empty ()) |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1193 o = outputfile; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1194 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
|
1195 o = basename (f, true) + ".o"; |
12174 | 1196 } |
1197 else | |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1198 { |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1199 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
|
1200 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1201 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
|
1202 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1203 objfiles += (' ' + o); |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1204 } |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1205 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1206 std::string cmd |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
1207 = (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
|
1208 + vars["ALL_FFLAGS"] + ' ' + incflags + ' ' + defs + ' ' |
30533
022747aca7fe
mkoctfile.in.cc: Quote file names in Fortran compiler command.
Gene Harvey <gharveymn@gmail.com>
parents:
30398
diff
changeset
|
1209 + pass_on_options + ' ' + quote_path (f) |
022747aca7fe
mkoctfile.in.cc: Quote file names in Fortran compiler command.
Gene Harvey <gharveymn@gmail.com>
parents:
30398
diff
changeset
|
1210 + " -o " + quote_path (o)); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1211 |
28963
f29e4791a792
mkoctfile: eliminate global debug variable
John W. Eaton <jwe@octave.org>
parents:
28883
diff
changeset
|
1212 int status = run_command (cmd, verbose, printonly); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1213 |
25510
2710440ea566
mkoctfile: fix logic error with handling of -c option (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25507
diff
changeset
|
1214 if (status) |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1215 return status; |
12174 | 1216 } |
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
|
1217 else |
12174 | 1218 { |
18796
dd57ca9ef7e4
Add missing newline to error message from mkoctfile.
Rik <rik@octave.org>
parents:
18364
diff
changeset
|
1219 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
|
1220 << std::endl; |
12174 | 1221 return 1; |
1222 } | |
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
|
1223 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
1224 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1225 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
|
1226 { |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
1227 if (! vars["CC"].empty ()) |
12174 | 1228 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1229 std::string o; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1230 if (compile_only) |
12174 | 1231 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1232 if (! outputfile.empty ()) |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1233 o = outputfile; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1234 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
|
1235 o = basename (f, true) + ".o"; |
12174 | 1236 } |
1237 else | |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1238 { |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1239 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
|
1240 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1241 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
|
1242 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1243 objfiles += (' ' + o); |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1244 } |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1245 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1246 std::string cmd |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
1247 = (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
|
1248 + 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
|
1249 + pass_on_options + ' ' + incflags + ' ' + defs + ' ' |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1250 + quote_path (f) + " -o " + quote_path (o)); |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1251 |
28963
f29e4791a792
mkoctfile: eliminate global debug variable
John W. Eaton <jwe@octave.org>
parents:
28883
diff
changeset
|
1252 int status = run_command (cmd, verbose, printonly); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1253 |
25510
2710440ea566
mkoctfile: fix logic error with handling of -c option (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25507
diff
changeset
|
1254 if (status) |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1255 return status; |
12174 | 1256 } |
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
|
1257 else |
12174 | 1258 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
1259 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
|
1260 << std::endl; |
12174 | 1261 return 1; |
1262 } | |
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
|
1263 } |
12174 | 1264 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1265 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
|
1266 { |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
1267 if (! vars["CXX"].empty ()) |
12174 | 1268 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1269 std::string o; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1270 if (compile_only) |
12174 | 1271 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1272 if (! outputfile.empty ()) |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1273 o = outputfile; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1274 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
|
1275 o = basename (f, true) + ".o"; |
12174 | 1276 } |
1277 else | |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1278 { |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1279 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
|
1280 |
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1281 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
|
1282 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1283 objfiles += (' ' + o); |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1284 } |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1285 |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1286 std::string cmd |
23807
336f89b6208b
Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents:
23804
diff
changeset
|
1287 = (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
|
1288 + 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
|
1289 + pass_on_options + ' ' + incflags + ' ' + defs + ' ' |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1290 + quote_path (f) + " -o " + quote_path (o)); |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1291 |
28963
f29e4791a792
mkoctfile: eliminate global debug variable
John W. Eaton <jwe@octave.org>
parents:
28883
diff
changeset
|
1292 int status = run_command (cmd, verbose, printonly); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1293 |
25510
2710440ea566
mkoctfile: fix logic error with handling of -c option (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25507
diff
changeset
|
1294 if (status) |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1295 return status; |
12174 | 1296 } |
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
|
1297 else |
12174 | 1298 { |
18364
2e62b1f01bfe
* mkoctfile.in.cc: Use std:: instead of using declarartion.
John W. Eaton <jwe@octave.org>
parents:
18363
diff
changeset
|
1299 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
|
1300 << std::endl; |
12174 | 1301 return 1; |
1302 } | |
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
|
1303 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
1304 |
26422
26be3dc2900f
Use LDFLAGS for mkoctfile linker flags (bug #48678).
Rik <rik@octave.org>
parents:
26376
diff
changeset
|
1305 // 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
|
1306 |
49d3c6344afe
mkoctfile: fix one more logic error
John W. Eaton <jwe@octave.org>
parents:
25510
diff
changeset
|
1307 if (compile_only) |
49d3c6344afe
mkoctfile: fix one more logic error
John W. Eaton <jwe@octave.org>
parents:
25510
diff
changeset
|
1308 return 0; |
49d3c6344afe
mkoctfile: fix one more logic error
John W. Eaton <jwe@octave.org>
parents:
25510
diff
changeset
|
1309 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1310 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
|
1311 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1312 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
|
1313 return 1; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1314 } |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1315 |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1316 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
|
1317 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1318 if (link_stand_alone) |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1319 { |
27425
633f7a8347c8
Clean up implementation of CXXLD in build scripts (bug #56505).
Rik <rik@octave.org>
parents:
27277
diff
changeset
|
1320 if (! vars["CXXLD"].empty ()) |
12174 | 1321 { |
26612
ab5cc8da283c
mkoctfile: restore LDFLAGS, warn only when LFLAGS used directly (bug #55447)
Mike Miller <mtmiller@octave.org>
parents:
26487
diff
changeset
|
1322 octave_libs = "-L" + quote_path (vars["OCTLIBDIR"]) |
27934
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
1323 + ' ' + vars["OCTAVE_LIBS"]; |
26431
ff6c90eb6f2d
mkoctfile.in.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26422
diff
changeset
|
1324 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1325 std::string cmd |
27425
633f7a8347c8
Clean up implementation of CXXLD in build scripts (bug #56505).
Rik <rik@octave.org>
parents:
27277
diff
changeset
|
1326 = (vars["CXXLD"] + ' ' + vars["CPPFLAGS"] + ' ' |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1327 + vars["ALL_CXXFLAGS"] + ' ' + vars["RDYNAMIC_FLAG"] + ' ' |
28833
27df9b38391d
mkoctfile.in.cc: Pass linker flags last (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28129
diff
changeset
|
1328 + pass_on_options + ' ' + output_option + ' ' + objfiles + ' ' |
30386
fc9b98382ea7
mkoctfile: Add command line `-l` flags before LDFLAGS in linker command (bug #61571).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30368
diff
changeset
|
1329 + libfiles + ' ' + ldflags + ' ' + vars["ALL_LDFLAGS"] + ' ' |
31457
a96f68a48e9e
maint: Remove more deprecated code from Octave 9.
Rik <rik@octave.org>
parents:
31418
diff
changeset
|
1330 + octave_libs + ' ' |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1331 + 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
|
1332 |
28963
f29e4791a792
mkoctfile: eliminate global debug variable
John W. Eaton <jwe@octave.org>
parents:
28883
diff
changeset
|
1333 int status = run_command (cmd, verbose, printonly); |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1334 |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1335 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
|
1336 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1337 if (status) |
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1338 return status; |
12174 | 1339 } |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1340 else |
12174 | 1341 { |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1342 std::cerr |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1343 << "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
|
1344 << std::endl; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1345 return 1; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1346 } |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1347 } |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1348 else |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1349 { |
33168
e20624df2cd2
minor whitespace style fix
John W. Eaton <jwe@octave.org>
parents:
32680
diff
changeset
|
1350 #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
|
1351 octave_libs = "-L" + quote_path (vars["OCTLIBDIR"]) |
27934
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
1352 + ' ' + vars["OCTAVE_LIBS"]; |
26431
ff6c90eb6f2d
mkoctfile.in.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26422
diff
changeset
|
1353 #endif |
ff6c90eb6f2d
mkoctfile.in.cc: Fix static analyzer detected issues (bug #55347).
Rik <rik@octave.org>
parents:
26422
diff
changeset
|
1354 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1355 std::string cmd |
27425
633f7a8347c8
Clean up implementation of CXXLD in build scripts (bug #56505).
Rik <rik@octave.org>
parents:
27277
diff
changeset
|
1356 = (vars["CXXLD"] + ' ' + vars["ALL_CXXFLAGS"] + ' ' |
28833
27df9b38391d
mkoctfile.in.cc: Pass linker flags last (bug #59173).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28129
diff
changeset
|
1357 + pass_on_options + " -o " + octfile + ' ' + objfiles + ' ' |
30386
fc9b98382ea7
mkoctfile: Add command line `-l` flags before LDFLAGS in linker command (bug #61571).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30368
diff
changeset
|
1358 + libfiles + ' ' + ldflags + ' ' + vars["DL_LDFLAGS"] + ' ' |
31457
a96f68a48e9e
maint: Remove more deprecated code from Octave 9.
Rik <rik@octave.org>
parents:
31418
diff
changeset
|
1359 + vars["LDFLAGS"] + ' ' + octave_libs + ' ' |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1360 + 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
|
1361 |
33168
e20624df2cd2
minor whitespace style fix
John W. Eaton <jwe@octave.org>
parents:
32680
diff
changeset
|
1362 #if defined (OCTAVE_USE_WINDOWS_API) || defined (CROSS) |
28048
42921bff241a
Fix mkoctfile on Windows platforms when compiling Fortran sources (bug #49548).
Mike Miller <mtmiller@octave.org>
parents:
27934
diff
changeset
|
1363 if (! f77files.empty () && ! vars["FLIBS"].empty ()) |
42921bff241a
Fix mkoctfile on Windows platforms when compiling Fortran sources (bug #49548).
Mike Miller <mtmiller@octave.org>
parents:
27934
diff
changeset
|
1364 cmd += ' ' + vars["FLIBS"]; |
42921bff241a
Fix mkoctfile on Windows platforms when compiling Fortran sources (bug #49548).
Mike Miller <mtmiller@octave.org>
parents:
27934
diff
changeset
|
1365 #endif |
42921bff241a
Fix mkoctfile on Windows platforms when compiling Fortran sources (bug #49548).
Mike Miller <mtmiller@octave.org>
parents:
27934
diff
changeset
|
1366 |
28963
f29e4791a792
mkoctfile: eliminate global debug variable
John W. Eaton <jwe@octave.org>
parents:
28883
diff
changeset
|
1367 int status = run_command (cmd, verbose, printonly); |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1368 |
25497
18f5f91f7348
mkoctfile: use tmp store tmp .o files in tmp directory (bug #54182)
John W. Eaton <jwe@octave.org>
parents:
25495
diff
changeset
|
1369 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
|
1370 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1371 if (status) |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1372 return status; |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1373 } |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1374 |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1375 if (strip) |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1376 { |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1377 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
|
1378 |
28963
f29e4791a792
mkoctfile: eliminate global debug variable
John W. Eaton <jwe@octave.org>
parents:
28883
diff
changeset
|
1379 int status = run_command (cmd, verbose, printonly); |
25494
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1380 |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1381 if (status) |
f35bd5cddedd
mkoctfile: disallow -c and -o with multiple source files
John W. Eaton <jwe@octave.org>
parents:
25491
diff
changeset
|
1382 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
|
1383 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
1384 |
22866
b5cf18f8c18b
style fixes for mkoctfile.cc
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
1385 return 0; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
1386 } |