Mercurial > hg > octave-nkf
annotate mkoctfile.in @ 12019:e1695d65a5ca release-3-2-x
fix result class calculation in pt-mat.cc
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 25 Jun 2009 06:36:24 +0200 |
parents | 16f53d29049f |
children | eee9b3150446 |
rev | line source |
---|---|
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, | |
9245 | 7 ## 2006, 2007, 2009 John W. Eaton |
7017 | 8 ## |
7016 | 9 ## This file is part of Octave. |
9187
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
10 ## |
7016 | 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. | |
9187
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
15 ## |
7016 | 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. | |
9187
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
20 ## |
7016 | 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 |
9187
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
65 # compiled. |
3051 | 66 |
6682 | 67 : ${EXEEXT=%OCTAVE_CONF_EXEEXT%} |
68 | |
3590 | 69 : ${CPPFLAGS=%OCTAVE_CONF_CPPFLAGS%} |
6311 | 70 : ${INCFLAGS=$DEFAULT_INCFLAGS} |
3590 | 71 : ${F77=%OCTAVE_CONF_F77%} |
72 : ${FFLAGS=%OCTAVE_CONF_FFLAGS%} | |
73 : ${FPICFLAG=%OCTAVE_CONF_FPICFLAG%} | |
74 : ${CC=%OCTAVE_CONF_CC%} | |
75 : ${CFLAGS=%OCTAVE_CONF_CFLAGS%} | |
76 : ${CPICFLAG=%OCTAVE_CONF_CPICFLAG%} | |
77 : ${CXX=%OCTAVE_CONF_CXX%} | |
78 : ${CXXFLAGS=%OCTAVE_CONF_CXXFLAGS%} | |
79 : ${CXXPICFLAG=%OCTAVE_CONF_CXXPICFLAG%} | |
80 : ${XTRA_CFLAGS=%OCTAVE_CONF_XTRA_CFLAGS%} | |
81 : ${XTRA_CXXFLAGS=%OCTAVE_CONF_XTRA_CXXFLAGS%} | |
3051 | 82 |
3846 | 83 : ${DEPEND_FLAGS=%OCTAVE_CONF_DEPEND_FLAGS%} |
84 : ${DEPEND_EXTRA_SED_PATTERN=%OCTAVE_CONF_DEPEND_EXTRA_SED_PATTERN%} | |
85 | |
4759 | 86 : ${DL_LD=%OCTAVE_CONF_DL_LD%} |
87 : ${DL_LDFLAGS=%OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS%} | |
3051 | 88 |
3859 | 89 : ${RLD_FLAG=%OCTAVE_CONF_RLD_FLAG%} |
90 : ${RDYNAMIC_FLAG=%OCTAVE_CONF_RDYNAMIC_FLAG%} | |
4228 | 91 : ${LIBOCTAVE=-loctave} |
92 : ${LIBOCTINTERP=-loctinterp} | |
93 : ${LIBREADLINE=-lreadline} | |
94 : ${LIBCRUFT=-lcruft} | |
3859 | 95 : ${BLAS_LIBS=%OCTAVE_CONF_BLAS_LIBS%} |
96 : ${FFTW_LIBS=%OCTAVE_CONF_FFTW_LIBS%} | |
97 : ${LIBS=%OCTAVE_CONF_LIBS%} | |
98 : ${FLIBS=%OCTAVE_CONF_FLIBS%} | |
99 : ${LD_CXX=%OCTAVE_CONF_LD_CXX%} | |
100 : ${LDFLAGS=%OCTAVE_CONF_LDFLAGS%} | |
101 : ${LD_STATIC_FLAG=%OCTAVE_CONF_LD_STATIC_FLAG%} | |
6311 | 102 : ${LFLAGS=$DEFAULT_LFLAGS} |
3859 | 103 |
3051 | 104 : ${ALL_FFLAGS="$FFLAGS"} |
105 | |
3131 | 106 : ${ALL_CFLAGS="$INCFLAGS $XTRA_CFLAGS $CFLAGS"} |
3051 | 107 |
3131 | 108 : ${ALL_CXXFLAGS="$INCFLAGS $XTRA_CXXFLAGS $CXXFLAGS"} |
3051 | 109 |
3887 | 110 : ${ALL_LDFLAGS="$LD_STATIC_FLAG $CPICFLAG $LDFLAGS"} |
3859 | 111 |
4228 | 112 : ${OCTAVE_LIBS="$LIBOCTINTERP $LIBOCTAVE $SPECIAL_MATH_LIB $LIBCRUFT"} |
3859 | 113 |
3051 | 114 # Local variables. |
115 | |
116 usage_msg="usage: mkoctfile [options] file ..." | |
117 | |
5285 | 118 version_msg="mkoctfile, version $OCTAVE_VERSION" |
119 | |
3051 | 120 cfiles= |
121 ccfiles= | |
122 f77files= | |
123 objfiles= | |
6294 | 124 libfiles= |
3051 | 125 octfiles= |
126 octfile= | |
3860 | 127 outputfile= |
3088 | 128 incflags= |
3180 | 129 defs= |
3051 | 130 ldflags= |
131 dbg=: | |
4873 | 132 pass_on_options= |
3058 | 133 strip=false |
4199 | 134 no_oct_file_strip_on_this_platform=%NO_OCT_FILE_STRIP% |
3735 | 135 link=true |
3859 | 136 link_stand_alone=false |
5864 | 137 output_ext=".oct" |
3846 | 138 depend=false |
139 compile=true | |
3051 | 140 |
141 if [ $# -eq 0 ]; then | |
3847 | 142 echo $usage_msg 1>&2 |
3846 | 143 exit 1 |
2163 | 144 fi |
145 | |
5285 | 146 if [ $# -eq 1 ]; then |
147 case "$1" in | |
148 -v | --version) | |
149 echo $version_msg 1>&2 | |
150 exit 0 | |
151 ;; | |
152 esac | |
153 fi | |
154 | |
3051 | 155 while [ $# -gt 0 ]; do |
156 file= | |
157 case "$1" in | |
158 *.c) | |
159 file=$1 | |
160 cfiles="$cfiles $file" | |
161 ;; | |
162 *.cc | *.C | *.cpp) | |
163 file=$1 | |
164 ccfiles="$ccfiles $file" | |
165 ;; | |
5970 | 166 *.f | *.F | *.f90 | *.F90) |
3051 | 167 file=$1 |
168 f77files="$f77files $file" | |
169 ;; | |
170 *.o) | |
171 file=$1 | |
172 objfiles="$objfiles $file" | |
173 ;; | |
6294 | 174 *.a) |
175 file=$1 | |
176 libfiles="$libfiles $file" | |
177 ;; | |
3058 | 178 -d | --debug | -v | --verbose) |
3051 | 179 dbg=echo |
180 ;; | |
3233 | 181 -h | -\? | --help) |
3847 | 182 echo $usage_msg 1>&2 |
3051 | 183 cat << EOF |
2163 | 184 |
3051 | 185 Options: |
186 | |
3233 | 187 -h, -?, --help Print this message. |
3734 | 188 |
3088 | 189 -IDIR Add -IDIR to compile commands. |
3734 | 190 |
5483 | 191 -idirafter DIR Add -idirafter DIR to compile commands. |
192 | |
3180 | 193 -DDEF Add -DDEF to compile commands. |
3734 | 194 |
3058 | 195 -lLIB Add library LIB to link command. |
3734 | 196 |
3087 | 197 -LDIR Add -LDIR to link command. |
3734 | 198 |
3846 | 199 -M, --depend Generate dependency files (.d) for C and C++ |
200 source files. | |
201 | |
5199 | 202 -RDIR Add -RDIR to link command. |
203 | |
6153 | 204 -Wl,... Pass flags though the linker like -Wl,-rpath=... |
205 | |
206 -W... Pass flags though the compiler like -Wa,OPTION. | |
5199 | 207 |
3859 | 208 -c, --compile Compile, but do not link. |
3735 | 209 |
3859 | 210 -o FILE, --output FILE Output file name. Default extension is .oct |
5864 | 211 (or .mex if --mex is specified) unless linking |
212 a stand-alone executable. | |
3734 | 213 |
5904 | 214 -g Enable debugging options for compilers. |
215 | |
3734 | 216 -p VAR, --print VAR Print configuration variable VAR. Recognized |
217 variables are: | |
218 | |
9187
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
219 ALL_CFLAGS FLIBS |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
220 ALL_CXXFLAGS FPICFLAG |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
221 ALL_FFLAGS INCFLAGS |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
222 ALL_LDFLAGS LDFLAGS |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
223 BLAS_LIBS LD_CXX |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
224 CC LD_STATIC_FLAG |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
225 CFLAGS LFLAGS |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
226 CPICFLAG LIBCRUFT |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
227 CPPFLAGS LIBOCTAVE |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
228 CXX LIBOCTINTERP |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
229 CXXFLAGS LIBREADLINE |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
230 CXXPICFLAG LIBS |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
231 DEPEND_EXTRA_SED_PATTERN OCTAVE_LIBS |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
232 DEPEND_FLAGS RDYNAMIC_FLAG |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
233 DL_LD RLD_FLAG |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
234 DL_LDFLAGS SED |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
235 F77 XTRA_CFLAGS |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
236 FFLAGS XTRA_CXXFLAGS |
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
237 FFTW_LIBS |
3859 | 238 |
239 --link-stand-alone Link a stand-alone executable file. | |
240 | |
5864 | 241 --mex Assume we are creating a MEX file. Set the |
242 default output extension to ".mex". | |
243 | |
3058 | 244 -s, --strip Strip output file. |
3734 | 245 |
3058 | 246 -v, --verbose Echo commands as they are executed. |
3051 | 247 |
248 FILE Compile or link FILE. Recognized file types are: | |
249 | |
3847 | 250 .c C source |
251 .cc C++ source | |
252 .C C++ source | |
253 .cpp C++ source | |
5970 | 254 .f Fortran source (fixed form) |
255 .F Fortran source (fixed form) | |
256 .f90 Fortran source (free form) | |
257 .F90 Fortran source (free form) | |
3847 | 258 .o object file |
6294 | 259 .a library file |
2163 | 260 |
3051 | 261 EOF |
262 exit 0 | |
263 ;; | |
3088 | 264 -I*) |
3176 | 265 incflags="$incflags $1" |
3088 | 266 ;; |
5483 | 267 -idirafter) |
268 shift | |
269 if [ $# -gt 0 ]; then | |
270 incflags="$incflags -idirafter $1" | |
271 else | |
6782 | 272 echo "mkoctfile: include directory name missing" 1>&2 |
5483 | 273 fi |
274 ;; | |
3180 | 275 -D*) |
276 defs="$defs $1" | |
277 ;; | |
6153 | 278 -[lLR]* | -Wl,*) |
3176 | 279 ldflags="$ldflags $1" |
3058 | 280 ;; |
3846 | 281 -M | --depend) |
282 depend=true | |
283 compile=false | |
284 ;; | |
3051 | 285 -o | --output) |
286 shift | |
287 if [ $# -gt 0 ]; then | |
3860 | 288 outputfile="$1" |
3051 | 289 else |
3847 | 290 echo "mkoctfile: output file name missing" 1>&2 |
3051 | 291 fi |
292 ;; | |
3734 | 293 -p | --print) |
294 shift | |
295 if [ $# -gt 0 ]; then | |
296 eval echo \${$1} | |
297 exit 0 | |
298 else | |
3847 | 299 echo "mkoctfile: --print requires argument" 1>&2 |
3734 | 300 exit 1 |
301 fi | |
302 ;; | |
3058 | 303 -s | --strip) |
4199 | 304 if $no_oct_file_strip_on_this_platform; then |
305 echo "mkoctfile: stripping disabled on this platform" 1>&2 | |
306 else | |
307 strip=true | |
308 fi | |
3051 | 309 ;; |
3859 | 310 -c | --compile) |
3735 | 311 link=false |
312 ;; | |
5904 | 313 -g) |
314 ALL_CFLAGS="$ALL_CFLAGS -g" | |
315 ALL_CXXFLAGS="$ALL_CXXFLAGS -g" | |
316 ALL_FFLAGS="$ALL_FFLAGS -g" | |
317 ;; | |
3859 | 318 --link-stand-alone) |
319 link_stand_alone=true | |
320 ;; | |
5864 | 321 --mex) |
6009 | 322 incflags="$incflags -I." |
5864 | 323 output_ext=".mex" |
324 ;; | |
4873 | 325 -W*) |
326 pass_on_options="$pass_on_options $1" | |
327 ;; | |
3051 | 328 *) |
3847 | 329 echo "mkoctfile: unrecognized argument $1" 1>&2 |
3051 | 330 exit 1 |
331 ;; | |
332 esac | |
333 if [ -n "$file" ]; then | |
334 if [ -z "$octfile" ]; then | |
3859 | 335 octfile="$file" |
3051 | 336 fi |
337 fi | |
338 shift | |
339 done | |
2163 | 340 |
3859 | 341 if $link_stand_alone; then |
3860 | 342 if [ -n "$outputfile" ]; then |
343 output_option="-o $outputfile" | |
344 fi | |
3859 | 345 else |
3860 | 346 if [ -n "$outputfile" ]; then |
347 octfile="$outputfile" | |
348 else | |
6187 | 349 octfile=`basename $octfile` |
5864 | 350 octfile=`echo $octfile | $SED 's,\.[^.]*$,,'`$output_ext |
3860 | 351 fi |
3859 | 352 fi |
353 | |
3846 | 354 # Generate dependency files for C and C++ files. |
355 | |
356 if $depend; then | |
357 if [ -n "$cfiles" ]; then | |
358 for f in $cfiles; do | |
4084 | 359 b=`echo $f | $SED 's,\.c$,,'` |
3846 | 360 d=$b.d |
3847 | 361 cmd="rm -f $d" |
362 $dbg $cmd | |
363 eval $cmd | |
4206 | 364 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 | 365 $dbg $cmd |
366 eval $cmd | |
367 done | |
368 fi | |
369 | |
370 if [ -n "$ccfiles" ]; then | |
371 for f in $ccfiles; do | |
372 case $f in | |
3847 | 373 *.cc) |
4084 | 374 b=`echo $f | $SED 's,\.cc$,,'` |
3847 | 375 ;; |
376 *.C) | |
4084 | 377 b=`echo $f | $SED 's,\.C$,,'` |
3847 | 378 ;; |
379 *.cpp) | |
4084 | 380 b=`echo $f | $SED 's,\.cpp$,,'` |
3847 | 381 ;; |
3846 | 382 esac |
383 d=$b.d | |
3847 | 384 cmd="rm -f $d" |
385 $dbg $cmd | |
386 eval $cmd | |
4206 | 387 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 | 388 $dbg $cmd |
389 eval $cmd | |
390 done | |
391 fi | |
392 # If generating dependencies, that's all we do. | |
393 exit 0 | |
394 fi | |
395 | |
3051 | 396 # Compile Fortran, C, and C++ files. Add the name of each object file |
397 # that is produced to the overall list of object files. | |
2163 | 398 |
3051 | 399 if [ -n "$f77files" ]; then |
400 for f in $f77files; do | |
401 case $f in | |
402 *.f) | |
4084 | 403 b=`echo $f | $SED 's,\.f$,,'` |
3051 | 404 ;; |
405 *.F) | |
4084 | 406 b=`echo $f | $SED 's,\.F$,,'` |
3051 | 407 ;; |
5970 | 408 *.f90) |
409 b=`echo $f | $SED 's,\.f90$,,'` | |
410 ;; | |
411 *.F90) | |
412 b=`echo $f | $SED 's,\.F90$,,'` | |
413 ;; | |
3051 | 414 esac |
3847 | 415 if [ -n "$F77" ]; then |
5159 | 416 if [ -n "$outputfile" ]; then |
9187
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
417 if $link; then |
5159 | 418 o=$b.o |
419 else | |
420 o=$outputfile | |
421 fi | |
422 else | |
423 o=$b.o | |
424 fi | |
3847 | 425 objfiles="$objfiles $o" |
5970 | 426 cmd="$F77 -c $FPICFLAG $ALL_FFLAGS $incflags $defs $pass_on_options $f -o $o" |
3847 | 427 $dbg $cmd |
428 eval $cmd | |
429 else | |
430 echo "mkoctfile: no way to compile Fortran file $f" 1>&2 | |
431 fi | |
3051 | 432 done |
433 fi | |
2163 | 434 |
3051 | 435 if [ -n "$cfiles" ]; then |
436 for f in $cfiles; do | |
3847 | 437 if [ -n "$CC" ]; then |
4084 | 438 b=`echo $f | $SED 's,\.c$,,'` |
5159 | 439 if [ -n "$outputfile" ]; then |
440 if $link; then | |
441 o=$b.o | |
442 else | |
443 o=$outputfile | |
444 fi | |
445 else | |
446 o=$b.o | |
447 fi | |
3847 | 448 objfiles="$objfiles $o" |
4873 | 449 cmd="$CC -c $CPPFLAGS $CPICFLAG $ALL_CFLAGS $pass_on_options $incflags $defs $f -o $o" |
3847 | 450 $dbg $cmd |
451 eval $cmd | |
452 else | |
453 echo "mkoctfile: no way to compile C++ file $f" 1>&2 | |
454 fi | |
3051 | 455 done |
456 fi | |
2163 | 457 |
3051 | 458 if [ -n "$ccfiles" ]; then |
459 for f in $ccfiles; do | |
3847 | 460 if [ -n "$CXX" ]; then |
461 case $f in | |
462 *.cc) | |
4084 | 463 b=`echo $f | $SED 's,\.cc$,,'` |
3847 | 464 ;; |
465 *.C) | |
4084 | 466 b=`echo $f | $SED 's,\.C$,,'` |
3847 | 467 ;; |
468 *.cpp) | |
4084 | 469 b=`echo $f | $SED 's,\.cpp$,,'` |
3847 | 470 ;; |
471 esac | |
5159 | 472 if [ -n "$outputfile" ]; then |
473 if $link; then | |
474 o=$b.o | |
475 else | |
476 o=$outputfile | |
477 fi | |
478 else | |
479 o=$b.o | |
480 fi | |
3847 | 481 objfiles="$objfiles $o" |
4873 | 482 cmd="$CXX -c $CPPFLAGS $CXXPICFLAG $ALL_CXXFLAGS $pass_on_options $incflags $defs $f -o $o" |
3847 | 483 $dbg $cmd |
484 eval $cmd | |
485 else | |
486 echo "mkoctfile: no way to compile C++ file $f" 1>&2 | |
487 fi | |
3051 | 488 done |
489 fi | |
490 | |
3660 | 491 ## Uncomment the following group of lines if you get `Text file busy' |
492 ## errors from ld. This may happen if the .oct file is currently | |
493 ## running while you are trying to recompile it. We try moving first, | |
3733 | 494 ## since on some systems (HP-UX, maybe others) it is possible to |
3660 | 495 ## rename running programs but not remove them. |
496 | |
3663 | 497 ## if [ -f "$octfile" ]; then |
3847 | 498 ## cmd="mv $octfile $octfile.bak" |
499 ## $dbg $cmd | |
500 ## eval $cmd | |
501 ## cmd="rm -f $octfile.bak" | |
502 ## $dbg $cmd | |
503 ## eval $cmd | |
3663 | 504 ## fi |
3659 | 505 |
3051 | 506 # Link all the object files. |
507 | |
5285 | 508 if $link && [ -n "$objfiles" ]; then |
3859 | 509 if $link_stand_alone; then |
510 if [ -n "$LD_CXX" ]; then | |
6294 | 511 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 | 512 $dbg $cmd |
513 eval $cmd | |
514 else | |
515 echo "mkoctfile: no way to link stand-alone executable file" 1>&2 | |
516 exit 1 | |
517 fi | |
518 else | |
4793 | 519 LINK_DEPS="$LFLAGS $OCTAVE_LIBS $LDFLAGS $BLAS_LIBS $FFTW_LIBS $LIBS $FLIBS" |
6294 | 520 cmd="$DL_LD $DL_LDFLAGS $pass_on_options -o $octfile $objfiles $libfiles $ldflags $LINK_DEPS" |
3859 | 521 $dbg $cmd |
522 eval $cmd | |
523 fi | |
3058 | 524 |
525 # Maybe strip it. | |
526 | |
3847 | 527 if $strip; then |
528 cmd="strip $octfile" | |
529 $dbg $cmd | |
530 eval $cmd | |
531 fi | |
3735 | 532 fi |
3058 | 533 |
534 exit 0 |