MBUILD   Compile and link source files against MATLAB generated shared libraries

   Usage:
       mbuild [options ...] file [files ...]

   Description:
       MBUILD compiles and links customer written C or C++ code against 
       MATLAB generated shared libraries. The result is a stand-alone 
       executable.
       
       MBUILD accepts any combinations of source files, object files, and
       library files as arguments.

       The command line options to MBUILD are defined in the "Command Line
       Options" section below.
      
       You can run MBUILD from the MATLAB Command Prompt, Windows Command
       Prompt, or the UNIX shell. MBUILD is a script named mbuild.bat on
       Windows and mbuild on UNIX, and is located in the directory
       specified by [matlabroot '/bin'].
     
       The first file name given (less any file name extension) will be the
       name of the resulting executable. Additional source, object, or
       library files can be given to satisfy external references. You can
       specify either C or C++ source files when building executables.
     
       MBUILD uses an options file to specify variables and values that are
       passed as arguments to the compiler, linker, and other tools. 
       Command line options to MBUILD may supplement or override contents 
       of the options file, or they may control other aspects of MBUILD's 
       behavior. For more information, see the "Options File Details" 
       section below.
             
       The "-setup" and "-setup -client mbuild_com" options cause MBUILD to
       search for installed compilers and allows you to choose an options 
       file as the default for future invocations of MBUILD. For more
       information, see these options below.

       For a list of compilers supported with this release, refer to:
       http://www.mathworks.com/support/compilers/current_release/

   Command Line Options Available on All Platforms:
       -c
           Compile only. Creates an object file but not an executable.
       -D<name>
           Define a symbol name to the C preprocessor. Equivalent to a
           "#define <name>" directive in the source. Do not add a space after
           this switch.
       -D<name>=<value>
           Define a symbol name and value to the C preprocessor. Equivalent
           to a "#define <name> <value>" directive in the source. Do not add a 
           space after this switch.
       -f <optionsfile>
           Specify location and name of options file to use. Overrides
           MBUILD's default options file search mechanism.
       -g
           Create an executable containing additional symbolic information
           for use in debugging. This option disables MBUILD's default
           behavior of optimizing built object code (see the -O option).
       -h[elp]
           Print this message.
       -I<pathname>
           Add <pathname> to the list of directories to search for #include
           files. Do not add a space after this switch.
       -l<name>
           Link with object library. On Windows, <name> expands to
           "<name>.lib" or "lib<name>.lib" and on UNIX, to "lib<name>.so" 
           or "lib<name>.dylib". Do not add a space after this switch.
       -L<directory>
           Add <directory> to the list of directories to search for
           libraries specified with the -l option.  On UNIX systems, you 
           must also set the run-time library path. Do not add a space 
           after this switch.
       -n
           No-execute mode. Print out any commands that MBUILD would
           otherwise have executed, but do not actually execute any of them.
       -O
           Optimize the object code. Optimization is enabled by default and
           by including this option on the command line. If the -g option
           appears without the -O option, optimization is disabled.
       -outdir <dirname>
           Place all output files in directory <dirname>.
       -output <resultname>
           Create an executable named <resultname>. An appropriate executable
           extension is automatically appended. Overrides MBUILD's default
           executable-naming mechanism.
       -setup
           Interactively specify the C/C++ compiler options file to use as 
           the default for future invocations of MBUILD by placing it in 
           the user profile folder (returned by the PREFDIR command). When 
           this option is specified, no other command line input is accepted.
       -setup -client mbuild_com
           Interactively specify the COM compiler options file to use as
           the default for future invocations of mbuild by placing it in
           the user profile folder (returned by the PREFDIR command). When
           this option is specified, no other command line input is accepted.
       -U<name>
           Remove any initial definition of the C preprocessor symbol
           <name>. (Inverse of the -D option.) Do not add a space after this
           switch.
       -v
           Verbose mode. Print the values for important internal variables
           after the options file is processed and all command line
           arguments are considered. Prints each compile step and final link
           step fully evaluated.
       <name>=<value>
           Override an options file variable for variable <name>. 
           This option is processed after the options file is processed 
           and all command line arguments are considered. See the
           "Override Option Details" section below for more details.

   Command Line Options Available Only on Windows Platforms:
       @<rspfile>
           Include contents of the text file <rspfile> as command line
           arguments to MBUILD.

   Options File Details:
       There are template options files for the compilers that are
       supported by MBUILD.  These templates are located at
       [matlabroot '\bin\win64\mexopts'] on Windows, or

       [matlabroot '/bin/glnxa64/mexopts'] on Linux, or

       [matlabroot '/bin/maci64/mexopts'] on MAC.
       
       These template options files are used by the "-setup" and 
       "-setup -client mbuild_com" options to define the selected default 
       options file.

   Override Option Details:
       Use the name=value command-line argument to override a variable 
       specified in the options file at the command line. When using this 
       option, you may need to use the shell's quoting syntax to protect 
       characters such as spaces, which have a meaning in the shell syntax.

       On Windows platforms, at either the MATLAB prompt or the DOS prompt, 
       use double quotes ("):
       mbuild -v COMPFLAGS="$COMPFLAGS -Wall" ...
          LINKFLAGS="$LINKFLAGS /VERBOSE" filename.c

       At the MATLAB command line on UNIX platforms, use double quotes ("): 
       mbuild -v CFLAGS="$CFLAGS -Wall" LDFLAGS="$LDFLAGS -w" filename.c

       At the shell command line on UNIX platforms, use single quotes ('):
       mbuild -v CFLAGS='$CFLAGS -Wall' LDFLAGS='$LDFLAGS -w' filename.c

       For the MinGW-w64 compiler, which is based on gcc/g++, use single 
       quotes (').
   Examples:
        
       To compile and link an external C program foo.c against libfoo, use
          mbuild foo.c -L. -lfoo (on UNIX)
          mbuild foo.c libfoo.lib (on Windows)
   
       This assumes that both foo.c and the library are in the current working folder. 

   See also COMPUTER, MCC, PREFDIR