Mercurial > hg > octave-lojdl
annotate scripts/miscellaneous/mkoctfile.m @ 7540:3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Thu, 28 Feb 2008 02:41:19 -0500 |
parents | a1dbe9d80eee |
children | 5dd06f19e9be |
rev | line source |
---|---|
7017 | 1 ## Copyright (C) 2006, 2007 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. |
49 ## | |
50 ## @item -c | |
51 ## Compile but do not link. | |
52 ## | |
5904 | 53 ## @item -g |
54 ## Enable debugging options for compilers. | |
55 ## | |
6573 | 56 ## @item -o FILE |
57 ## @itemx --output FILE | |
5904 | 58 ## Output file name. Default extension is .oct |
59 ## (or .mex if --mex is specified) unless linking | |
60 ## a stand-alone executable. | |
5695 | 61 ## |
6573 | 62 ## @item -p VAR |
63 ## @itemx --print VAR | |
5695 | 64 ## Print the configuration variable VAR. Recognized variables are: |
5671 | 65 ## |
5695 | 66 ## @example |
67 ## ALL_CFLAGS FFTW_LIBS | |
68 ## ALL_CXXFLAGS FLIBS | |
69 ## ALL_FFLAGS FPICFLAG | |
70 ## ALL_LDFLAGS INCFLAGS | |
71 ## BLAS_LIBS LDFLAGS | |
72 ## CC LD_CXX | |
73 ## CFLAGS LD_STATIC_FLAG | |
74 ## CPICFLAG LFLAGS | |
75 ## CPPFLAGS LIBCRUFT | |
76 ## CXX LIBOCTAVE | |
77 ## CXXFLAGS LIBOCTINTERP | |
78 ## CXXPICFLAG LIBREADLINE | |
79 ## DEPEND_EXTRA_SED_PATTERN LIBS | |
80 ## DEPEND_FLAGS OCTAVE_LIBS | |
81 ## DL_LD RDYNAMIC_FLAG | |
82 ## DL_LDFLAGS RLD_FLAG | |
83 ## F2C SED | |
84 ## F2CFLAGS XTRA_CFLAGS | |
85 ## F77 XTRA_CXXFLAGS | |
86 ## FFLAGS | |
87 ## @end example | |
5671 | 88 ## |
5745 | 89 ## @item --link-stand-alone |
90 ## Link a stand-alone executable file. | |
91 ## | |
5904 | 92 ## @item --mex |
93 ## Assume we are creating a MEX file. Set the default output extension | |
94 ## to ".mex". | |
95 ## | |
6573 | 96 ## @item -s |
97 ## @itemx --strip | |
5695 | 98 ## Strip the output file. |
99 ## | |
6573 | 100 ## @item -v |
101 ## @itemx --verbose | |
5695 | 102 ## Echo commands as they are executed. |
103 ## | |
104 ## @item file | |
105 ## The file to compile or link. Recognised file types are | |
106 ## | |
107 ## @example | |
108 ## .c C source | |
109 ## .cc C++ source | |
110 ## .C C++ source | |
111 ## .cpp C++ source | |
112 ## .f Fortran source | |
113 ## .F Fortran source | |
114 ## .o object file | |
115 ## @end example | |
116 ## | |
117 ## @end table | |
5671 | 118 ## @end deftypefn |
119 | |
5695 | 120 ## PKG_ADD: mark_as_command mkoctfile |
121 | |
122 function mkoctfile (varargin) | |
5671 | 123 |
5696 | 124 bindir = octave_config_info ("bindir"); |
125 | |
126 shell_script = fullfile (bindir, sprintf ("mkoctfile-%s", OCTAVE_VERSION)); | |
127 | |
7540
3422f39573b1
strcat.m: Matlab compatibility, with cstrcat.m replacing conventional strcat.m.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
128 cmd = cstrcat ("\"", shell_script, "\""); |
5695 | 129 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
|
130 cmd = cstrcat (cmd, " \"", varargin{i}, "\""); |
5695 | 131 endfor |
132 | |
133 status = system (cmd); | |
134 | |
135 if (status == 127) | |
5696 | 136 warning ("unable to find mkoctfile in expected location: `%s'", |
137 shell_script); | |
6706 | 138 |
5695 | 139 warning ("mkoctfile exited with failure status"); |
140 endif | |
5671 | 141 |
142 endfunction |