.\" --------------------------------------------------------------------
.\"
.\" Copyright (C) 2000-2026 The Octave Project Developers
.\"
.\" See the file COPYRIGHT.md in the top-level directory of this
.\" or .
.\"
.\" This file is part of Octave.
.\"
.\" Octave is free software: you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License as published by
.\" the Free Software Foundation, either version 3 of the License, or
.\" (at your option) any later version.
.\"
.\" Octave is distributed in the hope that it will be useful, but
.\" WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with Octave; see the file COPYING. If not, see
.\" .
.\"
.\" --------------------------------------------------------------------
.\"
.de Vb \" (V)erbatim (b)egin. Use fixed width font and no justification
.ft CW
.nf
..
.de Ve \" (V)erbatim (e)nd. Return to regular font and justification
.ft R
.fi
..
.\" --------------------------------------------------------------------
.TH mkoctfile 1 "April 2026" "GNU Octave"
.SH NAME
mkoctfile \- Compile dynamic\-load modules for GNU Octave
.SH SYNOPSIS
\fBmkoctfile\fP [\fIoption\fP]\|.\|.\|.\& FILE\|.\|.\|.\&
.SH DESCRIPTION
\fBmkoctfile\fP is used to compile C, C++, or Fortran source code in to a
dynamically loadable \fB.oct\fP file for
.MR octave 1 .
.SH OPTIONS
.TP
\fB\-h\fP, \fB\-\-help\fP
Print help message.
.TP
.B \-I\fIdir\fP
Add include directory \fIdir\fP to compile command.
.TP
.B \-idirafter \fIdir\fP
Add include directory to second include search path for compilation
after '\fB\-I\fP'.
.TP
.B \-D\fIdef\fP
Add definition \fIdef\fP to compile command.
.TP
.B \-l\fIlib\fP
Add library \fIlib\fP to link command.
.TP
.B \-L\fIdir\fP
Add library directory \fIdir\fP to link command.
.TP
.B \-M\fR,\fB \-\-depend
Generate dependency files (\fB.d\fP) for C and C++ source files.
.TP
.B \-pthread
Add \fB\-pthread\fP to link command.
.TP
.B \-R\fIdir\fP
Pass \fB\-R\fP\fIdir\fP to link command.
.TP
.B \-Wl,\fIoption\fP
Pass option to the linker such as \fB\-Wl,\-rpath=...\fP
.TP
.B \-W...
Pass flags to the compiler such as \fB\-Wa,\fP\fIoption\fP.
.TP
.B \-c\fR,\fB \-\-compile
Compile, but do not link.
.TP
.B \-o \fIfile\fP\fR,\fB \-\-output \fIfile\fP
Output filename. Default extension is "\fB.oct\fP" (or "\fB.mex\fP" if
\fB\-\-mex\fP is specified) unless linking a stand-alone executable.
.TP
.B \-g
Enable debugging option for all compilers.
.TP
.B \-p \fIVAR\fP\fR,\fB \-\-print \fIVAR\fP
Print configuration variable \fIVAR\fP. There are three categories of
variables:
.IP
Octave configuration variables that users may override with environment
variables. These are used in commands that \%\fBmkoctfile\fP executes.
.RS
.Vb
ALL_CFLAGS INCLUDEDIR
ALL_CXXFLAGS LAPACK_LIBS
ALL_FFLAGS LDFLAGS
ALL_LDFLAGS LD_STATIC_FLAG
BLAS_LIBS LFLAGS
CC LIBDIR
CFLAGS LIBOCTAVE
CPICFLAG LIBOCTINTERP
CPPFLAGS OCTAVE_LINK_OPTS
CXX OCTINCLUDEDIR
CXXFLAGS OCTAVE_LIBS
CXXLD OCTAVE_LINK_DEPS
CXXPICFLAG OCTLIBDIR
DL_LDFLAGS OCT_LINK_DEPS
F77 OCT_LINK_OPTS
F77_INTEGER8_FLAG RDYNAMIC_FLAG
FFLAGS SPECIAL_MATH_LIB
FPICFLAG XTRA_CFLAGS
INCFLAGS XTRA_CXXFLAGS
.Ve
.RE
.IP
Octave configuration variables as above, but currently unused by
\%\fBmkoctfile\fP.
.RS
.Vb
AR
DEPEND_EXTRA_SED_PATTERN
DEPEND_FLAGS
FFTW3F_LDFLAGS
FFTW3F_LIBS
FFTW3_LDFLAGS
FFTW3_LIBS
FFTW_LIBS
FLIBS
LIBS
RANLIB
READLINE_LIBS
.Ve
.RE
.IP
Octave configuration variables that are provided for informational purposes
only. Except for \%\fIOCTAVE_HOME\fP and \%\fIOCTAVE_EXEC_HOME\fP, users may
not override these variables.
.IP
If \%\fIOCTAVE_HOME\fP or \%\fIOCTAVE_EXEC_HOME\fP are set in the environment,
then other variables are adjusted accordingly with \%\fIOCTAVE_HOME\fP or
\%\fIOCTAVE_EXEC_HOME\fP substituted for the original value of the directory
specified by the \%\-\-\fIprefix\fP or \%\-\-\fIexec\-prefix\fP options that
were used when Octave was configured.
.RS
.Vb
API_VERSION LOCALARCHLIBDIR
ARCHLIBDIR LOCALFCNFILEDIR
BINDIR LOCALOCTFILEDIR
CANONICAL_HOST_TYPE LOCALSTARTUPFILEDIR
DATADIR LOCALVERARCHLIBDIR
DATAROOTDIR LOCALVERFCNFILEDIR
DEFAULT_PAGER LOCALVEROCTFILEDIR
EXEEXT MAN1DIR
FCNFILEDIR MAN1EXT
IMAGEDIR MANDIR
INCLUDEDIR OCTAVE_EXEC_HOME
INFODIR OCTAVE_HOME
INFOFILE OCTDATADIR
LIBDIR OCTDOCDIR
LIBEXECDIR OCTFILEDIR
LOCALAPIARCHLIBDIR OCTFONTSDIR
LOCALAPIFCNFILEDIR OCTINCLUDEDIR
LOCALAPIOCTFILEDIR OCTLIBDIR
LOCALAPIPKGDIR STARTUPFILEDIR
VERSION
.Ve
.RE
.TP
.B \-\-link\-stand\-alone
Link a stand-alone executable file.
.TP
.B \-\-mex
Create a MEX file. Set the default output extension to "\fB.mex\fP". Link to
\%liboctmex instead of \%liboctinterp and \%liboctave.
.TP
.B \-s\fR,\fB \-\-strip
Strip output file.
.TP
.B \-n\fR,\fB \-\-dry-run\fR,\fB \-\-just-print\fR
Print commands, but do not execute them.
.TP
.B \-v\fR,\fB \-\-verbose
Echo commands as they are executed.
.TP
.B FILE
Compile or link FILE. Recognized file types are:
.RS
.Vb
.c C source
.cc C++ source
.cp C++ source
.cpp C++ source
.CPP C++ source
.cxx C++ source
.c++ C++ source
.C C++ source
.f Fortran source (fixed form)
.F Fortran source (fixed form)
.f90 Fortran source (free form)
.F90 Fortran source (free form)
.o object file
.a library file
.Ve
.RE
.SH AUTHOR
John W. Eaton and many others. The list of contributors to the Octave project
may be shown from within \%\fBoctave\fP by executing
"\fB\%doc \%Acknowledgements\fP". The list is also available online at
.UR https://\:\%docs.octave.org/\:\%latest/\:\%Acknowledgements\:\%.html
.UE .
.SH "SEE ALSO"
.MR octave 1 .