home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / FLEX / FLEX-2.4 / FLEX-2 / flex-2.4.7 / MISC / VMS / VMS.more-stuff / dclmake.com < prev    next >
Encoding:
Text File  |  1990-11-26  |  9.5 KB  |  322 lines

  1. $    v = f$verify (0)
  2. $! IMPORTANT:  Before you use this procedure, read INSTALL.VMS and the
  3. $! comments below.  You will need an alloca object module and GNU bison.
  4. $! Define the logical names flex_exe, flex_library, and flex_manual.
  5. $!
  6. $! For flex version 2.3.6 (11/17/90)
  7. $!
  8. $! You use this procedure to compile, link and test flex by doing:
  9. $!
  10. $!        @ DCLMAKE BUILD
  11. $!
  12. $! To install flex in the public directory, be sure that the logical
  13. $! names "flex_exe", "flex_library", and "flex_manual" are correctly
  14. $! defined and do:
  15. $!
  16. $!        @ DCLMAKE INSTALL_TEST
  17. $!
  18. $! You can also use this procedure to compile individual source files
  19. $! by saying:
  20. $!
  21. $!        @ DCLMAKE COMPILE name
  22. $!
  23. $! where "name" is the source file's name without the file type, e.g.
  24. $! "@DCLMAKE COMPILE CCL".  With no filename, DCLMAKE will compile all
  25. $! the source files.  Link by doing: "@DCLMAKE LINK", test the local
  26. $! flex with "@DCLMAKE TEST", install the public files with "@DCLMAKE
  27. $! INSTALL", and test the installed files with "@DCLMAKE TEST_FLEX".
  28. $!
  29. $! When "test" or "test_flex" is executed you shoud see the message
  30. $! "Test successful".  A make abort after the diff command is a failure.
  31. $! To get some idea of what went wrong, do a diff between lexyy.c (the file
  32. $! just generated by flex) and initscan.c (what it should have generated).
  33. $!
  34. $!
  35. $!
  36. $! The flex parser generated by bison requires an alloca routine which
  37. $! you must supply.  Change the line below if your alloca.obj is some-
  38. $! where other than the current directory.
  39. $ALLOCA = "alloca.obj"
  40. $!ALLOCA = "gnu_bison:[000000]vmshlp.obj"
  41. $
  42. $! Use one of the following two defines.  The first will build flex with
  43. $! a VMS-style command line interface, the second builds flex with a unix-
  44. $! style command line interface.
  45. $!
  46. $! For a VMS-style interface...
  47. $VERSION = "vms"
  48. $! For a unix-style interface...
  49. $!VERSION = ""
  50. $
  51. $
  52. $! BIN, LIB, MAN, CLD, HLP are set to reflect the locations where you
  53. $! would like to store the executables, library (flex.skel), the manual
  54. $! pages, the command definition file, and the help library module. 
  55. $! You can leave these unchanged if you define the VMS logical names:
  56. $!
  57. $!    flex_exe      -- disk/dir of the executable image    
  58. $!    flex_manual   -- disk/dir of the *.man files 
  59. $!    flex_library  -- disk/dir of flex.skel and the .cld file
  60. $!
  61. $! These logical names ***MUST*** be defined before installing or
  62. $! running flex.  They don't have to be defined to build flex.  You
  63. $! may want to define these, either system wide in the system startup
  64. $! procedure, or in your login.com file.  Alternatively, you can change
  65. $! the definitions of BIN, LIB, CLD, MAN and HLP in here to refer to pre-
  66. $! defined locations.  
  67. $!
  68. $! ...the installed location of the flex executable...
  69. $BIN = "flex_exe:"
  70. $
  71. $! ...the installed location of the flex skeleton file...
  72. $LIB = "flex_library:"
  73. $
  74. $! ...the installed location of the flex vms command definition file
  75. $! (only matters when installing the VMS command line version)...
  76. $CLD = "flex_library:"
  77. $
  78. $! ...the installed location of the flex man pages.
  79. $MAN = "flex_manual:"
  80. $
  81. $! ...the help library to put the bison help module into. 
  82. $! (only matters when installing the VMS command line version)...
  83. $HLP = "sys$common:[syshlp]helplib.hlb"
  84. $
  85. $! The default skeleton file that flex will use.
  86. $DEFAULT_SKEL = "''LIB'flex.skel"
  87. $
  88. $! Flags that initscan.c was created with.  The tests will use the same
  89. $! ones so that they should produce an output identical to initscan.c.
  90. $VMS_FLEX_FLAGS = "/NOCASE/NOECHO/EIGHT"
  91. $UNIX_FLEX_FLAGS = "-is8"
  92. $
  93. $! Qualifiers for the link and cc commands.  Values here should be
  94. $! fine.  You may want to modify these to build a debuggable version
  95. $! of the executable.
  96. $LFLAGS = ""
  97. $!LFLAGS = "/debug"
  98. $CFLAGS = ""
  99. $!CFLAGS = "/nolist/debug/noopt"
  100. $
  101. $! CC command line defines that are used for (almost) all compilations.
  102. $! The redefinition of exit will cause any error exits to returns a VMS 
  103. $! error status (SYS-E-ABORT) but one that won't result in a system 
  104. $! message (presumably flex printed an error message first). 
  105. $CDEFS = "VMS,USG,""exit(s)=_exit((s)?0x1000002A:0)"""
  106. $
  107. $! CC command define for the default skeleton file.
  108. $SKELDEF = """DEFAULT_SKELETON_FILE=""""''DEFAULT_SKEL'"""""""
  109. $
  110. $OBJ =     "ccl.obj,dfa.obj,ecs.obj,gen.obj,misc.obj,nfa.obj," + -
  111.        "parse.obj,scan.obj,sym.obj,tblcmp.obj,yylex.obj"
  112. $
  113. $
  114. $    on warning then stop
  115. $    continue = "FALSE"
  116. $    if "''VERSION'" .eqs. "" .and. f$env ("DEPTH") .eq. 1 then -
  117.         write sys$output "***** DCLMAKE for UNIX command line interface ***
  118. **"
  119. $    if "''VERSION'" .nes. "" .and. f$env ("DEPTH") .eq. 1 then -
  120.         write sys$output "***** DCLMAKE for VMS command line interface ****
  121. *"
  122. $    set verify
  123. $    if p1 .eqs. "COMPILE" .and. p2 .nes. "" then goto 'p2'
  124. $    goto 'p1'
  125. $
  126. $done :
  127. $    v = f$verify (v)
  128. $    exit
  129. $
  130. $build : 
  131. $    @'f$env ("procedure")' compile
  132. $    @'f$env ("procedure")' test
  133. $    goto done
  134. $
  135. $install_test :
  136. $    @'f$env ("procedure")' install
  137. $    @'f$env ("procedure")' test_flex
  138. $    goto done
  139. $
  140. $link :
  141. $    goto 'VERSION'_link
  142. $
  143. $test_flex :
  144. $    goto 'VERSION'_test_flex
  145. $
  146. $test :
  147. $    goto 'VERSION'_test
  148. $
  149. $
  150. $install :
  151. $    copy/log flex.skel 'LIB'flex.skel/prot=(g:r,w:r)
  152. $
  153. $    copy/log flex'VERSION'.exe 'BIN'flex'VERSION'.exe/prot=(g:re,w:re)
  154. $
  155. $    if f$search("flex.man") .nes. "" then -
  156.         copy/log flex.man 'MAN'flex.man/prot=(g:r,w:r)
  157. $
  158. $    if f$search("flexdoc.man") .nes. "" then -
  159.         copy/log flex.man 'MAN'flexdoc.man/prot=(g:r,w:r)
  160. $
  161. $if "''VERSION'" .eqs. "" then goto done
  162. $
  163. $    libr/log 'HLP' flex.hlp/replace
  164. $
  165. $    open/write tempfl 'CLD'flex.cld
  166. $    write tempfl "define verb FLEX"
  167. $    write tempfl "    image ''BIN'FLEXVMS.EXE"
  168. $    copy/log flex.cld_template tempfl/prot=(g:r,w:r)
  169. $    close tempfl
  170. $    goto done
  171. $
  172. $! Local cld file is named xflex so that 'CLD' can be defined as the flex
  173. $! directory and the flex.cld file will be updated correctly.
  174. $xflex.cld : flex.cld_template
  175. $    open/write tempfl xflex.cld
  176. $    write tempfl "define verb XFLEX"
  177. $    write tempfl "    image ''f$env ("default")'FLEXVMS.EXE"
  178. $    copy flex.cld_template tempfl
  179. $    close tempfl
  180. $    goto done
  181. $
  182. $compile:
  183. $    continue = "TRUE"
  184. $
  185. $ccl : 
  186. $    cc 'CFLAGS' /define=('CDEFS') ccl.c
  187. $    if .not. continue then goto done
  188. $
  189. $dfa : 
  190. $    cc 'CFLAGS' /define=('CDEFS') dfa.c
  191. $    if .not. continue then goto done
  192. $
  193. $ecs : 
  194. $    cc 'CFLAGS' /define=('CDEFS') ecs.c
  195. $    if .not. continue then goto done
  196. $
  197. $gen : 
  198. $    cc 'CFLAGS' /define=('CDEFS') gen.c
  199. $    if .not. continue then goto done
  200. $
  201. $main : 
  202. $    cc 'CFLAGS' /define=('CDEFS','SKELDEF') main.c
  203. $    if .not. continue then goto done
  204. $
  205. $mainvms : 
  206. $    cc 'CFLAGS' /define=('CDEFS','SKELDEF',VMSCMDLN) main.c /obj=mainvms.ob
  207. j
  208. $    if .not. continue then goto done
  209. $
  210. $misc : 
  211. $    cc 'CFLAGS' /define=('CDEFS') misc.c
  212. $    if .not. continue then goto done
  213. $
  214. $nfa : 
  215. $    cc 'CFLAGS' /define=('CDEFS') nfa.c
  216. $    if .not. continue then goto done
  217. $
  218. $parse : 
  219. $! You may need a "set command dev:[dir]bison here if the bison
  220. $! command is not in the system DCL tables.
  221. $!    set com gnu_bison:[000000]:bison
  222. $    bison/defines/fixed_outfiles parse.y
  223. $    copy y_tab.c parse.c
  224. $    dele/noconf y_tab.c;*
  225. $
  226. $    copy y_tab.h parse.h
  227. $    dele/noconf y_tab.h;*
  228. $
  229. $    cc 'CFLAGS' /define=('CDEFS',"void=int",-
  230.       "bcopy(b1,b2,n)=memcpy(b2,b1,n)") parse.c
  231. $    if .not. continue then goto done
  232. $
  233. $scan : 
  234. $    copy initscan.c scan.c
  235. $    cc 'CFLAGS' /define=('CDEFS') scan.c
  236. $    if .not. continue then goto done
  237. $
  238. $sym : 
  239. $    cc 'CFLAGS' /define=('CDEFS') sym.c
  240. $    if .not. continue then goto done
  241. $
  242. $tblcmp : 
  243. $    cc 'CFLAGS' /define=('CDEFS') tblcmp.c
  244. $    if .not. continue then goto done
  245. $
  246. $yylex : 
  247. $    cc 'CFLAGS' /define=('CDEFS') yylex.c
  248. $    if .not. continue then goto done
  249. $
  250. $cli : 
  251. $    cc 'CFLAGS' cli.c
  252. $    if .not. continue then goto done
  253. $
  254. $_link : 
  255. $    link 'LFLAGS' /exe=flex.exe main.obj, -
  256.         'OBJ', -
  257.         'ALLOCA', sys$input/opt
  258.         SYS$SHARE:VAXCRTL.EXE/SHARE
  259. $    goto done
  260. $
  261. $vms_link :
  262. $    link 'LFLAGS' /exe=flexvms.exe mainvms.obj, cli.obj, -
  263.         'OBJ', -
  264.         'ALLOCA', sys$input/opt
  265.         SYS$SHARE:VAXCRTL.EXE/SHARE
  266. $    goto done
  267. $
  268. $clean_all : 
  269. $    continue = "TRUE"
  270. $clean :
  271. $    ! Cleanup by deleting unnecessary object files etc.
  272. $    if f$search ("scan.c") .nes. "" then dele/log/noconf scan.c;*
  273. $    if f$search ("parse.c") .nes. "" then dele/log/noconf parse.c;*
  274. $    if f$search ("parse.h") .nes. "" then dele/log/noconf parse.h;*
  275. $    if f$search ("lexyy.c") .nes. "" then dele/log/noconf lexyy.c;*
  276. $    if f$search ("*.obj") .nes. "" then dele/log/noconf *.obj;*/exclu=(allo
  277. ca.obj,bcopy.obj)
  278. $    if f$search ("y_tab.*") .nes. "" then dele/log/noconf y_tab.*;*
  279. $    if .not. continue then goto done
  280. $
  281. $    if f$search ("flex.exe") .nes. "" then dele/log/noconf flex.exe;*
  282. $    if f$search ("flexvms.exe") .nes. "" then dele/log/noconf flexvms.exe;*
  283. $    if f$search ("xflex.cld") .nes. "" then dele/log/noconf xflex.cld;*
  284. $    if f$search ("vaxcrtl.opt") .nes. "" then dele/log/noconf vaxcrtl.opt;*
  285. $    purge/log
  286. $    goto done
  287. $
  288. $! The weird name used for the VMS flex commands below is to prevent the
  289. $! DCL command from being shadowed by a DCL symbol named flex.  
  290. $
  291. $vms_test_flex : 
  292. $    set com 'LIB'flex.cld
  293. $    flex_$make$ 'VMS_FLEX_FLAGS' scan.l
  294. $    diff/max=1/out=NL: initscan.c lexyy.c
  295. $    write sys$output "!!!! Test successful !!!!"
  296. $    dele/noconf lexyy.c;*
  297. $    goto done
  298. $
  299. $_test_flex : 
  300. $    flex := $'BIN'flex
  301. $    flex 'UNIX_FLEX_FLAGS' scan.l 
  302. $    diff/max=1/out=NL: initscan.c lexyy.c
  303. $    write sys$output "!!!! Test successful !!!!"
  304. $    dele/noconf lexyy.c;*
  305. $    goto done
  306. $
  307. $vms_test : 
  308. $    set com xflex.cld
  309. $    xflex 'VMS_FLEX_FLAGS' /SKEL=flex.skel scan.l
  310. $    diff/max=1/out=NL: initscan.c lexyy.c
  311. $    write sys$output "!!!! Test successful !!!!"
  312. $    dele/noconf lexyy.c;*
  313. $    goto done
  314. $
  315. $_test : 
  316. $    flex := $sys$disk:[]flex
  317. $    flex 'UNIX_FLEX_FLAGS' "-Sflex.skel" scan.l 
  318. $    diff/max=1/out=NL: initscan.c lexyy.c
  319. $    write sys$output "!!!! Test successful !!!!"
  320. $    dele/noconf lexyy.c;*
  321. $    goto done
  322.