---
name: "mkoctfile"
section: "1"
platform: "linux"
package: "octave"
version: "11.3.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/mkoctfile"
---

# mkoctfile(1)

Compile dynamic-load modules for GNU Octave

## NAME

mkoctfile - Compile dynamic-load modules for GNU Octave

## SYNOPSIS

**mkoctfile** \[*option*\]... FILE...

## DESCRIPTION

**mkoctfile** is used to compile C, C++, or Fortran source code in to a dynamically loadable **.oct** file for [*octave*(1)](/octave/1.md).

## OPTIONS

- **-h**, **--help**

  Print help message.

- **-I*dir***

  Add include directory *dir* to compile command.

- **-idirafter *dir***

  Add include directory to second include search path for compilation after '**-I**'.

- **-D*def***

  Add definition *def* to compile command.

- **-l*lib***

  Add library *lib* to link command.

- **-L*dir***

  Add library directory *dir* to link command.

- **-M, --depend**

  Generate dependency files (**.d**) for C and C++ source files.

- **-pthread**

  Add **-pthread** to link command.

- **-R*dir***

  Pass **-R***dir* to link command.

- **-Wl,*option***

  Pass option to the linker such as **-Wl,-rpath=...**

- **-W...**

  Pass flags to the compiler such as **-Wa,***option*.

- **-c, --compile**

  Compile, but do not link.

- **-o *file*, --output *file***

  Output filename.  Default extension is "**.oct**" (or "**.mex**" if **--mex** is specified) unless linking a stand-alone executable.

- **-g**

  Enable debugging option for all compilers.

- **-p *VAR*, --print *VAR***

  Print configuration variable *VAR*.  There are three categories of variables:

-

  Octave configuration variables that users may override with environment variables.  These are used in commands that **mkoctfile** executes.

  ```
      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
  ```

-

  Octave configuration variables as above, but currently unused by **mkoctfile**.

  ```
      AR
      DEPEND_EXTRA_SED_PATTERN
      DEPEND_FLAGS
      FFTW3F_LDFLAGS
      FFTW3F_LIBS
      FFTW3_LDFLAGS
      FFTW3_LIBS
      FFTW_LIBS
      FLIBS
      LIBS
      RANLIB
      READLINE_LIBS
  ```

-

  Octave configuration variables that are provided for informational purposes only.  Except for *OCTAVE\_HOME* and *OCTAVE\_EXEC\_HOME*, users may not override these variables.

-

  If *OCTAVE\_HOME* or *OCTAVE\_EXEC\_HOME* are set in the environment, then other variables are adjusted accordingly with *OCTAVE\_HOME* or *OCTAVE\_EXEC\_HOME* substituted for the original value of the directory specified by the --*prefix* or --*exec-prefix* options that were used when Octave was configured.

  ```
      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
  ```

- **--link-stand-alone**

  Link a stand-alone executable file.

- **--mex**

  Create a MEX file.  Set the default output extension to "**.mex**".  Link to liboctmex instead of liboctinterp and liboctave.

- **-s, --strip**

  Strip output file.

- **-n, --dry-run, --just-print**

  Print commands, but do not execute them.

- **-v, --verbose**

  Echo commands as they are executed.

- **FILE**

  Compile or link FILE.  Recognized file types are:

  ```
     .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
  ```

## AUTHOR

John W. Eaton and many others.  The list of contributors to the Octave project may be shown from within **octave** by executing "**doc Acknowledgements**".  The list is also available online at ⟨https://\\:\\%docs.octave.org/\\:\\%latest/\\:\\%Acknowledgements\\:\\%.html⟩.

## SEE ALSO

[*octave*(1)](/octave/1.md).
