home *** CD-ROM | disk | FTP | other *** search
- @echo off
- rem FMEX.BAT - Batch file for building MEX files with
- rem MicroWay NDP Fortran-386 V4.0
- rem Phar Lap Linker V4.0
- rem
- rem
- rem USAGE: fmex [source_files] [object_files] [libraries]
- rem
- rem Mounil Patel January 28, 1993
- rem Revised: Marc Ullman March 1, 1993
- rem Copyright (C) 1988-1993 The MathWorks, Inc.
- rem All Rights Reserved
-
- if "%1"=="" goto USAGE
-
- rem *****************************************************************
- rem Edit MAT_ROOT to point to the directory that MATLAB is installed
- rem *****************************************************************
- set MAT_ROOT=C:\MATLAB
-
- rem *****************************************************************
- rem Edit NDP to point to the location of your NDP FORTRAN compiler.
- rem Take care to uncomment the section for your version only.
- rem *****************************************************************
- set NDP=C:\NDP
-
- rem *******************************************************************
- rem Edit PL_ROOT below to point to the location of the Phar Lap Linker
- rem *******************************************************************
- set PL_ROOT=C:\PHARLAP
-
- if not exist %NDP%\bin\mf386.exe goto SETUP1
- if not exist %NDP%\tools\ndplink.exe goto SETUP1
- if not exist %PL_ROOT%\BIN\386link.exe goto SETUP2
-
- set TOOLS=%PL_ROOT%
-
- set MEX_DBG=FALSE
- if "%1"=="-DEBUG" set MEX_DBG=TRUE
- if "%1"=="-debug" set MEX_DBG=TRUE
- if "%1"=="-V3.5" set V35_FLAG=
- if "%1"=="-v3.5" set V35_FLAG=
-
- if "%1"=="-DEBUG" set MEX_DBG=TRUE
- if "%1"=="-debug" set MEX_DBG=TRUE
- if "%MEX_DBG%"=="TRUE" shift
-
- rem Create response file
-
- echo -twocase > ndpfmex.rsp
- echo -nomap >> ndpfmex.rsp
- if "%MEX_DBG%"=="TRUE" goto NDPEXE
- %MAT_ROOT%\bin\basename "-relexe %1" >> ndpfmex.rsp
- echo .mex >> ndpfmex.rsp
- set LIBNAME=libmexnd.LIB
- goto NDP_OBJS
-
- :NDPEXE
- echo -symbols >> ndpfmex.rsp
- echo -publics >> ndpfmex.rsp
- %MAT_ROOT%\bin\basename "-exe %1" >> ndpfmex.rsp
- echo .ltl >> ndpfmex.rsp
- echo %NDP%\lib\dos386.obj >> ndpfmex.rsp
- set DBG_OPT=-sym
- set LIBNAME=libdbgnd.lib
-
- :NDP_OBJS
- echo %NDP%\lib\__co387.obj >> ndpfmex.rsp
- echo %NDP%\lib\profdumy.obj >> ndpfmex.rsp
-
- :TOP_OF_LOOP
-
- %MAT_ROOT%\bin\is_ext %1 .f
- if not errorlevel 1 goto COMPILE
-
- %MAT_ROOT%\bin\is_ext %1 .obj
- if not errorlevel 1 goto ADD_OBJ
-
- %MAT_ROOT%\bin\is_ext %1 .lib
- if not errorlevel 1 goto ADD_LIB
-
- :COMPILE
- @echo on
- %NDP%\bin\mf386 %DBG_OPT% -c -n2 %1
- @echo off
- if errorlevel 1 goto EXIT
-
- rem Add this object to our response file
- :ADD_OBJ
- %MAT_ROOT%\bin\basename %1 >> ndpfmex.rsp
- echo .obj >> ndpfmex.rsp
-
- goto END_OF_LOOP
-
- :ADD_LIB
- echo -LIB >> ndpfmex.rsp
- echo %1 >> ndpfmex.rsp
- goto END_OF_LOOP
-
- :END_OF_LOOP
- shift
- if not "%1" == "" goto TOP_OF_LOOP
- goto LINK
-
- :LINK
- echo -lib %MAT_ROOT%\extern\lib\%LIBNAME% >> ndpfmex.rsp
-
- if "%MEX_DBG%"=="TRUE" goto NDP_LINK
-
- :PHAR_LINK
- echo %NDP%\lib\libf3h.lib >> ndpfmex.rsp
- echo %NDP%\lib\libm3h.lib >> ndpfmex.rsp
- echo %NDP%\lib\libc3h.lib >> ndpfmex.rsp
- @echo on
- %PL_ROOT%\BIN\386link @ndpfmex.rsp
- @echo off
- goto LINK_DONE
-
- :NDP_LINK
- echo -lib %NDP%\lib\libf3.lib >> ndpfmex.rsp
- echo -lib %NDP%\lib\libm3.lib >> ndpfmex.rsp
- echo -lib %NDP%\lib\libc3.lib >> ndpfmex.rsp
- @echo on
- %NDP%\tools\ndplink @ndpfmex.rsp
- @echo off
-
- :LINK_DONE
- del ndpfmex.rsp
- goto EXIT
-
- :USAGE
- echo Usage: fmex [filename.f]|[objname.obj]|[libname.lib] ...
- goto EXIT
-
- :SETUP1
- echo You must edit this batch file to set the environment variable NDP
- echo equal to the path where you installed the MicroWay NDP Fortran
- echo compiler before you can use it to create MEX files.
- goto EXIT
-
- :SETUP2
- echo You must edit this batch file to set the environment variable PL_ROOT
- echo equal to the path where you installed the PharLap linker before you
- echo can use it to create MEX files.
- goto EXIT
-
- :ERROR
- echo Can not find %1
- goto EXIT
-
- :EXIT
- set MAT_ROOT=
- set PL_ROOT=
- set MEX_DBG=
- set LIBNAME=
- set DBG_OPT=
-