Mercurial > octave-nkf
annotate src/mkoctfile.in @ 16088:b29b10fbb744 stable release-3-6-4
Version 3.6.4 released.
* configure.ac (AC_INIT): Version is now 3.6.4.
(OCTAVE_RELEASE_DATE): Now 2013-02-21.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 21 Feb 2013 15:17:54 -0500 |
parents | a653526ea4a5 |
children |
rev | line source |
---|---|
2163 | 1 #! /bin/sh |
7016 | 2 ## |
3 ## mkoctfile -- create a .oct file suitable for dynamic linking by | |
4 ## Octave. | |
7017 | 5 ## |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13133
diff
changeset
|
6 ## Copyright (C) 1996-2012 John W. Eaton |
7017 | 7 ## |
7016 | 8 ## This file is part of Octave. |
9187
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
9 ## |
7016 | 10 ## Octave is free software; you can redistribute it and/or modify it |
11 ## under the terms of the GNU General Public License as published by the | |
12 ## Free Software Foundation; either version 3 of the License, or (at | |
13 ## your option) any later version. | |
9187
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
14 ## |
7016 | 15 ## Octave is distributed in the hope that it will be useful, but WITHOUT |
16 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
17 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
18 ## for more details. | |
9187
a3237ae32c0d
eliminate last remnants of F2C variables
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
19 ## |
7016 | 20 ## You should have received a copy of the GNU General Public License |
21 ## along with Octave; see the file COPYING. If not, see | |
22 ## <http://www.gnu.org/licenses/>. | |
2163 | 23 |
3051 | 24 # Exit immediately on any error. |
25 | |
2163 | 26 set -e |
27 | |
6311 | 28 : ${SED=%OCTAVE_CONF_SED%} |
29 | |
6086 | 30 OCTAVE_VERSION=%OCTAVE_CONF_VERSION% |
6311 | 31 OCTAVE_PREFIX=%OCTAVE_CONF_PREFIX% |
32 | |
6682 | 33 DEFAULT_BINDIR=%OCTAVE_BINDIR% |
34 DEFAULT_INCLUDEDIR=%OCTAVE_CONF_INCLUDEDIR% | |
6710 | 35 DEFAULT_LIBDIR=%OCTAVE_CONF_LIBDIR% |
6311 | 36 DEFAULT_OCTINCLUDEDIR=%OCTAVE_CONF_OCTINCLUDEDIR% |
37 DEFAULT_OCTLIBDIR=%OCTAVE_CONF_OCTLIBDIR% | |
38 | |
39 if [ -n "$OCTAVE_HOME" ]; then | |
6682 | 40 DEFAULT_BINDIR="`echo $DEFAULT_BINDIR | $SED "s,^$OCTAVE_PREFIX,$OCTAVE_HOME,"`" |
41 DEFAULT_INCLUDEDIR="`echo $DEFAULT_INCLUDEDIR | $SED "s,^$OCTAVE_PREFIX,$OCTAVE_HOME,"`" | |
6710 | 42 DEFAULT_LIBDIR="`echo $DEFAULT_LIBDIR | $SED "s,^$OCTAVE_PREFIX,$OCTAVE_HOME,"`" |
6319 | 43 DEFAULT_OCTINCLUDEDIR="`echo $DEFAULT_OCTINCLUDEDIR | $SED "s,^$OCTAVE_PREFIX,$OCTAVE_HOME,"`" |
44 DEFAULT_OCTLIBDIR="`echo $DEFAULT_OCTLIBDIR | $SED "s,^$OCTAVE_PREFIX,$OCTAVE_HOME,"`" | |
6311 | 45 fi |
46 | |
6682 | 47 : ${BINDIR=$DEFAULT_BINDIR} |
48 : ${INCLUDEDIR=$DEFAULT_INCLUDEDIR} | |
6710 | 49 : ${LIBDIR=$DEFAULT_LIBDIR} |
6311 | 50 : ${OCTINCLUDEDIR=$DEFAULT_OCTINCLUDEDIR} |
51 : ${OCTLIBDIR=$DEFAULT_OCTLIBDIR} | |
52 | |
9794
0d4613a736e9
convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents:
9538
diff
changeset
|
53 DEFAULT_INCFLAGS="-I$OCTINCLUDEDIR/.. -I$OCTINCLUDEDIR" |
6311 | 54 if [ "$INCLUDEDIR" != /usr/include ]; then |
55 DEFAULT_INCFLAGS="$DEFAULT_INCFLAGS -I$INCLUDEDIR" | |
56 fi | |
57 | |
58 DEFAULT_LFLAGS="-L$OCTLIBDIR" | |
6710 | 59 if [ "$LIBDIR" != /usr/lib ]; then |
60 DEFAULT_LFLAGS="$DEFAULT_LFLAGS -L$LIBDIR" | |
61 fi | |
5285 | 62 |
3051 | 63 # 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
|
64 # compiled. |
3051 | 65 |
6682 | 66 : ${EXEEXT=%OCTAVE_CONF_EXEEXT%} |
67 | |
3590 | 68 : ${CPPFLAGS=%OCTAVE_CONF_CPPFLAGS%} |
6311 | 69 : ${INCFLAGS=$DEFAULT_INCFLAGS} |
15932
747dd82082c8
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
70 : ${F77=%OCTAVE_CONF_MKOCTFILE_F77%} |
3590 | 71 : ${FFLAGS=%OCTAVE_CONF_FFLAGS%} |
72 : ${FPICFLAG=%OCTAVE_CONF_FPICFLAG%} | |
15932
747dd82082c8
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
73 : ${CC=%OCTAVE_CONF_MKOCTFILE_CC%} |
3590 | 74 : ${CFLAGS=%OCTAVE_CONF_CFLAGS%} |
75 : ${CPICFLAG=%OCTAVE_CONF_CPICFLAG%} | |
15932
747dd82082c8
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
76 : ${CXX=%OCTAVE_CONF_MKOCTFILE_CXX%} |
3590 | 77 : ${CXXFLAGS=%OCTAVE_CONF_CXXFLAGS%} |
78 : ${CXXPICFLAG=%OCTAVE_CONF_CXXPICFLAG%} | |
79 : ${XTRA_CFLAGS=%OCTAVE_CONF_XTRA_CFLAGS%} | |
80 : ${XTRA_CXXFLAGS=%OCTAVE_CONF_XTRA_CXXFLAGS%} | |
3051 | 81 |
15945
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
82 : ${AR=%OCTAVE_CONF_MKOCTFILE_AR%} |
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
83 : ${RANLIB=%OCTAVE_CONF_MKOCTFILE_RANLIB%} |
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
84 |
3846 | 85 : ${DEPEND_FLAGS=%OCTAVE_CONF_DEPEND_FLAGS%} |
86 : ${DEPEND_EXTRA_SED_PATTERN=%OCTAVE_CONF_DEPEND_EXTRA_SED_PATTERN%} | |
87 | |
15932
747dd82082c8
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
88 : ${DL_LD=%OCTAVE_CONF_MKOCTFILE_DL_LD%} |
4759 | 89 : ${DL_LDFLAGS=%OCTAVE_CONF_MKOCTFILE_DL_LDFLAGS%} |
3051 | 90 |
3859 | 91 : ${RDYNAMIC_FLAG=%OCTAVE_CONF_RDYNAMIC_FLAG%} |
4228 | 92 : ${LIBOCTAVE=-loctave} |
93 : ${LIBOCTINTERP=-loctinterp} | |
9515 | 94 : ${READLINE_LIBS=-lreadline} |
4228 | 95 : ${LIBCRUFT=-lcruft} |
11450
5eb10763069f
substitute and use LAPACK_LIBS in mkoctfile script
John W. Eaton <jwe@octave.org>
parents:
10901
diff
changeset
|
96 : ${LAPACK_LIBS=%OCTAVE_CONF_LAPACK_LIBS%} |
3859 | 97 : ${BLAS_LIBS=%OCTAVE_CONF_BLAS_LIBS%} |
9538
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
98 : ${FFTW3_LDFLAGS=%OCTAVE_CONF_FFTW3_LDFLAGS%} |
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
99 : ${FFTW3_LIBS=%OCTAVE_CONF_FFTW3_LIBS%} |
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
100 : ${FFTW3F_LDFLAGS=%OCTAVE_CONF_FFTW3F_LDFLAGS%} |
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
101 : ${FFTW3F_LIBS=%OCTAVE_CONF_FFTW3F_LIBS%} |
3859 | 102 : ${LIBS=%OCTAVE_CONF_LIBS%} |
103 : ${FLIBS=%OCTAVE_CONF_FLIBS%} | |
13010
edc5ec6e949b
maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
104 : ${OCTAVE_LINK_DEPS=%OCTAVE_CONF_OCTAVE_LINK_DEPS%} |
13133
edb015064732
Fix the names of some OCTAVE_CONF variables in mkoctfile.in
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
105 : ${OCTAVE_LINK_OPTS=%OCTAVE_CONF_OCTAVE_LINK_OPTS%} |
edb015064732
Fix the names of some OCTAVE_CONF variables in mkoctfile.in
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
106 : ${OCT_LINK_DEPS=%OCTAVE_CONF_OCT_LINK_DEPS%} |
edb015064732
Fix the names of some OCTAVE_CONF variables in mkoctfile.in
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
13025
diff
changeset
|
107 : ${OCT_LINK_OPTS=%OCTAVE_CONF_OCT_LINK_OPTS%} |
15932
747dd82082c8
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
108 : ${LD_CXX=%OCTAVE_CONF_MKOCTFILE_LD_CXX%} |
3859 | 109 : ${LDFLAGS=%OCTAVE_CONF_LDFLAGS%} |
110 : ${LD_STATIC_FLAG=%OCTAVE_CONF_LD_STATIC_FLAG%} | |
6311 | 111 : ${LFLAGS=$DEFAULT_LFLAGS} |
10773
cd16c1c3bc73
fix F77_INTEGER_8_FLAG problem in mkoctfile.in
Jaroslav Hajek <highegg@gmail.com>
parents:
10721
diff
changeset
|
112 : ${F77_INTEGER_8_FLAG=%OCTAVE_CONF_F77_INTEGER_8_FLAG%} |
3859 | 113 |
10721
4906ccf5d95e
use F77_INTEGER8_FLAG in BLAS checking as well as ALL_FFLAGS in mkoctfile
Jaroslav Hajek <highegg@gmail.com>
parents:
9957
diff
changeset
|
114 : ${ALL_FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"} |
3051 | 115 |
3131 | 116 : ${ALL_CFLAGS="$INCFLAGS $XTRA_CFLAGS $CFLAGS"} |
3051 | 117 |
3131 | 118 : ${ALL_CXXFLAGS="$INCFLAGS $XTRA_CXXFLAGS $CXXFLAGS"} |
3051 | 119 |
3887 | 120 : ${ALL_LDFLAGS="$LD_STATIC_FLAG $CPICFLAG $LDFLAGS"} |
3859 | 121 |
4228 | 122 : ${OCTAVE_LIBS="$LIBOCTINTERP $LIBOCTAVE $SPECIAL_MATH_LIB $LIBCRUFT"} |
3859 | 123 |
3051 | 124 # Local variables. |
125 | |
9538
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
126 FFTW_LIBS="$FFTW3_LDFLAGS $FFTW3_LIBS $FFTW3F_LDFLAGS $FFTW3F_LIBS" |
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
127 |
3051 | 128 usage_msg="usage: mkoctfile [options] file ..." |
129 | |
5285 | 130 version_msg="mkoctfile, version $OCTAVE_VERSION" |
131 | |
3051 | 132 cfiles= |
133 ccfiles= | |
134 f77files= | |
135 objfiles= | |
6294 | 136 libfiles= |
3051 | 137 octfiles= |
138 octfile= | |
3860 | 139 outputfile= |
3088 | 140 incflags= |
3180 | 141 defs= |
3051 | 142 ldflags= |
143 dbg=: | |
4873 | 144 pass_on_options= |
3058 | 145 strip=false |
4199 | 146 no_oct_file_strip_on_this_platform=%NO_OCT_FILE_STRIP% |
3735 | 147 link=true |
3859 | 148 link_stand_alone=false |
5864 | 149 output_ext=".oct" |
3846 | 150 depend=false |
151 compile=true | |
3051 | 152 |
153 if [ $# -eq 0 ]; then | |
3847 | 154 echo $usage_msg 1>&2 |
3846 | 155 exit 1 |
2163 | 156 fi |
157 | |
5285 | 158 if [ $# -eq 1 ]; then |
159 case "$1" in | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
160 -v | -version | --version) |
5285 | 161 echo $version_msg 1>&2 |
162 exit 0 | |
163 ;; | |
164 esac | |
165 fi | |
166 | |
3051 | 167 while [ $# -gt 0 ]; do |
168 file= | |
169 case "$1" in | |
170 *.c) | |
171 file=$1 | |
172 cfiles="$cfiles $file" | |
173 ;; | |
174 *.cc | *.C | *.cpp) | |
175 file=$1 | |
176 ccfiles="$ccfiles $file" | |
177 ;; | |
5970 | 178 *.f | *.F | *.f90 | *.F90) |
3051 | 179 file=$1 |
180 f77files="$f77files $file" | |
181 ;; | |
182 *.o) | |
183 file=$1 | |
184 objfiles="$objfiles $file" | |
185 ;; | |
6294 | 186 *.a) |
187 file=$1 | |
188 libfiles="$libfiles $file" | |
189 ;; | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
190 -d | -debug | --debug | -v | -verbose | --verbose) |
3051 | 191 dbg=echo |
192 ;; | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
193 -h | -\? | -help | --help) |
3847 | 194 echo $usage_msg 1>&2 |
3051 | 195 cat << EOF |
2163 | 196 |
3051 | 197 Options: |
198 | |
3233 | 199 -h, -?, --help Print this message. |
3734 | 200 |
3088 | 201 -IDIR Add -IDIR to compile commands. |
3734 | 202 |
5483 | 203 -idirafter DIR Add -idirafter DIR to compile commands. |
204 | |
3180 | 205 -DDEF Add -DDEF to compile commands. |
3734 | 206 |
12341
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
207 -lLIB Add -lLIB to link command. |
3734 | 208 |
3087 | 209 -LDIR Add -LDIR to link command. |
3734 | 210 |
12341
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
211 -RDIR Add -RDIR to link command. |
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
212 |
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
213 -g Enable debugging option for all compilers. |
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
214 |
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
215 -pthread Add -pthread to link command. |
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
216 |
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
217 -W... Pass flags to the compiler such as -Wa,OPTION. |
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
218 |
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
219 -Wl,... Pass flags to the linker such as -Wl,-rpath=... |
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
220 |
3846 | 221 -M, --depend Generate dependency files (.d) for C and C++ |
222 source files. | |
223 | |
12341
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
224 -c, --compile Compile, but do not link. |
5199 | 225 |
12341
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
226 --link-stand-alone Link a stand-alone executable file. |
6153 | 227 |
12341
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
228 -s, --strip Strip output file. |
5199 | 229 |
13010
edc5ec6e949b
maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
230 --mex Create a MEX file. |
12341
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
231 Set the default output extension to ".mex". |
3735 | 232 |
3859 | 233 -o FILE, --output FILE Output file name. Default extension is .oct |
5864 | 234 (or .mex if --mex is specified) unless linking |
235 a stand-alone executable. | |
3734 | 236 |
237 -p VAR, --print VAR Print configuration variable VAR. Recognized | |
238 variables are: | |
239 | |
15945
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
240 ALL_CFLAGS FFTW3F_LDFLAGS |
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
241 ALL_CXXFLAGS FFTW3F_LIBS |
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
242 ALL_FFLAGS FLIBS |
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
243 ALL_LDFLAGS FPICFLAG |
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
244 AR INCFLAGS |
13010
edc5ec6e949b
maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
245 BLAS_LIBS LAPACK_LIBS |
edc5ec6e949b
maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
246 CC LDFLAGS |
edc5ec6e949b
maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
247 CFLAGS LD_CXX |
edc5ec6e949b
maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
248 CPICFLAG LD_STATIC_FLAG |
edc5ec6e949b
maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
249 CPPFLAGS LFLAGS |
15945
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
250 CXX LIBOCTAVE |
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
251 CXXFLAGS LIBOCTINTERP |
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
252 CXXPICFLAG LIBS |
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
253 DEPEND_EXTRA_SED_PATTERN OCTAVE_LIBS |
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
254 DEPEND_FLAGS OCTAVE_LINK_DEPS |
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
255 DL_LD OCT_LINK_DEPS |
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
256 DL_LDFLAGS RANLIB |
13010
edc5ec6e949b
maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
257 EXEEXT RDYNAMIC_FLAG |
edc5ec6e949b
maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
258 F77 READLINE_LIBS |
13025
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
13024
diff
changeset
|
259 F77_INTEGER_8_FLAG SED |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
13024
diff
changeset
|
260 FFLAGS XTRA_CFLAGS |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
13024
diff
changeset
|
261 FFTW3_LDFLAGS XTRA_CXXFLAGS |
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
13024
diff
changeset
|
262 FFTW3_LIBS |
15945
a653526ea4a5
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15932
diff
changeset
|
263 |
3734 | 264 |
3058 | 265 -v, --verbose Echo commands as they are executed. |
3051 | 266 |
267 FILE Compile or link FILE. Recognized file types are: | |
268 | |
3847 | 269 .c C source |
270 .cc C++ source | |
271 .C C++ source | |
272 .cpp C++ source | |
5970 | 273 .f Fortran source (fixed form) |
274 .F Fortran source (fixed form) | |
275 .f90 Fortran source (free form) | |
276 .F90 Fortran source (free form) | |
3847 | 277 .o object file |
6294 | 278 .a library file |
2163 | 279 |
3051 | 280 EOF |
281 exit 0 | |
282 ;; | |
3088 | 283 -I*) |
3176 | 284 incflags="$incflags $1" |
3088 | 285 ;; |
5483 | 286 -idirafter) |
287 shift | |
288 if [ $# -gt 0 ]; then | |
289 incflags="$incflags -idirafter $1" | |
290 else | |
6782 | 291 echo "mkoctfile: include directory name missing" 1>&2 |
5483 | 292 fi |
293 ;; | |
3180 | 294 -D*) |
295 defs="$defs $1" | |
296 ;; | |
6153 | 297 -[lLR]* | -Wl,*) |
3176 | 298 ldflags="$ldflags $1" |
3058 | 299 ;; |
10901
860427ac9b77
Add ability to pass -pthread through to linker in mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
10773
diff
changeset
|
300 -pthread) |
860427ac9b77
Add ability to pass -pthread through to linker in mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
10773
diff
changeset
|
301 ldflags="$ldflags $1" |
860427ac9b77
Add ability to pass -pthread through to linker in mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
10773
diff
changeset
|
302 ;; |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
303 -M | -depend | --depend) |
3846 | 304 depend=true |
305 compile=false | |
306 ;; | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
307 -o | -ouput | --output) |
3051 | 308 shift |
309 if [ $# -gt 0 ]; then | |
3860 | 310 outputfile="$1" |
3051 | 311 else |
3847 | 312 echo "mkoctfile: output file name missing" 1>&2 |
3051 | 313 fi |
314 ;; | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
315 -p | -print | --print) |
3734 | 316 shift |
317 if [ $# -gt 0 ]; then | |
318 eval echo \${$1} | |
319 exit 0 | |
320 else | |
3847 | 321 echo "mkoctfile: --print requires argument" 1>&2 |
3734 | 322 exit 1 |
323 fi | |
324 ;; | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
325 -s | -strip | --strip) |
4199 | 326 if $no_oct_file_strip_on_this_platform; then |
327 echo "mkoctfile: stripping disabled on this platform" 1>&2 | |
328 else | |
329 strip=true | |
330 fi | |
3051 | 331 ;; |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
332 -c | -compile | --compile) |
3735 | 333 link=false |
334 ;; | |
5904 | 335 -g) |
336 ALL_CFLAGS="$ALL_CFLAGS -g" | |
337 ALL_CXXFLAGS="$ALL_CXXFLAGS -g" | |
338 ALL_FFLAGS="$ALL_FFLAGS -g" | |
339 ;; | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
340 -link-stand-alone | --link-stand-alone) |
3859 | 341 link_stand_alone=true |
342 ;; | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
343 -mex | --mex) |
6009 | 344 incflags="$incflags -I." |
5864 | 345 output_ext=".mex" |
346 ;; | |
12753
00fbb05f099c
Backout 2c54fde0f397 on stable; broke Octave-Forge packages
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
12733
diff
changeset
|
347 -W*) |
00fbb05f099c
Backout 2c54fde0f397 on stable; broke Octave-Forge packages
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
12733
diff
changeset
|
348 pass_on_options="$pass_on_options $1" |
4873 | 349 ;; |
3051 | 350 *) |
3847 | 351 echo "mkoctfile: unrecognized argument $1" 1>&2 |
3051 | 352 exit 1 |
353 ;; | |
354 esac | |
355 if [ -n "$file" ]; then | |
356 if [ -z "$octfile" ]; then | |
3859 | 357 octfile="$file" |
3051 | 358 fi |
359 fi | |
360 shift | |
361 done | |
2163 | 362 |
3859 | 363 if $link_stand_alone; then |
3860 | 364 if [ -n "$outputfile" ]; then |
365 output_option="-o $outputfile" | |
366 fi | |
3859 | 367 else |
3860 | 368 if [ -n "$outputfile" ]; then |
369 octfile="$outputfile" | |
9957
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
370 case "$octfile" in |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
371 *$output_ext) |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
372 ;; |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
373 *) |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
374 octfile="$octfile$output_ext" |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
375 ;; |
59ed11557715
mkoctfile: if output file is specified and it does not end in output_ext, append output_ext
John W. Eaton <jwe@octave.org>
parents:
9956
diff
changeset
|
376 esac |
3860 | 377 else |
6187 | 378 octfile=`basename $octfile` |
5864 | 379 octfile=`echo $octfile | $SED 's,\.[^.]*$,,'`$output_ext |
3860 | 380 fi |
3859 | 381 fi |
382 | |
3846 | 383 # Generate dependency files for C and C++ files. |
384 | |
385 if $depend; then | |
386 if [ -n "$cfiles" ]; then | |
387 for f in $cfiles; do | |
4084 | 388 b=`echo $f | $SED 's,\.c$,,'` |
3846 | 389 d=$b.d |
3847 | 390 cmd="rm -f $d" |
391 $dbg $cmd | |
392 eval $cmd | |
4206 | 393 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 | 394 $dbg $cmd |
395 eval $cmd | |
396 done | |
397 fi | |
398 | |
399 if [ -n "$ccfiles" ]; then | |
400 for f in $ccfiles; do | |
401 case $f in | |
3847 | 402 *.cc) |
4084 | 403 b=`echo $f | $SED 's,\.cc$,,'` |
3847 | 404 ;; |
405 *.C) | |
4084 | 406 b=`echo $f | $SED 's,\.C$,,'` |
3847 | 407 ;; |
408 *.cpp) | |
4084 | 409 b=`echo $f | $SED 's,\.cpp$,,'` |
3847 | 410 ;; |
3846 | 411 esac |
412 d=$b.d | |
3847 | 413 cmd="rm -f $d" |
414 $dbg $cmd | |
415 eval $cmd | |
4206 | 416 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 | 417 $dbg $cmd |
418 eval $cmd | |
419 done | |
420 fi | |
421 # If generating dependencies, that's all we do. | |
422 exit 0 | |
423 fi | |
424 | |
3051 | 425 # Compile Fortran, C, and C++ files. Add the name of each object file |
426 # that is produced to the overall list of object files. | |
2163 | 427 |
3051 | 428 if [ -n "$f77files" ]; then |
429 for f in $f77files; do | |
430 case $f in | |
431 *.f) | |
9956
f26a33e21db9
mkoctfile: when compiling files in subdirectories, place object files in current directory by default
John W. Eaton <jwe@octave.org>
parents:
9954
diff
changeset
|
432 b=`echo $f | $SED 's,.*/,,; s,\.f$,,'` |
3051 | 433 ;; |
434 *.F) | |
9956
f26a33e21db9
mkoctfile: when compiling files in subdirectories, place object files in current directory by default
John W. Eaton <jwe@octave.org>
parents:
9954
diff
changeset
|
435 b=`echo $f | $SED 's,.*/,,; s,\.F$,,'` |
3051 | 436 ;; |
5970 | 437 *.f90) |
9956
f26a33e21db9
mkoctfile: when compiling files in subdirectories, place object files in current directory by default
John W. Eaton <jwe@octave.org>
parents:
9954
diff
changeset
|
438 b=`echo $f | $SED 's,.*/,,; s,\.f90$,,'` |
5970 | 439 ;; |
440 *.F90) | |
9956
f26a33e21db9
mkoctfile: when compiling files in subdirectories, place object files in current directory by default
John W. Eaton <jwe@octave.org>
parents:
9954
diff
changeset
|
441 b=`echo $f | $SED 's,.*/,,; s,\.F90$,,'` |
5970 | 442 ;; |
3051 | 443 esac |
3847 | 444 if [ -n "$F77" ]; then |
5159 | 445 if [ -n "$outputfile" ]; then |
12174 | 446 if $link; then |
447 o=$b.o | |
448 else | |
449 o=$outputfile | |
450 fi | |
5159 | 451 else |
452 o=$b.o | |
453 fi | |
3847 | 454 objfiles="$objfiles $o" |
5970 | 455 cmd="$F77 -c $FPICFLAG $ALL_FFLAGS $incflags $defs $pass_on_options $f -o $o" |
3847 | 456 $dbg $cmd |
457 eval $cmd | |
458 else | |
459 echo "mkoctfile: no way to compile Fortran file $f" 1>&2 | |
460 fi | |
3051 | 461 done |
462 fi | |
2163 | 463 |
3051 | 464 if [ -n "$cfiles" ]; then |
465 for f in $cfiles; do | |
3847 | 466 if [ -n "$CC" ]; then |
9956
f26a33e21db9
mkoctfile: when compiling files in subdirectories, place object files in current directory by default
John W. Eaton <jwe@octave.org>
parents:
9954
diff
changeset
|
467 b=`echo $f | $SED 's,.*/,,; s,\.c$,,'` |
5159 | 468 if [ -n "$outputfile" ]; then |
12174 | 469 if $link; then |
470 o=$b.o | |
471 else | |
472 o=$outputfile | |
473 fi | |
5159 | 474 else |
12174 | 475 o=$b.o |
5159 | 476 fi |
3847 | 477 objfiles="$objfiles $o" |
4873 | 478 cmd="$CC -c $CPPFLAGS $CPICFLAG $ALL_CFLAGS $pass_on_options $incflags $defs $f -o $o" |
3847 | 479 $dbg $cmd |
480 eval $cmd | |
481 else | |
482 echo "mkoctfile: no way to compile C++ file $f" 1>&2 | |
483 fi | |
3051 | 484 done |
485 fi | |
2163 | 486 |
3051 | 487 if [ -n "$ccfiles" ]; then |
488 for f in $ccfiles; do | |
3847 | 489 if [ -n "$CXX" ]; then |
490 case $f in | |
12174 | 491 *.cc) |
492 b=`echo $f | $SED 's,.*/,,; s,\.cc$,,'` | |
493 ;; | |
494 *.C) | |
495 b=`echo $f | $SED 's,.*/,,; s,\.C$,,'` | |
496 ;; | |
497 *.cpp) | |
498 b=`echo $f | $SED 's,.*/,,; s,\.cpp$,,'` | |
499 ;; | |
3847 | 500 esac |
5159 | 501 if [ -n "$outputfile" ]; then |
12174 | 502 if $link; then |
503 o=$b.o | |
504 else | |
505 o=$outputfile | |
506 fi | |
5159 | 507 else |
12174 | 508 o=$b.o |
5159 | 509 fi |
3847 | 510 objfiles="$objfiles $o" |
4873 | 511 cmd="$CXX -c $CPPFLAGS $CXXPICFLAG $ALL_CXXFLAGS $pass_on_options $incflags $defs $f -o $o" |
3847 | 512 $dbg $cmd |
513 eval $cmd | |
514 else | |
515 echo "mkoctfile: no way to compile C++ file $f" 1>&2 | |
516 fi | |
3051 | 517 done |
518 fi | |
519 | |
3660 | 520 ## Uncomment the following group of lines if you get `Text file busy' |
521 ## errors from ld. This may happen if the .oct file is currently | |
522 ## running while you are trying to recompile it. We try moving first, | |
3733 | 523 ## since on some systems (HP-UX, maybe others) it is possible to |
3660 | 524 ## rename running programs but not remove them. |
525 | |
3663 | 526 ## if [ -f "$octfile" ]; then |
3847 | 527 ## cmd="mv $octfile $octfile.bak" |
528 ## $dbg $cmd | |
529 ## eval $cmd | |
530 ## cmd="rm -f $octfile.bak" | |
531 ## $dbg $cmd | |
532 ## eval $cmd | |
3663 | 533 ## fi |
3659 | 534 |
3051 | 535 # Link all the object files. |
536 | |
5285 | 537 if $link && [ -n "$objfiles" ]; then |
3859 | 538 if $link_stand_alone; then |
539 if [ -n "$LD_CXX" ]; then | |
13025
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
13024
diff
changeset
|
540 cmd="$LD_CXX $CPPFLAGS $ALL_CXXFLAGS $RDYNAMIC_FLAG $ALL_LDFLAGS $pass_on_options $output_option $objfiles $libfiles $ldflags $LFLAGS -loctinterp -loctave -lcruft $OCTAVE_LINK_OPTS $OCTAVE_LINK_DEPS" |
3859 | 541 $dbg $cmd |
542 eval $cmd | |
543 else | |
544 echo "mkoctfile: no way to link stand-alone executable file" 1>&2 | |
545 exit 1 | |
546 fi | |
547 else | |
13024
f3c53fea9fb5
maint: more linking tweaks
John W. Eaton <jwe@octave.org>
parents:
13010
diff
changeset
|
548 cmd="$DL_LD $DL_LDFLAGS $pass_on_options -o $octfile $objfiles $libfiles $ldflags $LFLAGS -loctinterp -loctave -lcruft $OCT_LINK_OPTS $OCT_LINK_DEPS" |
3859 | 549 $dbg $cmd |
550 eval $cmd | |
551 fi | |
3058 | 552 |
553 # Maybe strip it. | |
554 | |
3847 | 555 if $strip; then |
556 cmd="strip $octfile" | |
557 $dbg $cmd | |
558 eval $cmd | |
559 fi | |
3735 | 560 fi |
3058 | 561 |
562 exit 0 |