Mercurial > hg > octave-lojdl
annotate scripts/miscellaneous/mkoctfile.m @ 10996:72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sun, 19 Sep 2010 12:25:31 -0400 |
parents | be55736a0783 |
children | fd0a3ac60b0e |
rev | line source |
---|---|
8920 | 1 ## Copyright (C) 2006, 2007, 2008, 2009 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 -*- | |
6547 | 20 ## @deftypefn {Function File} {} mkoctfile [-options] file @dots{} |
5695 | 21 ## |
22 ## The @code{mkoctfile} function compiles source code written in C, | |
23 ## C++, or Fortran. Depending on the options used with @code{mkoctfile}, the | |
24 ## compiled code can be called within Octave or can be used as a stand-alone | |
25 ## application. | |
26 ## | |
27 ## @code{mkoctfile} can be called from the shell prompt or from the Octave | |
28 ## prompt. | |
29 ## | |
30 ## @code{mkoctfile} accepts the following options, all of which are optional | |
31 ## except for the file name of the code you wish to compile: | |
32 ## | |
33 ## @table @samp | |
34 ## @item -I DIR | |
35 ## Add the include directory DIR to compile commands. | |
36 ## | |
37 ## @item -D DEF | |
38 ## Add the definition DEF to the compiler call. | |
39 ## | |
40 ## @item -l LIB | |
41 ## Add the library LIB to the link command. | |
42 ## | |
43 ## @item -L DIR | |
44 ## Add the library directory DIR to the link command. | |
45 ## | |
6573 | 46 ## @item -M |
47 ## @itemx --depend | |
5695 | 48 ## 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
|
49 ## |
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
50 ## @item -R DIR |
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
51 ## Add the runtime path to the link command. |
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 -Wl,@dots{} |
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
54 ## Pass flags though the linker like "-Wl,-rpath=@dots{}". |
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
55 ## 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
|
56 ## separators. |
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
57 ## |
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
58 ## @item -W@dots{} |
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
59 ## Pass flags though the compiler like "-Wa,OPTION". |
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
60 ## |
5695 | 61 ## @item -c |
62 ## Compile but do not link. | |
63 ## | |
5904 | 64 ## @item -g |
65 ## Enable debugging options for compilers. | |
66 ## | |
6573 | 67 ## @item -o FILE |
68 ## @itemx --output FILE | |
5904 | 69 ## Output file name. Default extension is .oct |
70 ## (or .mex if --mex is specified) unless linking | |
71 ## a stand-alone executable. | |
5695 | 72 ## |
6573 | 73 ## @item -p VAR |
74 ## @itemx --print VAR | |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
75 ## Print the configuration variable VAR@. Recognized variables are: |
5671 | 76 ## |
5695 | 77 ## @example |
78 ## ALL_CFLAGS FFTW_LIBS | |
79 ## ALL_CXXFLAGS FLIBS | |
80 ## ALL_FFLAGS FPICFLAG | |
81 ## ALL_LDFLAGS INCFLAGS | |
82 ## BLAS_LIBS LDFLAGS | |
83 ## CC LD_CXX | |
84 ## CFLAGS LD_STATIC_FLAG | |
85 ## CPICFLAG LFLAGS | |
86 ## CPPFLAGS LIBCRUFT | |
87 ## CXX LIBOCTAVE | |
88 ## CXXFLAGS LIBOCTINTERP | |
89 ## CXXPICFLAG LIBREADLINE | |
90 ## DEPEND_EXTRA_SED_PATTERN LIBS | |
91 ## DEPEND_FLAGS OCTAVE_LIBS | |
92 ## DL_LD RDYNAMIC_FLAG | |
93 ## DL_LDFLAGS RLD_FLAG | |
94 ## F2C SED | |
95 ## F2CFLAGS XTRA_CFLAGS | |
96 ## F77 XTRA_CXXFLAGS | |
97 ## FFLAGS | |
98 ## @end example | |
5671 | 99 ## |
5745 | 100 ## @item --link-stand-alone |
101 ## Link a stand-alone executable file. | |
102 ## | |
5904 | 103 ## @item --mex |
104 ## Assume we are creating a MEX file. Set the default output extension | |
105 ## to ".mex". | |
106 ## | |
6573 | 107 ## @item -s |
108 ## @itemx --strip | |
5695 | 109 ## Strip the output file. |
110 ## | |
6573 | 111 ## @item -v |
112 ## @itemx --verbose | |
5695 | 113 ## Echo commands as they are executed. |
114 ## | |
115 ## @item file | |
9080
ec41eabf4499
Cleanup documentation files dynamic.texi, testfun.texi, tips.texi
Rik <rdrider0-list@yahoo.com>
parents:
9051
diff
changeset
|
116 ## The file to compile or link. Recognized file types are |
5695 | 117 ## |
118 ## @example | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
119 ## @group |
5695 | 120 ## .c C source |
121 ## .cc C++ source | |
122 ## .C C++ source | |
123 ## .cpp C++ source | |
10996
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
124 ## .f Fortran source (fixed form) |
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
125 ## .F Fortran source (fixed form) |
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
126 ## .f90 Fortran source (free form) |
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
127 ## .F90 Fortran source (free form) |
5695 | 128 ## .o object file |
10996
72640afb02b9
mkoctfile.m: Change help text to be consistent with the shell version.
Ben Abbott <bpabbott@mac.com>
parents:
10793
diff
changeset
|
129 ## .a library file |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
130 ## @end group |
5695 | 131 ## @end example |
132 ## | |
133 ## @end table | |
5671 | 134 ## @end deftypefn |
135 | |
5695 | 136 function mkoctfile (varargin) |
5671 | 137 |
5696 | 138 bindir = octave_config_info ("bindir"); |
139 | |
140 shell_script = fullfile (bindir, sprintf ("mkoctfile-%s", OCTAVE_VERSION)); | |
141 | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
142 cmd = cstrcat ("\"", shell_script, "\""); |
5695 | 143 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
|
144 cmd = cstrcat (cmd, " \"", varargin{i}, "\""); |
5695 | 145 endfor |
146 | |
147 status = system (cmd); | |
148 | |
149 if (status == 127) | |
5696 | 150 warning ("unable to find mkoctfile in expected location: `%s'", |
10549 | 151 shell_script); |
6706 | 152 |
5695 | 153 warning ("mkoctfile exited with failure status"); |
154 endif | |
5671 | 155 |
156 endfunction |