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