home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 1.ddi / MATBIN.DI$ / FMEX.BAT < prev    next >
Encoding:
DOS Batch File  |  1993-03-01  |  4.5 KB  |  157 lines

  1. @echo off
  2. rem     FMEX.BAT - Batch file for building MEX files with
  3. rem                    MicroWay NDP Fortran-386 V4.0
  4. rem                    Phar Lap Linker V4.0
  5. rem
  6. rem
  7. rem     USAGE:  fmex [source_files] [object_files] [libraries]
  8. rem
  9. rem     Mounil Patel  January 28, 1993
  10. rem     Revised: Marc Ullman  March 1, 1993
  11. rem     Copyright (C) 1988-1993  The MathWorks, Inc.
  12. rem     All Rights Reserved
  13.  
  14. if "%1"=="" goto USAGE
  15.  
  16. rem *****************************************************************
  17. rem Edit MAT_ROOT to point to the directory that MATLAB is installed
  18. rem *****************************************************************
  19. set MAT_ROOT=C:\MATLAB
  20.  
  21. rem *****************************************************************
  22. rem Edit NDP to point to the location of your NDP FORTRAN compiler.
  23. rem Take care to uncomment the section for your version only.
  24. rem *****************************************************************
  25. set NDP=C:\NDP
  26.  
  27. rem *******************************************************************
  28. rem Edit PL_ROOT below to point to the location of the Phar Lap Linker
  29. rem *******************************************************************
  30. set PL_ROOT=C:\PHARLAP
  31.  
  32. if not exist %NDP%\bin\mf386.exe goto SETUP1               
  33. if not exist %NDP%\tools\ndplink.exe goto SETUP1
  34. if not exist %PL_ROOT%\BIN\386link.exe goto SETUP2
  35.  
  36. set TOOLS=%PL_ROOT%
  37.  
  38. set MEX_DBG=FALSE
  39. if "%1"=="-DEBUG" set MEX_DBG=TRUE
  40. if "%1"=="-debug" set MEX_DBG=TRUE
  41. if "%1"=="-V3.5" set V35_FLAG=
  42. if "%1"=="-v3.5" set V35_FLAG=
  43.  
  44. if "%1"=="-DEBUG" set MEX_DBG=TRUE
  45. if "%1"=="-debug" set MEX_DBG=TRUE
  46. if "%MEX_DBG%"=="TRUE" shift
  47.  
  48. rem Create response file
  49.  
  50. echo -twocase                                    > ndpfmex.rsp
  51. echo -nomap                                     >> ndpfmex.rsp
  52. if "%MEX_DBG%"=="TRUE" goto NDPEXE                 
  53. %MAT_ROOT%\bin\basename "-relexe %1"            >> ndpfmex.rsp
  54. echo .mex                                       >> ndpfmex.rsp
  55. set LIBNAME=libmexnd.LIB
  56. goto NDP_OBJS
  57.  
  58. :NDPEXE
  59. echo -symbols                                   >> ndpfmex.rsp
  60. echo -publics                                   >> ndpfmex.rsp
  61. %MAT_ROOT%\bin\basename "-exe %1"               >> ndpfmex.rsp
  62. echo .ltl                                       >> ndpfmex.rsp
  63. echo %NDP%\lib\dos386.obj                       >> ndpfmex.rsp
  64. set DBG_OPT=-sym
  65. set LIBNAME=libdbgnd.lib
  66.  
  67. :NDP_OBJS
  68. echo %NDP%\lib\__co387.obj                      >> ndpfmex.rsp
  69. echo %NDP%\lib\profdumy.obj                     >> ndpfmex.rsp
  70.  
  71. :TOP_OF_LOOP
  72.  
  73. %MAT_ROOT%\bin\is_ext %1 .f
  74. if not errorlevel 1 goto COMPILE
  75.  
  76. %MAT_ROOT%\bin\is_ext %1 .obj
  77. if not errorlevel 1 goto ADD_OBJ
  78.  
  79. %MAT_ROOT%\bin\is_ext %1 .lib
  80. if not errorlevel 1 goto ADD_LIB
  81.  
  82. :COMPILE
  83. @echo on
  84. %NDP%\bin\mf386 %DBG_OPT% -c -n2 %1
  85. @echo off
  86. if errorlevel 1 goto EXIT
  87.  
  88. rem Add this object to our response file
  89. :ADD_OBJ
  90. %MAT_ROOT%\bin\basename %1      >> ndpfmex.rsp
  91. echo .obj                       >> ndpfmex.rsp                      
  92.  
  93. goto END_OF_LOOP
  94.  
  95. :ADD_LIB
  96. echo -LIB       >> ndpfmex.rsp
  97. echo %1         >> ndpfmex.rsp
  98. goto END_OF_LOOP
  99.  
  100. :END_OF_LOOP
  101. shift
  102. if not "%1" == "" goto TOP_OF_LOOP
  103. goto LINK
  104.  
  105. :LINK
  106. echo -lib %MAT_ROOT%\extern\lib\%LIBNAME%       >> ndpfmex.rsp
  107.  
  108. if "%MEX_DBG%"=="TRUE" goto NDP_LINK
  109.  
  110. :PHAR_LINK
  111. echo %NDP%\lib\libf3h.lib                       >> ndpfmex.rsp
  112. echo %NDP%\lib\libm3h.lib                       >> ndpfmex.rsp
  113. echo %NDP%\lib\libc3h.lib                       >> ndpfmex.rsp
  114. @echo on
  115. %PL_ROOT%\BIN\386link @ndpfmex.rsp
  116. @echo off
  117. goto LINK_DONE
  118.  
  119. :NDP_LINK
  120. echo -lib %NDP%\lib\libf3.lib                   >> ndpfmex.rsp
  121. echo -lib %NDP%\lib\libm3.lib                   >> ndpfmex.rsp
  122. echo -lib %NDP%\lib\libc3.lib                   >> ndpfmex.rsp
  123. @echo on
  124. %NDP%\tools\ndplink @ndpfmex.rsp
  125. @echo off
  126.  
  127. :LINK_DONE
  128. del ndpfmex.rsp
  129. goto EXIT
  130.  
  131. :USAGE
  132. echo    Usage: fmex [filename.f]|[objname.obj]|[libname.lib] ...
  133. goto EXIT
  134.  
  135. :SETUP1
  136. echo    You must edit this batch file to set the environment variable NDP
  137. echo    equal to the path where you installed the MicroWay NDP Fortran 
  138. echo    compiler before you can use it to create MEX files.
  139. goto EXIT
  140.  
  141. :SETUP2
  142. echo    You must edit this batch file to set the environment variable PL_ROOT
  143. echo    equal to the path where you installed the PharLap linker before you
  144. echo    can use it to create MEX files.
  145. goto EXIT
  146.  
  147. :ERROR
  148. echo    Can not find %1
  149. goto EXIT
  150.  
  151. :EXIT
  152. set MAT_ROOT=
  153. set PL_ROOT=
  154. set MEX_DBG=
  155. set LIBNAME=
  156. set DBG_OPT=
  157.