Mercurial > hg > octave-lyh
annotate scripts/miscellaneous/mkoctfile.m @ 14626:f947d2922feb stable rc-3-6-2-0
3.6.2-rc0 release candidate
* configure.ac (AC_INIT): Version is now 3.6.2-rc0.
(OCTAVE_RELEASE_DATE): Now 2012-05-11.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 11 May 2012 13:46:18 -0400 |
parents | 4d917a6a858b |
children | b76f0740940e d174210ce1ec |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
14121
diff
changeset
|
1 ## Copyright (C) 2006-2012 Keith Goodman |
5671 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
5671 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
5671 | 18 |
19 ## -*- texinfo -*- | |
11563
3c6e8aaa9555
Grammarcheck m-files before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
20 ## @deftypefn {Command} {} mkoctfile [-options] file @dots{} |
14121
6a59b271cd91
mkoctfile.m: Return the output and exit status from the mkoctfile shell command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
21 ## @deftypefnx {Function File} {[@var{output}, @var{status} =} mkoctfile (@dots{}) |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
22 ## |
5695 | 23 ## The @code{mkoctfile} function compiles source code written in C, |
24 ## C++, or Fortran. Depending on the options used with @code{mkoctfile}, the | |
25 ## compiled code can be called within Octave or can be used as a stand-alone | |
26 ## application. | |
27 ## | |
28 ## @code{mkoctfile} can be called from the shell prompt or from the Octave | |
14121
6a59b271cd91
mkoctfile.m: Return the output and exit status from the mkoctfile shell command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
29 ## prompt. Calling it from the Octave prompt simply delegates the |
6a59b271cd91
mkoctfile.m: Return the output and exit status from the mkoctfile shell command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
30 ## call to the shell prompt. The output is stored in the @var{output} |
6a59b271cd91
mkoctfile.m: Return the output and exit status from the mkoctfile shell command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
31 ## variable and the exit status in the @var{status} variable. |
5695 | 32 ## |
33 ## @code{mkoctfile} accepts the following options, all of which are optional | |
34 ## except for the file name of the code you wish to compile: | |
35 ## | |
36 ## @table @samp | |
37 ## @item -I DIR | |
38 ## Add the include directory DIR to compile commands. | |
39 ## | |
40 ## @item -D DEF | |
41 ## Add the definition DEF to the compiler call. | |
42 ## | |
43 ## @item -l LIB | |
44 ## Add the library LIB to the link command. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
45 ## |
5695 | 46 ## @item -L DIR |
47 ## Add the library directory DIR to the link command. | |
48 ## | |
6573 | 49 ## @item -M |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
50 ## @itemx --depend |
5695 | 51 ## Generate dependency files (.d) for C and C++ source files. |
10996
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
52 ## |
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
53 ## @item -R DIR |
11575
d6619410e79c
Spellcheck documentation before 3.4 release.
Rik <octave@nomad.inbox5.com>
parents:
11563
diff
changeset
|
54 ## Add the run-time path to the link command. |
10996
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
55 ## |
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
56 ## @item -Wl,@dots{} |
12753
00fbb05f099c
Backout 2c54fde0f397 on stable; broke Octave-Forge packages
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
12662
diff
changeset
|
57 ## Pass flags though the linker like "-Wl,-rpath=@dots{}". |
10996
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
58 ## The quotes are needed since commas are interpreted as command |
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
59 ## separators. |
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
60 ## |
12753
00fbb05f099c
Backout 2c54fde0f397 on stable; broke Octave-Forge packages
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
12662
diff
changeset
|
61 ## @item -W@dots{} |
00fbb05f099c
Backout 2c54fde0f397 on stable; broke Octave-Forge packages
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
12662
diff
changeset
|
62 ## Pass flags though the compiler like "-Wa,OPTION". |
10996
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
63 ## |
5695 | 64 ## @item -c |
65 ## Compile but do not link. | |
66 ## | |
5904 | 67 ## @item -g |
68 ## Enable debugging options for compilers. | |
69 ## | |
6573 | 70 ## @item -o FILE |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
71 ## @itemx --output FILE |
5904 | 72 ## Output file name. Default extension is .oct |
12175
2090995ca588
Correct en-dash,em-dash instances in docstrings.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
73 ## (or .mex if @samp{--mex} is specified) unless linking |
5904 | 74 ## a stand-alone executable. |
5695 | 75 ## |
6573 | 76 ## @item -p VAR |
77 ## @itemx --print VAR | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
78 ## Print the configuration variable VAR@. Recognized variables are: |
5671 | 79 ## |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
80 ## @example |
13025
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
81 ## ALL_CFLAGS FFTW3F_LIBS |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
82 ## ALL_CXXFLAGS FLIBS |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
83 ## ALL_FFLAGS FPICFLAG |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
84 ## ALL_LDFLAGS INCFLAGS |
13025
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
85 ## BLAS_LIBS LAPACK_LIBS |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
86 ## CC LDFLAGS |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
87 ## CFLAGS LD_CXX |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
88 ## CPICFLAG LD_STATIC_FLAG |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
89 ## CPPFLAGS LFLAGS |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
90 ## CXX LIBCRUFT |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
91 ## CXXFLAGS LIBOCTAVE |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
92 ## CXXPICFLAG LIBOCTINTERP |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
93 ## DEPEND_EXTRA_SED_PATTERN LIBS |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
94 ## DEPEND_FLAGS OCTAVE_LIBS |
13025
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
95 ## DL_LD OCTAVE_LINK_DEPS |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
96 ## DL_LDFLAGS OCT_LINK_DEPS |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
97 ## EXEEXT RDYNAMIC_FLAG |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
98 ## F77 READLINE_LIBS |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
99 ## F77_INTEGER_8_FLAG SED |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
100 ## FFLAGS XTRA_CFLAGS |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
101 ## FFTW3_LDFLAGS XTRA_CXXFLAGS |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
102 ## FFTW3_LIBS |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
103 ## FFTW3F_LDFLAGS |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
104 ## |
5695 | 105 ## @end example |
5671 | 106 ## |
5745 | 107 ## @item --link-stand-alone |
108 ## Link a stand-alone executable file. | |
109 ## | |
5904 | 110 ## @item --mex |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
111 ## Assume we are creating a MEX file. Set the default output extension |
5904 | 112 ## to ".mex". |
113 ## | |
6573 | 114 ## @item -s |
115 ## @itemx --strip | |
5695 | 116 ## Strip the output file. |
117 ## | |
6573 | 118 ## @item -v |
119 ## @itemx --verbose | |
5695 | 120 ## Echo commands as they are executed. |
121 ## | |
122 ## @item file | |
9080
ec41eabf4499
Cleanup documentation files dynamic.texi, testfun.texi, tips.texi
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
123 ## The file to compile or link. Recognized file types are |
5695 | 124 ## |
125 ## @example | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
126 ## @group |
14327
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
127 ## .c C source |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
128 ## .cc C++ source |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
129 ## .C C++ source |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
130 ## .cpp C++ source |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
131 ## .f Fortran source (fixed form) |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
132 ## .F Fortran source (fixed form) |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
133 ## .f90 Fortran source (free form) |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
134 ## .F90 Fortran source (free form) |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
135 ## .o object file |
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
136 ## .a library file |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
137 ## @end group |
5695 | 138 ## @end example |
139 ## | |
140 ## @end table | |
5671 | 141 ## @end deftypefn |
142 | |
14121
6a59b271cd91
mkoctfile.m: Return the output and exit status from the mkoctfile shell command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
143 function [output, status] = mkoctfile (varargin) |
5671 | 144 |
5696 | 145 bindir = octave_config_info ("bindir"); |
146 | |
147 shell_script = fullfile (bindir, sprintf ("mkoctfile-%s", OCTAVE_VERSION)); | |
148 | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
149 cmd = cstrcat ("\"", shell_script, "\""); |
5695 | 150 for i = 1:nargin |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
151 cmd = cstrcat (cmd, " \"", varargin{i}, "\""); |
5695 | 152 endfor |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11575
diff
changeset
|
153 |
14121
6a59b271cd91
mkoctfile.m: Return the output and exit status from the mkoctfile shell command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
154 [sys, out] = system (cmd); |
5695 | 155 |
14121
6a59b271cd91
mkoctfile.m: Return the output and exit status from the mkoctfile shell command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
156 if (nargout > 0) |
6a59b271cd91
mkoctfile.m: Return the output and exit status from the mkoctfile shell command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
157 [output, status] = deal (out, sys); |
6a59b271cd91
mkoctfile.m: Return the output and exit status from the mkoctfile shell command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
158 else |
6a59b271cd91
mkoctfile.m: Return the output and exit status from the mkoctfile shell command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
159 printf ("%s", out); |
6a59b271cd91
mkoctfile.m: Return the output and exit status from the mkoctfile shell command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
160 endif |
6a59b271cd91
mkoctfile.m: Return the output and exit status from the mkoctfile shell command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
161 |
6a59b271cd91
mkoctfile.m: Return the output and exit status from the mkoctfile shell command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
162 if (sys == 127) |
5696 | 163 warning ("unable to find mkoctfile in expected location: `%s'", |
10549 | 164 shell_script); |
6706 | 165 |
5695 | 166 warning ("mkoctfile exited with failure status"); |
167 endif | |
5671 | 168 |
169 endfunction |