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