home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 19.ddi / SOURCE / STARTUP / CSTARTUP.BA_ / CSTARTUP.BA
Encoding:
Text File  |  1993-02-08  |  3.8 KB  |  201 lines

  1. echo off
  2. echo.
  3. echo C Startup Build (C 8.00)
  4. echo.
  5. REM
  6. REM Copyright (c) 1986-1992, Microsoft Corporation.  All rights reserved.
  7. REM
  8.  
  9. if not %1.==?. goto args
  10.  
  11.  
  12. REM
  13. REM --- Help message
  14. REM
  15.  
  16. :help
  17. echo    Usage:    cstartup [?] [os] [models]
  18. echo.
  19. echo        [?] displays this help message.
  20. echo.
  21. echo        [os] is an optional list of one or more OS designators
  22. echo        seperated by spaces (DOS, WIN); default is all.
  23. echo.
  24. echo        [model] is an optional list of memory model designators
  25. echo        seperated by spaces (S, M, C, L); default is all.
  26. echo.
  27. echo    Examples:
  28. echo.
  29. echo        cstartup dos    /* Build all DOS startup files */
  30. echo.
  31. echo        cstartup s l    /* Build small and large files, all systems */
  32. echo.
  33. echo        cstartup    /* Build all startup files */
  34. echo.
  35. echo    Refer to the startup readme.txt file for more information.
  36. echo.
  37. goto end
  38.  
  39.  
  40. REM
  41. REM --- Error messages
  42. REM
  43.  
  44. :err_arg
  45. echo *** ERROR: Invalid argument.
  46. goto err_end
  47.  
  48. :err_dos
  49. echo *** ERROR: Makefile for DOS not available.
  50. goto err_end
  51.  
  52.  
  53. :err_win
  54. echo *** ERROR: Makefile for WIN not available.
  55. goto err_end
  56.  
  57. :err_nomem
  58. echo *** ERROR: No memory model designation.
  59. goto err_end
  60.  
  61. :err_build
  62. ECHO *** ERROR: Startup build failed.
  63. goto err_end
  64.  
  65. :err_end
  66. echo           (Enter "cstartup ?" for more help.)
  67. goto end
  68.  
  69.  
  70. REM
  71. REM --- Validate args and set up for build
  72. REM
  73. REM Set up environment arguments in the following form:
  74. REM
  75. REM    OSTARGET_DOS = Build DOS
  76. REM    OSTARGET_WIN = Build WIN
  77. REM
  78. REM    MEMTARGET_S  = Build Small model
  79. REM    MEMTARGET_M  = Build Medium model
  80. REM    MEMTARGET_C  = Build Compact model
  81. REM    MEMTARGET_L  = Build Large model
  82. REM
  83. REM If an environment variable is not defined, the corresponding OS or
  84. REM model should not be built.
  85. REM
  86.  
  87. :args
  88.  
  89. :os_args
  90. :os_nextarg
  91. if %1.==DOS. goto os_dosarg
  92. if %1.==dos. goto os_dosarg
  93. if %1.==WIN. goto os_winarg
  94. if %1.==win. goto os_winarg
  95. goto os_argchk
  96.  
  97. :os_dosarg
  98. set OSTARGET_DOS=DOS
  99. goto os_shift
  100.  
  101.  
  102. :os_winarg
  103. set OSTARGET_WIN=WIN
  104. REM goto os_shift
  105.  
  106. :os_shift
  107. shift
  108. if not %1.==. goto os_nextarg
  109.  
  110. :os_argchk
  111. if %OSTARGET_DOS%.==DOS. goto os_argdone
  112. if %OSTARGET_WIN%.==WIN. goto os_argdone
  113. set OSTARGET_DOS=DOS
  114. set OSTARGET_WIN=WIN
  115.  
  116. :os_argdone
  117. if %OSTARGET_DOS%.==DOS. if not exist makefile.dos goto err_dos
  118. if %OSTARGET_WIN%.==WIN. if not exist makefile.win goto err_win
  119.  
  120. :mem_args
  121. if %1.==. goto mem_argchk
  122.  
  123. :mem_nextarg
  124. if %1.==S. goto mem_sarg
  125. if %1.==s. goto mem_sarg
  126. if %1.==M. goto mem_marg
  127. if %1.==m. goto mem_marg
  128. if %1.==C. goto mem_carg
  129. if %1.==c. goto mem_carg
  130. if %1.==L. goto mem_larg
  131. if %1.==l. goto mem_larg
  132. goto err_arg
  133.  
  134. :mem_sarg
  135. set MEMTARGET_S=S
  136. goto mem_shift
  137.  
  138. :mem_marg
  139. set MEMTARGET_M=M
  140. goto mem_shift
  141.  
  142. :mem_carg
  143. set MEMTARGET_C=C
  144. goto mem_shift
  145.  
  146. :mem_larg
  147. set MEMTARGET_L=L
  148. REM goto mem_shift
  149.  
  150. :mem_shift
  151. shift
  152. if not %1.==. goto mem_nextarg
  153.  
  154. :mem_argchk
  155. if not %MEMTARGET_S%.==. goto argdone
  156. if not %MEMTARGET_M%.==. goto argdone
  157. if not %MEMTARGET_C%.==. goto argdone
  158. if not %MEMTARGET_L%.==. goto argdone
  159. set MEMTARGET_S=S
  160. set MEMTARGET_M=M
  161. set MEMTARGET_C=C
  162. set MEMTARGET_L=L
  163.  
  164. :argdone
  165.  
  166.  
  167. REM
  168. REM -- Build all the appropriate files
  169. REM
  170.  
  171. set CSTARTUPERR=
  172. echo --- Directory creation errors may occur - Ignore these ---
  173.  
  174. :dos
  175. if not %OSTARGET_DOS%.==DOS. goto end_dos
  176. for %%i in (%MEMTARGET_S% %MEMTARGET_M% %MEMTARGET_C% %MEMTARGET_L%) do call csub DOS %%i
  177. :end_dos
  178.  
  179.  
  180. :win
  181. if not %OSTARGET_WIN%.==WIN. goto end_win
  182. for %%i in (%MEMTARGET_S% %MEMTARGET_M% %MEMTARGET_C% %MEMTARGET_L%) do call csub WIN %%i
  183. :end_win
  184.  
  185. :build_done
  186. if not %CSTARTUPERR%.==. goto err_build
  187. echo Done.
  188.  
  189. REM
  190. REM -- Clean up
  191. REM
  192.  
  193. :end
  194. set OSTARGET_DOS=
  195. set OSTARGET_WIN=
  196. set MEMTARGET_S=
  197. set MEMTARGET_M=
  198. set MEMTARGET_C=
  199. set MEMTARGET_L=
  200. set CSTARTUPERR=
  201.