home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / misc / install.bat < prev    next >
DOS Batch File  |  1999-06-05  |  12KB  |  391 lines

  1. @echo off
  2.  
  3. rem Last modified for SE -0.78
  4.  
  5. rem --------------------- Installation directory ----------------------
  6.  
  7. rem You must set below the directory under which you want to install 
  8. :   SmallEiffel. For example: set SE_DIR=C:\SmallEiffel
  9. :   This variable is only used during the installation process.
  10.  
  11. set SE_DIR=
  12.  
  13. rem ---------------------- C compiler selection: ----------------------
  14.  
  15. set CC=
  16.  
  17. rem Choose one of the compilers below, by uncommenting the appropriate 
  18. rem lines.
  19.  
  20. rem To use gcc (or mingw32), uncomment the next 5 lines :
  21. rem set CC=gcc
  22. rem set CC_OPTIONS=-ansi -O6 -c
  23. rem set OBJ=.o
  24. rem set LD=%CC%
  25. rem set LD_OPTIONS=-ansi -O6
  26. rem set EXE_NAME=-o
  27. rem set LINK_LIB=
  28.  
  29.  
  30. rem To use lcc-win32, uncomment the next lines:
  31. rem set CC=lcc
  32. rem set CC_OPTIONS= -O 
  33. rem set OBJ=.obj
  34. rem set LD=lcclnk
  35. rem set LD_OPTIONS= -s
  36. rem set EXE_NAME=-o 
  37. rem set LINK_LIB=
  38.  
  39. rem To use Watcom C++, uncomment the last 5 lines of this block.
  40. rem The CC_OPTIONS flag corresponds to standard Pentium 
  41. rem optimization. For optimizations more fitted to your 
  42. rem system, read Watcom help
  43. rem set CC=wcl386
  44. rem set CC_OPTIONS=/ox /fp5 -c
  45. rem set OBJ=.obj
  46. rem set LD=%CC%
  47. rem set LD_OPTIONS=/ox /fp5
  48. rem set EXE_NAME=/fe=
  49. rem set LINK_LIB=
  50.  
  51. rem For Microsof Visual C++ (uncomment next 5 lines) :
  52. rem set CC=cl
  53. rem set CC_OPTIONS=-O2 -nologo -D"WIN32" -c
  54. rem set LD=%CC%
  55. rem set LD_OPTIONS=-O2 -nologo -D"WIN32"
  56. rem set OBJ=.obj
  57. rem set EXE_NAME=-o
  58. rem set LINK_LIB=-lm
  59.  
  60. rem If you want to use Borland C++, try using the following options
  61. rem settings. Borland C++ 5.0 has a loop strength reduction bug that
  62. rem means you must either use -O-v or use the Intel back end when
  63. rem compiling some SmallEiffel code. The warnings we disable are for
  64. rem variables and parameters not actually used, and for functions which
  65. rem do not return a value.
  66. rem Under Borland C++, when linking an executable the -e option is used
  67. rem instead of -o; furthermore, there can be no space between the option
  68. rem and the argument.
  69.  
  70. rem Borland with traditional back end (uncomment next 4 lines) :
  71. rem set CC=bcc32
  72. rem set CC_OPTIONS=-5 -w-aus -w-par -w-rvl -O2 -O-v -c
  73. rem set OBJ=.obj
  74. rem set LD=%CC%
  75. rem set LD_OPTIONS=-5 -w-aus -w-par -w-rvl -O2 -O-v 
  76. rem set EXE_NAME=-e
  77. rem set LINK_LIB=-lm
  78.  
  79. rem Borland with Intel Reference Compiler back end (uncomment next 4 lines) :
  80. rem set CC=bcc32i
  81. rem set CC_OPTIONS=-5 -w-aus -w-par -w-rvl -O2 -c
  82. rem set OBJ=.obj
  83. rem set LD=%CC%
  84. rem set LD_OPTIONS=-5 -w-aus -w-par -w-rvl -O2 
  85. rem set EXE_NAME=-e
  86. rem set LINK_LIB=-lm
  87.  
  88. rem ------------ Nothing to change after this line ------------------
  89.  
  90. cls
  91. echo INSTALL SmallEiffel script for Windows NT/95
  92. echo.
  93.  
  94. rem Under Windows 95 we cannot test for existence of directories in batch
  95. rem files and standard utilities support different switches than NT. As a
  96. rem result we follow a different sequence of operations for Win95 than NT.
  97. rem Under Win95 we can use "deltree" instead of "del /f/q" to erase read-
  98. rem only files, but there is no equivalent to "cd /d" and we need to take
  99. rem steps to see if using it will work.
  100.  
  101. rem Compiling the split versions of compile_to_c should be easily done with
  102. rem a FOR statement which matches compile_to_c?.c and compile_to_c??.c as
  103. rem patterns. However, the Windows 95 command interpreter has a defect where
  104. rem filename patterns in FOR statements are matched only against the short-
  105. rem format 8.3 filenames, making it useless for this purpose. Even worse,
  106. rem the 8.3 filenames are all upper-case, which causes gratuitous changes
  107. rem of the case of results. Instead, we have to manually generate the 
  108. rem indexes.
  109.  
  110. rem Note also that under Win95, the command processor only treats the first
  111. rem 8 characters of any label as significant in a batch file.
  112.  
  113. if "%SmallEiffel%~"=="~" goto help_smalleiffel
  114. if "%SE_DIR%~"=="~" goto help_se_dir
  115. if "%CC%~"=="~" goto help_cc
  116.  
  117. set CLEAN=del /f /q
  118. if exist . goto winnt_clean
  119. set CLEAN=deltree /y
  120. :winnt_clean
  121.  
  122.  
  123. if not exist . goto win95_install
  124.  
  125. echo System appears to be NT rather than Windows 95
  126.  
  127. if not exist %SE_DIR% goto help_exist
  128. cd /d %SE_DIR%
  129. if errorlevel 1 goto help_cd
  130. if not exist bin mkdir bin
  131. if not exist bin goto help_mkdir_bin
  132.  
  133. cd bin
  134. echo "dummy" > dummy
  135. del /f /s /q .
  136. cd ..
  137.  
  138. goto install_common
  139.  
  140. rem ----------------------------- Windows 95 section
  141. :win95_install
  142.  
  143. if not exist %SE_DIR%\READ_ME goto help_exist
  144.  
  145. rem What we do now is try and change to the smalleiffel directory, and then
  146. rem we try and test for the presences of various files (/not/ directories)
  147. rem from our distribution to see that we actually got where we needed. If
  148. rem not, appeal to the user. Thanks to the test above we expect that the
  149. rem SmallEiffel environment variable is set properly.
  150.  
  151.  
  152. cd %SE_DIR%
  153. if not exist bin_c\compile.c goto help_drive
  154.  
  155. echo System appears to be Windows 95 rather than NT
  156.  
  157. deltree /y bin >nul:
  158. mkdir bin
  159.  
  160. rem ------------------------------- Common section
  161.  
  162. :install_common
  163.  
  164. cd sys
  165. %CLEAN% system.se >nul:
  166. if exist system.se goto help_del_system
  167.  
  168. rem Note that there is no space before the ">" symbol, which is quite
  169. rem important since otherwise "echo" will write the preceding space to
  170. rem the file and confuse the code which reads the generated files.
  171. echo Windows>system.se
  172.  
  173. if exist gc.BAK goto after_gc_bak
  174. copy gc gc.BAK
  175. :after_gc_bak
  176. echo windows.c > gc
  177.  
  178. rem Updating loadpath.Windows :
  179. %CLEAN% loadpath.Windows >nul:
  180. echo .\> loadpath.Windows
  181. echo %SE_DIR%\lib_std\>> loadpath.Windows
  182. echo %SE_DIR%\lib_rand\>> loadpath.Windows
  183. echo %SE_DIR%\lib_show\>> loadpath.Windows
  184. echo %SE_DIR%\lib_se\>> loadpath.Windows
  185. rem ----- compiler.se setting -----
  186.  
  187. if not exist compiler.se goto set_c_compiler
  188. %CLEAN% compiler.OLD >:nul
  189. copy compiler.se compiler.OLD >:nul
  190. %CLEAN% compiler.se >nul:
  191. :set_c_compiler
  192. if "%CC%"=="lcc" goto set_lcc_win32
  193. echo %CC% > compiler.se
  194. goto c_compiler_set
  195. :set_lcc_win32
  196. echo lcc-win32 > compiler.se
  197. :c_compiler_set
  198.  
  199. rem ------ C compilations --------
  200.  
  201. cd ..\bin_c
  202. echo C compiling clean ...
  203. %CLEAN% clean.exe >nul:
  204. %CC% %CC_OPTIONS% clean.c
  205. echo Linking clean ...
  206. %LD% %EXE_NAME%clean.exe %LD_OPTIONS% clean%OBJ%
  207. if not exist clean.exe goto clean_help_cc
  208.  
  209. echo C compiling finder ...
  210. %CLEAN% finder.exe >nul:
  211. %CC% %CC_OPTIONS% finder.c
  212. echo Linking finder ...
  213. %LD% %EXE_NAME%finder.exe %LD_OPTIONS% finder%OBJ%
  214. if not exist finder.exe goto finder_help_cc
  215.  
  216. echo C compiling compile ...
  217. %CLEAN% compile.exe >nul:
  218. %CC% %CC_OPTIONS% compile.c
  219. echo Linking compile ...
  220. %LD% %EXE_NAME%compile.exe %LD_OPTIONS% compile%OBJ%
  221. if not exist compile.exe goto compile_help_cc
  222.  
  223. echo C compiling print_jvm_class ...
  224. %CLEAN% print_jvm_class.exe >nul:
  225. %CC% %CC_OPTIONS% print_jvm_class.c
  226. echo Linking print_jvm_class ...
  227. %LD% %EXE_NAME%print_jvm_class.exe %LD_OPTIONS% print_jvm_class%OBJ%
  228. if not exist print_jvm_class.exe goto print_jvm_class_help_cc
  229.  
  230.  
  231. echo C compiling compile_to_c ...
  232. %CLEAN% compile_to_c.exe >nul:
  233. for %%i in (1 2 3 4 5 6 7 8 9 10)          do %CC% %CC_OPTIONS% compile_to_c%%i.c
  234. for %%i in (11 12 13 14 15 16 17 18 19 20) do %CC% %CC_OPTIONS% compile_to_c%%i.c
  235. for %%i in (21 22 23 24 25 26 27 28 29 30) do %CC% %CC_OPTIONS% compile_to_c%%i.c
  236. for %%i in (31 32 33 34 35 36 37 38 39 40) do %CC% %CC_OPTIONS% compile_to_c%%i.c
  237. for %%i in (41 42 43 44 45 46 47 48 49 50) do %CC% %CC_OPTIONS% compile_to_c%%i.c
  238. for %%i in (51 52 53 54 55 56 57)          do %CC% %CC_OPTIONS% compile_to_c%%i.c
  239.  
  240. echo Linking compile_to_c ...
  241. %LD% %EXE_NAME%compile_to_c.exe %LD_OPTIONS% compile_to_c*%OBJ% %LINK_LIB%
  242. if not exist compile_to_c.exe goto compile_to_c_help_cc
  243. %CLEAN% *%OBJ% >nul:
  244.  
  245. echo C compiling compile_to_jvm...
  246. %CLEAN% compile_to_jvm.exe >nul:
  247. for %%i in (1 2 3 4 5 6 7 8 9 10)          do %CC% %CC_OPTIONS% compile_to_jvm%%i.c
  248. for %%i in (11 12 13 14 15 16 17 18 19 20) do %CC% %CC_OPTIONS% compile_to_jvm%%i.c
  249. for %%i in (21 22 23 24 25 26 27 28 29 30) do %CC% %CC_OPTIONS% compile_to_jvm%%i.c
  250. for %%i in (31 32 33 34 35 36 37 38 39 40) do %CC% %CC_OPTIONS% compile_to_jvm%%i.c
  251. for %%i in (41 42 43 44 45 46 47 48 49 50 51) do %CC% %CC_OPTIONS% compile_to_jvm%%i.c
  252.  
  253. echo Linking compile_to_jvm ...
  254. %LD% %EXE_NAME%compile_to_jvm.exe %LD_OPTIONS% compile_to_jvm*%OBJ% %LINK_LIB%
  255. if not exist compile_to_jvm.exe goto compile_to_jvm_help_cc
  256. %CLEAN% *%OBJ% >nul: 
  257.  
  258. echo C compiling pretty...
  259. %CLEAN% pretty.exe >nul:
  260. for %%i in (1 2 3 4 5 6 7 8 9 10)          do %CC% %CC_OPTIONS% pretty%%i.c
  261. for %%i in (11 12 13 14 15 16 17 18 19 20) do %CC% %CC_OPTIONS% pretty%%i.c
  262. for %%i in (21 22 23 24 25 26 27 28 29 30) do %CC% %CC_OPTIONS% pretty%%i.c
  263. for %%i in (31 32 33 34 35 36 37 38)       do %CC% %CC_OPTIONS% pretty%%i.c
  264.  
  265. echo Linking pretty ...
  266. %LD% %EXE_NAME%pretty.exe %LD_OPTIONS% pretty*%OBJ% %LINK_LIB%
  267. if not exist pretty.exe goto pretty_help_cc
  268. %CLEAN% *%OBJ% >nul:
  269.  
  270. echo C compiling short...
  271. %CLEAN% short.exe >nul:
  272. for %%i in (1 2 3 4 5 6 7 8 9 10)          do %CC% %CC_OPTIONS% short%%i.c
  273. for %%i in (11 12 13 14 15 16 17 18 19 20) do %CC% %CC_OPTIONS% short%%i.c
  274. for %%i in (21 22 23 24 25 26 27 28 29 30) do %CC% %CC_OPTIONS% short%%i.c
  275. for %%i in (31 32 33 34 35 36 37)          do %CC% %CC_OPTIONS% short%%i.c
  276.  
  277. echo Linking short ...
  278. %LD% %EXE_NAME%short.exe %LD_OPTIONS% short*%OBJ% %LINK_LIB%
  279. if not exist short.exe goto short_help_cc
  280. %CLEAN% *%OBJ% >nul:
  281.  
  282. %CLEAN% %SE_DIR%\bin\*.exe >nul:
  283. %CLEAN% %SE_DIR%\bin_c\*%OBJ% >nul:
  284. move %SE_DIR%\bin_c\*.exe %SE_DIR%\bin >nul:
  285.  
  286. rem We don't rename the help files, since .hlp works
  287. cd %SE_DIR%
  288.  
  289. goto end_success
  290.  
  291.  
  292. rem ------------------------ help section -----------------------
  293.  
  294.  
  295.  
  296. :help_se_dir
  297. echo You must edit "install.bat" to set variable "SE_DIR" to 
  298. echo the directory in which you want to install SmallEiffel.
  299. goto end_failure
  300.  
  301. :help_smalleiffel
  302. echo You must set environment variable "SmallEiffel" to point
  303. echo to your "system.se" file. For example, this usually is
  304. echo c:\SmallEiffel\sys\system.se
  305. goto end_failure
  306.  
  307. :help_cc
  308. echo You must edit "install.bat" to select one of the compilers,
  309. echo which will set correctly the "CC" variable and a few other.
  310. goto end_failure 
  311.  
  312. :help_exist
  313. echo Directory "%se_dir%" does not exist.
  314. goto help_se_dir
  315. goto end_failure
  316.  
  317. :help_cd
  318. echo Cannot go to (cd) directory "%SE_DIR%".
  319. goto help_se_dir
  320. goto end_failure
  321.  
  322. :help_mkdir_bin
  323. echo Cannot create directory "%SE_DIR%\bin".
  324. goto end_failure
  325.  
  326. :help_del_system
  327. echo Cannot remove file "%SE_DIR%\sys\system.se".
  328. goto end_failure
  329.  
  330. :clean_help_cc
  331. echo Unable to C compile clean.c to clean.exe.
  332. goto end_cc_error
  333.  
  334. :pretty_help_cc
  335. echo Unable to C compile pretty.c to pretty.exe.
  336. goto end_cc_error
  337.  
  338. :short_help_cc
  339. echo Unable to C compile short.c to short.exe.
  340. goto end_cc_error
  341.  
  342. :finder_help_cc
  343. echo Unable to C compile finder.c to finder.exe.
  344. goto end_cc_error
  345.  
  346. :compile_help_cc
  347. echo Unable to C compile compile.c to compile.exe.
  348. goto end_cc_error
  349.  
  350. :print_jvm_class_help_cc
  351. echo Unable to C compile print_jvm_class.c to print_jvm_class.exe.
  352. goto end_cc_error
  353.  
  354. :compile_to_c_help_cc
  355. echo Unable to C compile compile_to_cXX.c to compile.exe.
  356. goto end_cc_error
  357.  
  358. :compile_to_jvm_help_cc
  359. echo Unable to C compile compile_to_jvmXX.c to compile.exe.
  360. goto end_cc_error
  361.  
  362. :compile_help_cc
  363. echo Unable to C compile prettyXX.c to compile.exe.
  364. goto end_cc_error
  365.  
  366. :help_drive
  367. echo Unable to change to the SmallEiffel directory, possibly
  368. echo because it is on a different drive. Please make the current
  369. echo drive the one for "%SE_DIR%".
  370. goto end_failure
  371.  
  372.  
  373. rem ------------------------------------------------------------
  374.  
  375. :end_cc_error
  376. echo C compiler: %CC%  Options: %CC_OPTIONS%
  377. echo C linker:   %LD%  Options: %LD_OPTIONS%
  378. goto end_failure
  379.  
  380. :end_success
  381. echo SmallEiffel Install succeeded.
  382. echo Don't forget to add "%SE_DIR%\bin" to your PATH environment variable.
  383. goto end
  384.  
  385. :end_failure
  386. echo SmallEiffel Install failed.
  387. goto end
  388.  
  389. :end
  390. pause
  391.