2163
|
1 #! /bin/sh |
7016
|
2 ## |
|
3 ## mkoctfile -- create a .oct file suitable for dynamic linking by |
|
4 ## Octave. |
7017
|
5 ## |
|
6 ## Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, |
|
7 ## 2006, 2007 John W. Eaton |
|
8 ## |
7016
|
9 ## This file is part of Octave. |
|
10 ## |
|
11 ## Octave is free software; you can redistribute it and/or modify it |
|
12 ## under the terms of the GNU General Public License as published by the |
|
13 ## Free Software Foundation; either version 3 of the License, or (at |
|
14 ## your option) any later version. |
|
15 ## |
|
16 ## Octave is distributed in the hope that it will be useful, but WITHOUT |
|
17 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
18 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
19 ## for more details. |
|
20 ## |
|
21 ## You should have received a copy of the GNU General Public License |
|
22 ## along with Octave; see the file COPYING. If not, see |
|
23 ## <http://www.gnu.org/licenses/>. |
2163
|
24 |
3051
|
25 # Exit immediately on any error. |
|
26 |
2163
|
27 set -e |
|
28 |
6311
|
29 : ${SED=%OCTAVE_CONF_SED%} |
|
30 |
6086
|
31 OCTAVE_VERSION=%OCTAVE_CONF_VERSION% |
6311
|
32 OCTAVE_PREFIX=%OCTAVE_CONF_PREFIX% |
|
33 |
6682
|
34 DEFAULT_BINDIR=%OCTAVE_BINDIR% |
|
35 DEFAULT_INCLUDEDIR=%OCTAVE_CONF_INCLUDEDIR% |
6710
|
36 DEFAULT_LIBDIR=%OCTAVE_CONF_LIBDIR% |
6311
|
37 DEFAULT_OCTINCLUDEDIR=%OCTAVE_CONF_OCTINCLUDEDIR% |
|
38 DEFAULT_OCTLIBDIR=%OCTAVE_CONF_OCTLIBDIR% |
|
39 |
|
40 if [ -n "$OCTAVE_HOME" ]; then |
6682
|
41 DEFAULT_BINDIR="`echo $DEFAULT_BINDIR | $SED "s,^$OCTAVE_PREFIX,$OCTAVE_HOME,"`" |
|
42 DEFAULT_INCLUDEDIR="`echo $DEFAULT_INCLUDEDIR | $SED "s,^$OCTAVE_PREFIX,$OCTAVE_HOME,"`" |
6710
|
43 DEFAULT_LIBDIR="`echo $DEFAULT_LIBDIR | $SED "s,^$OCTAVE_PREFIX,$OCTAVE_HOME,"`" |
6319
|
44 DEFAULT_OCTINCLUDEDIR="`echo $DEFAULT_OCTINCLUDEDIR | $SED "s,^$OCTAVE_PREFIX,$OCTAVE_HOME,"`" |
|
45 DEFAULT_OCTLIBDIR="`echo $DEFAULT_OCTLIBDIR | $SED "s,^$OCTAVE_PREFIX,$OCTAVE_HOME,"`" |
6311
|
46 fi |
|
47 |
6682
|
48 : ${BINDIR=$DEFAULT_BINDIR} |
|
49 : ${INCLUDEDIR=$DEFAULT_INCLUDEDIR} |
6710
|
50 : ${LIBDIR=$DEFAULT_LIBDIR} |
6311
|
51 : ${OCTINCLUDEDIR=$DEFAULT_OCTINCLUDEDIR} |
|
52 : ${OCTLIBDIR=$DEFAULT_OCTLIBDIR} |
|
53 |
|
54 DEFAULT_INCFLAGS="-I$OCTINCLUDEDIR -I$OCTINCLUDEDIR/octave" |
|
55 if [ "$INCLUDEDIR" != /usr/include ]; then |
|
56 DEFAULT_INCFLAGS="$DEFAULT_INCFLAGS -I$INCLUDEDIR" |
|
57 fi |
|
58 |
|
59 DEFAULT_LFLAGS="-L$OCTLIBDIR" |
6710
|
60 if [ "$LIBDIR" != /usr/lib ]; then |
|
61 DEFAULT_LFLAGS="$DEFAULT_LFLAGS -L$LIBDIR" |
|
62 fi |
5285
|
63 |
3051
|
64 # Default values for these variables are filled in when Octave is |
|
65 # compiled. |
|
66 |
6682
|
67 : ${EXEEXT=%OCTAVE_CONF_EXEEXT%} |
|
68 |
3590
|
69 : ${CPPFLAGS=%OCTAVE_CONF_CPPFLAGS%} |
6311
|
70 : ${INCFLAGS=$DEFAULT_INCFLAGS} |
3847
|
71 : ${F2C=%OCTAVE_CONF_F2C%} |
|
72 : ${F2CFLAGS=%OCTAVE_CONF_F2CFLAGS%} |
3590
|
73 : ${F77=%OCTAVE_CONF_F77%} |
|
74 : ${FFLAGS=%OCTAVE_CONF_FFLAGS%} |
|
75 : ${FPICFLAG=%OCTAVE_CONF_FPICFLAG%} |
|
76 : ${CC=%OCTAVE_CONF_CC%} |
|
77 : ${CFLAGS=%OCTAVE_CONF_CFLAGS%} |
|
78 : ${CPICFLAG=%OCTAVE_CONF_CPICFLAG%} |
|
79 : ${CXX=%OCTAVE_CONF_CXX%} |
|
80 : ${CXXFLAGS=%OCTAVE_CONF_CXXFLAGS%} |
|
81 : ${CXXPICFLAG=%OCTAVE_CONF_CXXPICFLAG%} |
|
82 : ${XTRA_CFLAGS=%OCTAVE_CONF_XTRA_CFLAGS%} |
|
83 : ${XTRA_CXXFLAGS=%OCTAVE_CONF_XTRA_CXXFLAGS%} |
3051
|
84 |
3846
|
85 : ${DEPEND_FLAGS=%OCTAVE_CONF_DEPEND_FLAGS%} |
|
86 : ${DEPEND_EXTRA_SED_PATTERN=%OCTAVE_CONF_DEPEND_EXTRA_SED_PATTERN%} |
|
87 |
4759
|
88 : ${DL_LD=%OCTAVE_CONF_DL_LD%} |
|
89 : ${DL_LDFLAGS=%OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS%} |
3051
|
90 |
3859
|
91 : ${RLD_FLAG=%OCTAVE_CONF_RLD_FLAG%} |
|
92 : ${RDYNAMIC_FLAG=%OCTAVE_CONF_RDYNAMIC_FLAG%} |
4228
|
93 : ${LIBOCTAVE=-loctave} |
|
94 : ${LIBOCTINTERP=-loctinterp} |
|
95 : ${LIBREADLINE=-lreadline} |
|
96 : ${LIBCRUFT=-lcruft} |
3859
|
97 : ${BLAS_LIBS=%OCTAVE_CONF_BLAS_LIBS%} |
|
98 : ${FFTW_LIBS=%OCTAVE_CONF_FFTW_LIBS%} |
|
99 : ${LIBS=%OCTAVE_CONF_LIBS%} |
|
100 : ${FLIBS=%OCTAVE_CONF_FLIBS%} |
|
101 : ${LD_CXX=%OCTAVE_CONF_LD_CXX%} |
|
102 : ${LDFLAGS=%OCTAVE_CONF_LDFLAGS%} |
|
103 : ${LD_STATIC_FLAG=%OCTAVE_CONF_LD_STATIC_FLAG%} |
6311
|
104 : ${LFLAGS=$DEFAULT_LFLAGS} |
3859
|
105 |
3051
|
106 : ${ALL_FFLAGS="$FFLAGS"} |
|
107 |
3131
|
108 : ${ALL_CFLAGS="$INCFLAGS $XTRA_CFLAGS $CFLAGS"} |
3051
|
109 |
3131
|
110 : ${ALL_CXXFLAGS="$INCFLAGS $XTRA_CXXFLAGS $CXXFLAGS"} |
3051
|
111 |
3887
|
112 : ${ALL_LDFLAGS="$LD_STATIC_FLAG $CPICFLAG $LDFLAGS"} |
3859
|
113 |
4228
|
114 : ${OCTAVE_LIBS="$LIBOCTINTERP $LIBOCTAVE $SPECIAL_MATH_LIB $LIBCRUFT"} |
3859
|
115 |
3051
|
116 # Local variables. |
|
117 |
|
118 usage_msg="usage: mkoctfile [options] file ..." |
|
119 |
5285
|
120 version_msg="mkoctfile, version $OCTAVE_VERSION" |
|
121 |
3051
|
122 cfiles= |
|
123 ccfiles= |
|
124 f77files= |
|
125 objfiles= |
6294
|
126 libfiles= |
3051
|
127 octfiles= |
|
128 octfile= |
3860
|
129 outputfile= |
3088
|
130 incflags= |
3180
|
131 defs= |
3051
|
132 ldflags= |
|
133 dbg=: |
4873
|
134 pass_on_options= |
3058
|
135 strip=false |
4199
|
136 no_oct_file_strip_on_this_platform=%NO_OCT_FILE_STRIP% |
3735
|
137 link=true |
3859
|
138 link_stand_alone=false |
5864
|
139 output_ext=".oct" |
3846
|
140 depend=false |
|
141 compile=true |
3051
|
142 |
|
143 if [ $# -eq 0 ]; then |
3847
|
144 echo $usage_msg 1>&2 |
3846
|
145 exit 1 |
2163
|
146 fi |
|
147 |
5285
|
148 if [ $# -eq 1 ]; then |
|
149 case "$1" in |
|
150 -v | --version) |
|
151 echo $version_msg 1>&2 |
|
152 exit 0 |
|
153 ;; |
|
154 esac |
|
155 fi |
|
156 |
3051
|
157 while [ $# -gt 0 ]; do |
|
158 file= |
|
159 case "$1" in |
|
160 *.c) |
|
161 file=$1 |
|
162 cfiles="$cfiles $file" |
|
163 ;; |
|
164 *.cc | *.C | *.cpp) |
|
165 file=$1 |
|
166 ccfiles="$ccfiles $file" |
|
167 ;; |
5970
|
168 *.f | *.F | *.f90 | *.F90) |
3051
|
169 file=$1 |
|
170 f77files="$f77files $file" |
|
171 ;; |
|
172 *.o) |
|
173 file=$1 |
|
174 objfiles="$objfiles $file" |
|
175 ;; |
6294
|
176 *.a) |
|
177 file=$1 |
|
178 libfiles="$libfiles $file" |
|
179 ;; |
3058
|
180 -d | --debug | -v | --verbose) |
3051
|
181 dbg=echo |
|
182 ;; |
3233
|
183 -h | -\? | --help) |
3847
|
184 echo $usage_msg 1>&2 |
3051
|
185 cat << EOF |
2163
|
186 |
3051
|
187 Options: |
|
188 |
3233
|
189 -h, -?, --help Print this message. |
3734
|
190 |
3088
|
191 -IDIR Add -IDIR to compile commands. |
3734
|
192 |
5483
|
193 -idirafter DIR Add -idirafter DIR to compile commands. |
|
194 |
3180
|
195 -DDEF Add -DDEF to compile commands. |
3734
|
196 |
3058
|
197 -lLIB Add library LIB to link command. |
3734
|
198 |
3087
|
199 -LDIR Add -LDIR to link command. |
3734
|
200 |
3846
|
201 -M, --depend Generate dependency files (.d) for C and C++ |
|
202 source files. |
|
203 |
5199
|
204 -RDIR Add -RDIR to link command. |
|
205 |
6153
|
206 -Wl,... Pass flags though the linker like -Wl,-rpath=... |
|
207 |
|
208 -W... Pass flags though the compiler like -Wa,OPTION. |
5199
|
209 |
3859
|
210 -c, --compile Compile, but do not link. |
3735
|
211 |
3859
|
212 -o FILE, --output FILE Output file name. Default extension is .oct |
5864
|
213 (or .mex if --mex is specified) unless linking |
|
214 a stand-alone executable. |
3734
|
215 |
5904
|
216 -g Enable debugging options for compilers. |
|
217 |
3734
|
218 -p VAR, --print VAR Print configuration variable VAR. Recognized |
|
219 variables are: |
|
220 |
5669
|
221 ALL_CFLAGS FFTW_LIBS |
|
222 ALL_CXXFLAGS FLIBS |
|
223 ALL_FFLAGS FPICFLAG |
|
224 ALL_LDFLAGS INCFLAGS |
|
225 BLAS_LIBS LDFLAGS |
|
226 CC LD_CXX |
|
227 CFLAGS LD_STATIC_FLAG |
|
228 CPICFLAG LFLAGS |
|
229 CPPFLAGS LIBCRUFT |
|
230 CXX LIBOCTAVE |
|
231 CXXFLAGS LIBOCTINTERP |
|
232 CXXPICFLAG LIBREADLINE |
|
233 DEPEND_EXTRA_SED_PATTERN LIBS |
|
234 DEPEND_FLAGS OCTAVE_LIBS |
|
235 DL_LD RDYNAMIC_FLAG |
|
236 DL_LDFLAGS RLD_FLAG |
|
237 F2C SED |
|
238 F2CFLAGS XTRA_CFLAGS |
|
239 F77 XTRA_CXXFLAGS |
|
240 FFLAGS |
3859
|
241 |
|
242 --link-stand-alone Link a stand-alone executable file. |
|
243 |
5864
|
244 --mex Assume we are creating a MEX file. Set the |
|
245 default output extension to ".mex". |
|
246 |
3058
|
247 -s, --strip Strip output file. |
3734
|
248 |
3058
|
249 -v, --verbose Echo commands as they are executed. |
3051
|
250 |
|
251 FILE Compile or link FILE. Recognized file types are: |
|
252 |
3847
|
253 .c C source |
|
254 .cc C++ source |
|
255 .C C++ source |
|
256 .cpp C++ source |
5970
|
257 .f Fortran source (fixed form) |
|
258 .F Fortran source (fixed form) |
|
259 .f90 Fortran source (free form) |
|
260 .F90 Fortran source (free form) |
3847
|
261 .o object file |
6294
|
262 .a library file |
2163
|
263 |
3051
|
264 EOF |
|
265 exit 0 |
|
266 ;; |
3088
|
267 -I*) |
3176
|
268 incflags="$incflags $1" |
3088
|
269 ;; |
5483
|
270 -idirafter) |
|
271 shift |
|
272 if [ $# -gt 0 ]; then |
|
273 incflags="$incflags -idirafter $1" |
|
274 else |
6782
|
275 echo "mkoctfile: include directory name missing" 1>&2 |
5483
|
276 fi |
|
277 ;; |
3180
|
278 -D*) |
|
279 defs="$defs $1" |
|
280 ;; |
6153
|
281 -[lLR]* | -Wl,*) |
3176
|
282 ldflags="$ldflags $1" |
3058
|
283 ;; |
3846
|
284 -M | --depend) |
|
285 depend=true |
|
286 compile=false |
|
287 ;; |
3051
|
288 -o | --output) |
|
289 shift |
|
290 if [ $# -gt 0 ]; then |
3860
|
291 outputfile="$1" |
3051
|
292 else |
3847
|
293 echo "mkoctfile: output file name missing" 1>&2 |
3051
|
294 fi |
|
295 ;; |
3734
|
296 -p | --print) |
|
297 shift |
|
298 if [ $# -gt 0 ]; then |
|
299 eval echo \${$1} |
|
300 exit 0 |
|
301 else |
3847
|
302 echo "mkoctfile: --print requires argument" 1>&2 |
3734
|
303 exit 1 |
|
304 fi |
|
305 ;; |
3058
|
306 -s | --strip) |
4199
|
307 if $no_oct_file_strip_on_this_platform; then |
|
308 echo "mkoctfile: stripping disabled on this platform" 1>&2 |
|
309 else |
|
310 strip=true |
|
311 fi |
3051
|
312 ;; |
3859
|
313 -c | --compile) |
3735
|
314 link=false |
|
315 ;; |
5904
|
316 -g) |
|
317 ALL_CFLAGS="$ALL_CFLAGS -g" |
|
318 ALL_CXXFLAGS="$ALL_CXXFLAGS -g" |
|
319 ALL_FFLAGS="$ALL_FFLAGS -g" |
|
320 ;; |
3859
|
321 --link-stand-alone) |
|
322 link_stand_alone=true |
|
323 ;; |
5864
|
324 --mex) |
6009
|
325 incflags="$incflags -I." |
5864
|
326 output_ext=".mex" |
|
327 ;; |
4873
|
328 -W*) |
|
329 pass_on_options="$pass_on_options $1" |
|
330 ;; |
3051
|
331 *) |
3847
|
332 echo "mkoctfile: unrecognized argument $1" 1>&2 |
3051
|
333 exit 1 |
|
334 ;; |
|
335 esac |
|
336 if [ -n "$file" ]; then |
|
337 if [ -z "$octfile" ]; then |
3859
|
338 octfile="$file" |
3051
|
339 fi |
|
340 fi |
|
341 shift |
|
342 done |
2163
|
343 |
3859
|
344 if $link_stand_alone; then |
3860
|
345 if [ -n "$outputfile" ]; then |
|
346 output_option="-o $outputfile" |
|
347 fi |
3859
|
348 else |
3860
|
349 if [ -n "$outputfile" ]; then |
|
350 octfile="$outputfile" |
|
351 else |
6187
|
352 octfile=`basename $octfile` |
5864
|
353 octfile=`echo $octfile | $SED 's,\.[^.]*$,,'`$output_ext |
3860
|
354 fi |
3859
|
355 fi |
|
356 |
3846
|
357 # Generate dependency files for C and C++ files. |
|
358 |
|
359 if $depend; then |
|
360 if [ -n "$cfiles" ]; then |
|
361 for f in $cfiles; do |
4084
|
362 b=`echo $f | $SED 's,\.c$,,'` |
3846
|
363 d=$b.d |
3847
|
364 cmd="rm -f $d" |
|
365 $dbg $cmd |
|
366 eval $cmd |
4206
|
367 cmd="$CC $DEPEND_FLAGS $CPPFLAGS $ALL_CFLAGS $incflags $def $f | $SED $DEPEND_EXTRA_SED_PATTERN -e 's,^[^:]*/\(.*\.o\):,\1:,' -e 's,$b\.o,pic/& & $d,g' > $d-t && mv $d-t $d" |
3846
|
368 $dbg $cmd |
|
369 eval $cmd |
|
370 done |
|
371 fi |
|
372 |
|
373 if [ -n "$ccfiles" ]; then |
|
374 for f in $ccfiles; do |
|
375 case $f in |
3847
|
376 *.cc) |
4084
|
377 b=`echo $f | $SED 's,\.cc$,,'` |
3847
|
378 ;; |
|
379 *.C) |
4084
|
380 b=`echo $f | $SED 's,\.C$,,'` |
3847
|
381 ;; |
|
382 *.cpp) |
4084
|
383 b=`echo $f | $SED 's,\.cpp$,,'` |
3847
|
384 ;; |
3846
|
385 esac |
|
386 d=$b.d |
3847
|
387 cmd="rm -f $d" |
|
388 $dbg $cmd |
|
389 eval $cmd |
4206
|
390 cmd="$CXX $DEPEND_FLAGS $CPPFLAGS $ALL_CXXFLAGS $incflags $defs $f | $SED $DEPEND_EXTRA_SED_PATTERN -e 's,^[^:]*/\(.*\.o\):,\1:,' -e 's,$b\.o,pic/& & $d,g' > $d-t && mv $d-t $d" |
3846
|
391 $dbg $cmd |
|
392 eval $cmd |
|
393 done |
|
394 fi |
|
395 # If generating dependencies, that's all we do. |
|
396 exit 0 |
|
397 fi |
|
398 |
3051
|
399 # Compile Fortran, C, and C++ files. Add the name of each object file |
|
400 # that is produced to the overall list of object files. |
2163
|
401 |
3051
|
402 if [ -n "$f77files" ]; then |
|
403 for f in $f77files; do |
|
404 case $f in |
|
405 *.f) |
4084
|
406 b=`echo $f | $SED 's,\.f$,,'` |
3051
|
407 ;; |
|
408 *.F) |
4084
|
409 b=`echo $f | $SED 's,\.F$,,'` |
3051
|
410 ;; |
5970
|
411 *.f90) |
|
412 b=`echo $f | $SED 's,\.f90$,,'` |
|
413 ;; |
|
414 *.F90) |
|
415 b=`echo $f | $SED 's,\.F90$,,'` |
|
416 ;; |
3051
|
417 esac |
3847
|
418 if [ -n "$F77" ]; then |
5159
|
419 if [ -n "$outputfile" ]; then |
|
420 if $link; then |
|
421 o=$b.o |
|
422 else |
|
423 o=$outputfile |
|
424 fi |
|
425 else |
|
426 o=$b.o |
|
427 fi |
3847
|
428 objfiles="$objfiles $o" |
5970
|
429 cmd="$F77 -c $FPICFLAG $ALL_FFLAGS $incflags $defs $pass_on_options $f -o $o" |
3847
|
430 $dbg $cmd |
|
431 eval $cmd |
|
432 elif [ -n "$F2C" ]; then |
|
433 c=$b.c |
|
434 cfiles="$cfiles $c" |
|
435 cmd="$F2C $F2CFLAGS < $f > $c" |
|
436 $dbg $cmd |
|
437 eval $cmd |
|
438 else |
|
439 echo "mkoctfile: no way to compile Fortran file $f" 1>&2 |
|
440 fi |
3051
|
441 done |
|
442 fi |
2163
|
443 |
3051
|
444 if [ -n "$cfiles" ]; then |
|
445 for f in $cfiles; do |
3847
|
446 if [ -n "$CC" ]; then |
4084
|
447 b=`echo $f | $SED 's,\.c$,,'` |
5159
|
448 if [ -n "$outputfile" ]; then |
|
449 if $link; then |
|
450 o=$b.o |
|
451 else |
|
452 o=$outputfile |
|
453 fi |
|
454 else |
|
455 o=$b.o |
|
456 fi |
3847
|
457 objfiles="$objfiles $o" |
4873
|
458 cmd="$CC -c $CPPFLAGS $CPICFLAG $ALL_CFLAGS $pass_on_options $incflags $defs $f -o $o" |
3847
|
459 $dbg $cmd |
|
460 eval $cmd |
|
461 else |
|
462 echo "mkoctfile: no way to compile C++ file $f" 1>&2 |
|
463 fi |
3051
|
464 done |
|
465 fi |
2163
|
466 |
3051
|
467 if [ -n "$ccfiles" ]; then |
|
468 for f in $ccfiles; do |
3847
|
469 if [ -n "$CXX" ]; then |
|
470 case $f in |
|
471 *.cc) |
4084
|
472 b=`echo $f | $SED 's,\.cc$,,'` |
3847
|
473 ;; |
|
474 *.C) |
4084
|
475 b=`echo $f | $SED 's,\.C$,,'` |
3847
|
476 ;; |
|
477 *.cpp) |
4084
|
478 b=`echo $f | $SED 's,\.cpp$,,'` |
3847
|
479 ;; |
|
480 esac |
5159
|
481 if [ -n "$outputfile" ]; then |
|
482 if $link; then |
|
483 o=$b.o |
|
484 else |
|
485 o=$outputfile |
|
486 fi |
|
487 else |
|
488 o=$b.o |
|
489 fi |
3847
|
490 objfiles="$objfiles $o" |
4873
|
491 cmd="$CXX -c $CPPFLAGS $CXXPICFLAG $ALL_CXXFLAGS $pass_on_options $incflags $defs $f -o $o" |
3847
|
492 $dbg $cmd |
|
493 eval $cmd |
|
494 else |
|
495 echo "mkoctfile: no way to compile C++ file $f" 1>&2 |
|
496 fi |
3051
|
497 done |
|
498 fi |
|
499 |
3660
|
500 ## Uncomment the following group of lines if you get `Text file busy' |
|
501 ## errors from ld. This may happen if the .oct file is currently |
|
502 ## running while you are trying to recompile it. We try moving first, |
3733
|
503 ## since on some systems (HP-UX, maybe others) it is possible to |
3660
|
504 ## rename running programs but not remove them. |
|
505 |
3663
|
506 ## if [ -f "$octfile" ]; then |
3847
|
507 ## cmd="mv $octfile $octfile.bak" |
|
508 ## $dbg $cmd |
|
509 ## eval $cmd |
|
510 ## cmd="rm -f $octfile.bak" |
|
511 ## $dbg $cmd |
|
512 ## eval $cmd |
3663
|
513 ## fi |
3659
|
514 |
3051
|
515 # Link all the object files. |
|
516 |
5285
|
517 if $link && [ -n "$objfiles" ]; then |
3859
|
518 if $link_stand_alone; then |
|
519 if [ -n "$LD_CXX" ]; then |
6294
|
520 cmd="$LD_CXX $CPPFLAGS $ALL_CXXFLAGS $RDYNAMIC_FLAG $ALL_LDFLAGS $pass_on_options $output_option $objfiles $libfiles $ldflags $LFLAGS $RLD_FLAG $OCTAVE_LIBS $BLAS_LIBS $FFTW_LIBS $LIBREADLINE $LIBS $FLIBS" |
3859
|
521 $dbg $cmd |
|
522 eval $cmd |
|
523 else |
|
524 echo "mkoctfile: no way to link stand-alone executable file" 1>&2 |
|
525 exit 1 |
|
526 fi |
|
527 else |
4793
|
528 LINK_DEPS="$LFLAGS $OCTAVE_LIBS $LDFLAGS $BLAS_LIBS $FFTW_LIBS $LIBS $FLIBS" |
6294
|
529 cmd="$DL_LD $DL_LDFLAGS $pass_on_options -o $octfile $objfiles $libfiles $ldflags $LINK_DEPS" |
3859
|
530 $dbg $cmd |
|
531 eval $cmd |
|
532 fi |
3058
|
533 |
|
534 # Maybe strip it. |
|
535 |
3847
|
536 if $strip; then |
|
537 cmd="strip $octfile" |
|
538 $dbg $cmd |
|
539 eval $cmd |
|
540 fi |
3735
|
541 fi |
3058
|
542 |
|
543 exit 0 |