Mercurial > octave-nkf
annotate src/mkoctfile.in.sh @ 16033:23a7661e529a ss-3-7-2
snapshot version 3.7.2
* configure.ac (AC_INIT): Set version to 3.7.2.
(OCTAVE_RELEASE_DATE): Set to 2013-02-09.
(OCTAVE_COPYRIGHT): Update year.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 10 Feb 2013 00:59:19 -0500 |
parents | 25eff7fe556d |
children | d63878346099 |
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} |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
70 : ${F77=%OCTAVE_CONF_MKOCTFILE_F77%} |
3590 | 71 : ${FFLAGS=%OCTAVE_CONF_FFLAGS%} |
72 : ${FPICFLAG=%OCTAVE_CONF_FPICFLAG%} | |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
73 : ${CC=%OCTAVE_CONF_MKOCTFILE_CC%} |
3590 | 74 : ${CFLAGS=%OCTAVE_CONF_CFLAGS%} |
75 : ${CPICFLAG=%OCTAVE_CONF_CPICFLAG%} | |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15271
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 |
15944
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
82 : ${AR=%OCTAVE_CONF_MKOCTFILE_AR%} |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
83 : ${RANLIB=%OCTAVE_CONF_MKOCTFILE_RANLIB%} |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
84 |
3846 | 85 : ${DEPEND_FLAGS=%OCTAVE_CONF_DEPEND_FLAGS%} |
86 : ${DEPEND_EXTRA_SED_PATTERN=%OCTAVE_CONF_DEPEND_EXTRA_SED_PATTERN%} | |
87 | |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15271
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} |
11450
5eb10763069f
substitute and use LAPACK_LIBS in mkoctfile script
John W. Eaton <jwe@octave.org>
parents:
10901
diff
changeset
|
95 : ${LAPACK_LIBS=%OCTAVE_CONF_LAPACK_LIBS%} |
3859 | 96 : ${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
|
97 : ${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
|
98 : ${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
|
99 : ${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
|
100 : ${FFTW3F_LIBS=%OCTAVE_CONF_FFTW3F_LIBS%} |
3859 | 101 : ${LIBS=%OCTAVE_CONF_LIBS%} |
102 : ${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
|
103 : ${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
|
104 : ${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
|
105 : ${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
|
106 : ${OCT_LINK_OPTS=%OCTAVE_CONF_OCT_LINK_OPTS%} |
15929
16418ff39a72
strip cross tool prefix from CC, CXX, etc. definitions used in mkoctfile
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
107 : ${LD_CXX=%OCTAVE_CONF_MKOCTFILE_LD_CXX%} |
3859 | 108 : ${LDFLAGS=%OCTAVE_CONF_LDFLAGS%} |
109 : ${LD_STATIC_FLAG=%OCTAVE_CONF_LD_STATIC_FLAG%} | |
6311 | 110 : ${LFLAGS=$DEFAULT_LFLAGS} |
10773
cd16c1c3bc73
fix F77_INTEGER_8_FLAG problem in mkoctfile.in
Jaroslav Hajek <highegg@gmail.com>
parents:
10721
diff
changeset
|
111 : ${F77_INTEGER_8_FLAG=%OCTAVE_CONF_F77_INTEGER_8_FLAG%} |
3859 | 112 |
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
|
113 : ${ALL_FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"} |
3051 | 114 |
3131 | 115 : ${ALL_CFLAGS="$INCFLAGS $XTRA_CFLAGS $CFLAGS"} |
3051 | 116 |
3131 | 117 : ${ALL_CXXFLAGS="$INCFLAGS $XTRA_CXXFLAGS $CXXFLAGS"} |
3051 | 118 |
3887 | 119 : ${ALL_LDFLAGS="$LD_STATIC_FLAG $CPICFLAG $LDFLAGS"} |
3859 | 120 |
15271
648dabbb4c6b
build: Refactor liboctave into multiple subdirectories. Move libcruft into liboctave.
Rik <rik@octave.org>
parents:
14547
diff
changeset
|
121 : ${OCTAVE_LIBS="$LIBOCTINTERP $LIBOCTAVE $SPECIAL_MATH_LIB"} |
3859 | 122 |
3051 | 123 # Local variables. |
124 | |
9538
d0239bddf621
use OCTAVE_CHECK_LIB to check for zlib
John W. Eaton <jwe@octave.org>
parents:
9515
diff
changeset
|
125 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
|
126 |
3051 | 127 usage_msg="usage: mkoctfile [options] file ..." |
128 | |
5285 | 129 version_msg="mkoctfile, version $OCTAVE_VERSION" |
130 | |
3051 | 131 cfiles= |
132 ccfiles= | |
133 f77files= | |
134 objfiles= | |
6294 | 135 libfiles= |
3051 | 136 octfiles= |
137 octfile= | |
3860 | 138 outputfile= |
3088 | 139 incflags= |
3180 | 140 defs= |
3051 | 141 ldflags= |
142 dbg=: | |
4873 | 143 pass_on_options= |
3058 | 144 strip=false |
4199 | 145 no_oct_file_strip_on_this_platform=%NO_OCT_FILE_STRIP% |
3735 | 146 link=true |
3859 | 147 link_stand_alone=false |
5864 | 148 output_ext=".oct" |
3846 | 149 depend=false |
150 compile=true | |
3051 | 151 |
152 if [ $# -eq 0 ]; then | |
3847 | 153 echo $usage_msg 1>&2 |
3846 | 154 exit 1 |
2163 | 155 fi |
156 | |
5285 | 157 if [ $# -eq 1 ]; then |
158 case "$1" in | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
159 -v | -version | --version) |
5285 | 160 echo $version_msg 1>&2 |
161 exit 0 | |
162 ;; | |
163 esac | |
164 fi | |
165 | |
3051 | 166 while [ $# -gt 0 ]; do |
167 file= | |
168 case "$1" in | |
169 *.c) | |
170 file=$1 | |
171 cfiles="$cfiles $file" | |
172 ;; | |
173 *.cc | *.C | *.cpp) | |
174 file=$1 | |
175 ccfiles="$ccfiles $file" | |
176 ;; | |
5970 | 177 *.f | *.F | *.f90 | *.F90) |
3051 | 178 file=$1 |
179 f77files="$f77files $file" | |
180 ;; | |
181 *.o) | |
182 file=$1 | |
183 objfiles="$objfiles $file" | |
184 ;; | |
6294 | 185 *.a) |
186 file=$1 | |
187 libfiles="$libfiles $file" | |
188 ;; | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
189 -d | -debug | --debug | -v | -verbose | --verbose) |
3051 | 190 dbg=echo |
191 ;; | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
192 -h | -\? | -help | --help) |
3847 | 193 echo $usage_msg 1>&2 |
3051 | 194 cat << EOF |
2163 | 195 |
3051 | 196 Options: |
197 | |
3233 | 198 -h, -?, --help Print this message. |
3734 | 199 |
3088 | 200 -IDIR Add -IDIR to compile commands. |
3734 | 201 |
5483 | 202 -idirafter DIR Add -idirafter DIR to compile commands. |
203 | |
3180 | 204 -DDEF Add -DDEF to compile commands. |
3734 | 205 |
12341
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
206 -lLIB Add -lLIB to link command. |
3734 | 207 |
3087 | 208 -LDIR Add -LDIR to link command. |
3734 | 209 |
12341
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
210 -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
|
211 |
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
212 -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
|
213 |
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
214 -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
|
215 |
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
216 -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
|
217 |
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
218 -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
|
219 |
3846 | 220 -M, --depend Generate dependency files (.d) for C and C++ |
221 source files. | |
222 | |
12341
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
223 -c, --compile Compile, but do not link. |
5199 | 224 |
12341
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
225 --link-stand-alone Link a stand-alone executable file. |
6153 | 226 |
12341
402456ba3f61
Overhaul usage strings and man pages for octave, octave-config, mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
12174
diff
changeset
|
227 -s, --strip Strip output file. |
5199 | 228 |
13010
edc5ec6e949b
maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
229 --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
|
230 Set the default output extension to ".mex". |
3735 | 231 |
3859 | 232 -o FILE, --output FILE Output file name. Default extension is .oct |
5864 | 233 (or .mex if --mex is specified) unless linking |
234 a stand-alone executable. | |
3734 | 235 |
236 -p VAR, --print VAR Print configuration variable VAR. Recognized | |
237 variables are: | |
238 | |
15944
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
239 ALL_CFLAGS FFTW3F_LDFLAGS |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
240 ALL_CXXFLAGS FFTW3F_LIBS |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
241 ALL_FFLAGS FLIBS |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
242 ALL_LDFLAGS FPICFLAG |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
243 AR INCFLAGS |
13010
edc5ec6e949b
maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
244 BLAS_LIBS LAPACK_LIBS |
edc5ec6e949b
maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
245 CC LDFLAGS |
edc5ec6e949b
maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
246 CFLAGS LD_CXX |
edc5ec6e949b
maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
247 CPICFLAG LD_STATIC_FLAG |
edc5ec6e949b
maint: allow --enable-static --disable-dl to work again
John W. Eaton <jwe@octave.org>
parents:
12753
diff
changeset
|
248 CPPFLAGS LFLAGS |
15944
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
249 CXX LIBOCTAVE |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
250 CXXFLAGS LIBOCTINTERP |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
251 CXXPICFLAG LIBS |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
252 DEPEND_EXTRA_SED_PATTERN OCTAVE_LIBS |
15271
648dabbb4c6b
build: Refactor liboctave into multiple subdirectories. Move libcruft into liboctave.
Rik <rik@octave.org>
parents:
14547
diff
changeset
|
253 DEPEND_FLAGS OCTAVE_LINK_DEPS |
15944
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
254 DL_LD OCT_LINK_DEPS |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
255 DL_LDFLAGS RANLIB |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
256 EXEEXT RDYNAMIC_FLAG |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
257 F77 READLINE_LIBS |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
258 F77_INTEGER_8_FLAG SED |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
259 FFLAGS XTRA_CFLAGS |
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
260 FFTW3_LDFLAGS XTRA_CXXFLAGS |
13025
4a86826dbb0e
maint: remove remaining references to RLD_FLAG
John W. Eaton <jwe@octave.org>
parents:
13024
diff
changeset
|
261 FFTW3_LIBS |
15944
4803b8c138e3
use mkoctfile, not octave_config_info to get default pkg compiler tools
John W. Eaton <jwe@octave.org>
parents:
15933
diff
changeset
|
262 |
3734 | 263 |
3058 | 264 -v, --verbose Echo commands as they are executed. |
3051 | 265 |
266 FILE Compile or link FILE. Recognized file types are: | |
267 | |
3847 | 268 .c C source |
269 .cc C++ source | |
270 .C C++ source | |
271 .cpp C++ source | |
5970 | 272 .f Fortran source (fixed form) |
273 .F Fortran source (fixed form) | |
274 .f90 Fortran source (free form) | |
275 .F90 Fortran source (free form) | |
3847 | 276 .o object file |
6294 | 277 .a library file |
2163 | 278 |
3051 | 279 EOF |
280 exit 0 | |
281 ;; | |
3088 | 282 -I*) |
3176 | 283 incflags="$incflags $1" |
3088 | 284 ;; |
5483 | 285 -idirafter) |
286 shift | |
287 if [ $# -gt 0 ]; then | |
288 incflags="$incflags -idirafter $1" | |
289 else | |
6782 | 290 echo "mkoctfile: include directory name missing" 1>&2 |
5483 | 291 fi |
292 ;; | |
3180 | 293 -D*) |
294 defs="$defs $1" | |
295 ;; | |
6153 | 296 -[lLR]* | -Wl,*) |
3176 | 297 ldflags="$ldflags $1" |
3058 | 298 ;; |
10901
860427ac9b77
Add ability to pass -pthread through to linker in mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
10773
diff
changeset
|
299 -pthread) |
860427ac9b77
Add ability to pass -pthread through to linker in mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
10773
diff
changeset
|
300 ldflags="$ldflags $1" |
860427ac9b77
Add ability to pass -pthread through to linker in mkoctfile.
Rik <octave@nomad.inbox5.com>
parents:
10773
diff
changeset
|
301 ;; |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
302 -M | -depend | --depend) |
3846 | 303 depend=true |
304 compile=false | |
305 ;; | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
306 -o | -ouput | --output) |
3051 | 307 shift |
308 if [ $# -gt 0 ]; then | |
3860 | 309 outputfile="$1" |
3051 | 310 else |
3847 | 311 echo "mkoctfile: output file name missing" 1>&2 |
3051 | 312 fi |
313 ;; | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
314 -p | -print | --print) |
3734 | 315 shift |
316 if [ $# -gt 0 ]; then | |
317 eval echo \${$1} | |
318 exit 0 | |
319 else | |
3847 | 320 echo "mkoctfile: --print requires argument" 1>&2 |
3734 | 321 exit 1 |
322 fi | |
323 ;; | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
324 -s | -strip | --strip) |
4199 | 325 if $no_oct_file_strip_on_this_platform; then |
326 echo "mkoctfile: stripping disabled on this platform" 1>&2 | |
327 else | |
328 strip=true | |
329 fi | |
3051 | 330 ;; |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
331 -c | -compile | --compile) |
3735 | 332 link=false |
333 ;; | |
5904 | 334 -g) |
335 ALL_CFLAGS="$ALL_CFLAGS -g" | |
336 ALL_CXXFLAGS="$ALL_CXXFLAGS -g" | |
337 ALL_FFLAGS="$ALL_FFLAGS -g" | |
338 ;; | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
339 -link-stand-alone | --link-stand-alone) |
3859 | 340 link_stand_alone=true |
341 ;; | |
9954
de6b6173c990
mkoctfile.in: accept long options with single -
John W. Eaton <jwe@octave.org>
parents:
9794
diff
changeset
|
342 -mex | --mex) |
6009 | 343 incflags="$incflags -I." |
5864 | 344 output_ext=".mex" |
345 ;; | |
12753
00fbb05f099c
Backout 2c54fde0f397 on stable; broke Octave-Forge packages
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
12733
diff
changeset
|
346 -W*) |
00fbb05f099c
Backout 2c54fde0f397 on stable; broke Octave-Forge packages
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
12733
diff
changeset
|
347 pass_on_options="$pass_on_options $1" |
4873 | 348 ;; |
3051 | 349 *) |
3847 | 350 echo "mkoctfile: unrecognized argument $1" 1>&2 |
3051 | 351 exit 1 |
352 ;; | |
353 esac | |
354 if [ -n "$file" ]; then | |
355 if [ -z "$octfile" ]; then | |
3859 | 356 octfile="$file" |
3051 | 357 fi |
358 fi | |
359 shift | |
360 done | |
2163 | 361 |
3859 | 362 if $link_stand_alone; then |
3860 | 363 if [ -n "$outputfile" ]; then |
364 output_option="-o $outputfile" | |
365 fi | |
3859 | 366 else |
3860 | 367 if [ -n "$outputfile" ]; then |
368 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
|
369 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
|
370 *$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
|
371 ;; |
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 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
|
374 ;; |
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 esac |
3860 | 376 else |
6187 | 377 octfile=`basename $octfile` |
5864 | 378 octfile=`echo $octfile | $SED 's,\.[^.]*$,,'`$output_ext |
3860 | 379 fi |
3859 | 380 fi |
381 | |
3846 | 382 # Generate dependency files for C and C++ files. |
383 | |
384 if $depend; then | |
385 if [ -n "$cfiles" ]; then | |
386 for f in $cfiles; do | |
4084 | 387 b=`echo $f | $SED 's,\.c$,,'` |
3846 | 388 d=$b.d |
3847 | 389 cmd="rm -f $d" |
390 $dbg $cmd | |
391 eval $cmd | |
4206 | 392 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 | 393 $dbg $cmd |
394 eval $cmd | |
395 done | |
396 fi | |
397 | |
398 if [ -n "$ccfiles" ]; then | |
399 for f in $ccfiles; do | |
400 case $f in | |
3847 | 401 *.cc) |
4084 | 402 b=`echo $f | $SED 's,\.cc$,,'` |
3847 | 403 ;; |
404 *.C) | |
4084 | 405 b=`echo $f | $SED 's,\.C$,,'` |
3847 | 406 ;; |
407 *.cpp) | |
4084 | 408 b=`echo $f | $SED 's,\.cpp$,,'` |
3847 | 409 ;; |
3846 | 410 esac |
411 d=$b.d | |
3847 | 412 cmd="rm -f $d" |
413 $dbg $cmd | |
414 eval $cmd | |
4206 | 415 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 | 416 $dbg $cmd |
417 eval $cmd | |
418 done | |
419 fi | |
420 # If generating dependencies, that's all we do. | |
421 exit 0 | |
422 fi | |
423 | |
3051 | 424 # Compile Fortran, C, and C++ files. Add the name of each object file |
425 # that is produced to the overall list of object files. | |
2163 | 426 |
3051 | 427 if [ -n "$f77files" ]; then |
428 for f in $f77files; do | |
429 case $f in | |
430 *.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
|
431 b=`echo $f | $SED 's,.*/,,; s,\.f$,,'` |
3051 | 432 ;; |
433 *.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
|
434 b=`echo $f | $SED 's,.*/,,; s,\.F$,,'` |
3051 | 435 ;; |
5970 | 436 *.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
|
437 b=`echo $f | $SED 's,.*/,,; s,\.f90$,,'` |
5970 | 438 ;; |
439 *.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
|
440 b=`echo $f | $SED 's,.*/,,; s,\.F90$,,'` |
5970 | 441 ;; |
3051 | 442 esac |
3847 | 443 if [ -n "$F77" ]; then |
5159 | 444 if [ -n "$outputfile" ]; then |
12174 | 445 if $link; then |
446 o=$b.o | |
447 else | |
448 o=$outputfile | |
449 fi | |
5159 | 450 else |
451 o=$b.o | |
452 fi | |
3847 | 453 objfiles="$objfiles $o" |
5970 | 454 cmd="$F77 -c $FPICFLAG $ALL_FFLAGS $incflags $defs $pass_on_options $f -o $o" |
3847 | 455 $dbg $cmd |
456 eval $cmd | |
457 else | |
458 echo "mkoctfile: no way to compile Fortran file $f" 1>&2 | |
459 fi | |
3051 | 460 done |
461 fi | |
2163 | 462 |
3051 | 463 if [ -n "$cfiles" ]; then |
464 for f in $cfiles; do | |
3847 | 465 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
|
466 b=`echo $f | $SED 's,.*/,,; s,\.c$,,'` |
5159 | 467 if [ -n "$outputfile" ]; then |
12174 | 468 if $link; then |
469 o=$b.o | |
470 else | |
471 o=$outputfile | |
472 fi | |
5159 | 473 else |
12174 | 474 o=$b.o |
5159 | 475 fi |
3847 | 476 objfiles="$objfiles $o" |
4873 | 477 cmd="$CC -c $CPPFLAGS $CPICFLAG $ALL_CFLAGS $pass_on_options $incflags $defs $f -o $o" |
3847 | 478 $dbg $cmd |
479 eval $cmd | |
480 else | |
481 echo "mkoctfile: no way to compile C++ file $f" 1>&2 | |
482 fi | |
3051 | 483 done |
484 fi | |
2163 | 485 |
3051 | 486 if [ -n "$ccfiles" ]; then |
487 for f in $ccfiles; do | |
3847 | 488 if [ -n "$CXX" ]; then |
489 case $f in | |
12174 | 490 *.cc) |
491 b=`echo $f | $SED 's,.*/,,; s,\.cc$,,'` | |
492 ;; | |
493 *.C) | |
494 b=`echo $f | $SED 's,.*/,,; s,\.C$,,'` | |
495 ;; | |
496 *.cpp) | |
497 b=`echo $f | $SED 's,.*/,,; s,\.cpp$,,'` | |
498 ;; | |
3847 | 499 esac |
5159 | 500 if [ -n "$outputfile" ]; then |
12174 | 501 if $link; then |
502 o=$b.o | |
503 else | |
504 o=$outputfile | |
505 fi | |
5159 | 506 else |
12174 | 507 o=$b.o |
5159 | 508 fi |
3847 | 509 objfiles="$objfiles $o" |
4873 | 510 cmd="$CXX -c $CPPFLAGS $CXXPICFLAG $ALL_CXXFLAGS $pass_on_options $incflags $defs $f -o $o" |
3847 | 511 $dbg $cmd |
512 eval $cmd | |
513 else | |
514 echo "mkoctfile: no way to compile C++ file $f" 1>&2 | |
515 fi | |
3051 | 516 done |
517 fi | |
518 | |
3660 | 519 ## Uncomment the following group of lines if you get `Text file busy' |
520 ## errors from ld. This may happen if the .oct file is currently | |
521 ## running while you are trying to recompile it. We try moving first, | |
3733 | 522 ## since on some systems (HP-UX, maybe others) it is possible to |
3660 | 523 ## rename running programs but not remove them. |
524 | |
3663 | 525 ## if [ -f "$octfile" ]; then |
3847 | 526 ## cmd="mv $octfile $octfile.bak" |
527 ## $dbg $cmd | |
528 ## eval $cmd | |
529 ## cmd="rm -f $octfile.bak" | |
530 ## $dbg $cmd | |
531 ## eval $cmd | |
3663 | 532 ## fi |
3659 | 533 |
3051 | 534 # Link all the object files. |
535 | |
5285 | 536 if $link && [ -n "$objfiles" ]; then |
3859 | 537 if $link_stand_alone; then |
538 if [ -n "$LD_CXX" ]; then | |
15271
648dabbb4c6b
build: Refactor liboctave into multiple subdirectories. Move libcruft into liboctave.
Rik <rik@octave.org>
parents:
14547
diff
changeset
|
539 cmd="$LD_CXX $CPPFLAGS $ALL_CXXFLAGS $RDYNAMIC_FLAG $ALL_LDFLAGS $pass_on_options $output_option $objfiles $libfiles $ldflags $LFLAGS -loctinterp -loctave $OCTAVE_LINK_OPTS $OCTAVE_LINK_DEPS" |
3859 | 540 $dbg $cmd |
541 eval $cmd | |
542 else | |
543 echo "mkoctfile: no way to link stand-alone executable file" 1>&2 | |
544 exit 1 | |
545 fi | |
546 else | |
15271
648dabbb4c6b
build: Refactor liboctave into multiple subdirectories. Move libcruft into liboctave.
Rik <rik@octave.org>
parents:
14547
diff
changeset
|
547 cmd="$DL_LD $DL_LDFLAGS $pass_on_options -o $octfile $objfiles $libfiles $ldflags $LFLAGS -loctinterp -loctave $OCT_LINK_OPTS $OCT_LINK_DEPS" |
3859 | 548 $dbg $cmd |
549 eval $cmd | |
550 fi | |
3058 | 551 |
552 # Maybe strip it. | |
553 | |
3847 | 554 if $strip; then |
555 cmd="strip $octfile" | |
556 $dbg $cmd | |
557 eval $cmd | |
558 fi | |
3735 | 559 fi |
3058 | 560 |
561 exit 0 |