home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / disks / disk407.lzh / Flex / misc.lzh / misc / MSDOS.notes < prev    next >
Text File  |  1990-03-20  |  5KB  |  178 lines

  1. $Header:$
  2.  
  3. Notes on Porting flex to MS-DOS
  4. -------------------------------
  5.  
  6. [These notes were last revised 30Dec89 for flex release 2.2.]
  7.  
  8. Previous releases of flex have been successfully built using Microsoft C and
  9. the following options: /AL, /stack:10000, -LARGE, -Ml, -Mt128, -DSYS_V
  10.  
  11. Other folks report that the following work for MSC 5.1 under DOS and OS/2:
  12.  
  13.     CFLAGS=-ALu -F 8000 -Gt16000 -Ox -DMS_DOS -DSYS_V -D__RUNTIME_YYMAXDEPTH
  14.     LINKFLAGS=/E /FAR /PAC /NOI
  15.  
  16. Where you may want to adjust -F up in order to increase available stack
  17. size (though it may not be necessary) and you may want to increase -Gt
  18. to some number that puts just enought of the big data items in their own
  19. data segments.  (The default for -Gt is items of 32k.  This is too high for
  20. flex.)  __RUNTIME_YYMAXDEPTH is useful if you have a parse.c that's
  21. been generated by a yacc that understands how to do this; otherwise, it's a
  22. no-op.
  23.  
  24. Jeffrey R. Jones (jjones@angate.att.com) writes [this has been edited -vp]:
  25.  
  26. .... The port was accomplished with:
  27.  
  28.         AT&T 6312 WGS (12 Mhz AT class machine)
  29.         Microsoft C compiler Version 5.0
  30.         'make' utility from Aztec-C package (subset of unix-make)
  31.  
  32. The re-done makefile is included ....  Do what you wish with it.
  33.  
  34.  
  35. [note that this Makefile is now slightly out of date and has not been
  36.  tested with flex 2.2]
  37.  
  38. # This makefile is used to port the flex 2.1 build to a PC.  The compiler is
  39. # Microsoft-C Version 5.0 while the 'make' utility came with Aztec-C, which
  40. # is VERY compatible with Unix's make.  There are a few things that Aztec-C's
  41. # 'make' can't do that unix does so I have made a few minor changes.
  42. # At the least you can manually compile each file and then link.
  43. # The linker and library utilities are alos Microsoft's.
  44. #
  45. # Additionally, after building with the large model, the flex.map reveals that
  46. # code-size is less than 64K, therefore, in favor of a little more execution
  47. # efficiency, I built with the compact model.  I've used the default compiler
  48. # optimization (no /O switches).
  49. #
  50. # The linker must be told to increase the run-time stack space.  The default
  51. # stack space is 2048.  Flexing scan.l with the default stack-space results in
  52. # a run-time stack overflow, hence the stack was increase to 4096.
  53. #
  54. # NOTE: I have MKS-Toolkit's yacc and was able to use it with virtually no
  55. # modifications to anything.  If you don't have yacc for a PC, you can try
  56. # yaccing on a unix system and downloading the resulting files to the PC.
  57. #
  58. #            Jeffrey R. Jones
  59. #            jjones@angate!att.com
  60.  
  61.  
  62. # make file for "flex" tool
  63.  
  64. # @(#) $Header: Makefile,v 2.3 89/06/20 17:27:12 vern Exp $ (LBL)
  65.  
  66. # Porting considerations:
  67. #
  68. #    For System V Unix machines, add -DSYS_V to CFLAGS.
  69. #    For Vax/VMS, add -DSYS_V to CFLAGS.
  70. #    For MS-DOS, add "-DMS_DOS -DSYS_V" to CFLAGS.  Create \tmp if not present.
  71. #         You will also want to rename flex.skel to something with a three
  72. #         character extension, change SKELETON_FILE below appropriately,
  73. #    For Amiga, add "-DAMIGA -DSYS_V" to CFLAGS.
  74.  
  75.  
  76. # the first time around use "make first_flex"
  77.  
  78.  
  79. YACC=yacc
  80. SKELETON_DIR = c:/usr/contrib/lib
  81. SKELETON_FILE = flex.ske
  82. SKELFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_DIR)/$(SKELETON_FILE)\"
  83. CFLAGS = -c -AC -DMS_DOS -DSYS_V
  84. LDFLAGS = /noi /cp:1 /stack:4096
  85.  
  86. #this null definition prevents a returned error code
  87. MFLAGS =
  88.  
  89. FLEX_FLAGS =
  90. FLEX = flex
  91. CC = cl
  92.  
  93. # redefine Aztec make's built-in rule
  94. .c.obj:
  95.     $(CC) $(CFLAGS) $*.c
  96.  
  97. # break obj-list into two because of 128 character command-line limit of
  98. # Microsoft's link and lib utilities.
  99. FLEXOBJS1 = ccl.obj dfa.obj ecs.obj gen.obj main.obj misc.obj nfa.obj parse.obj
  100. FLEXOBJS2 = scan.obj sym.obj tblcmp.obj yylex.obj
  101.  
  102. FLEX_C_SOURCES = \
  103.     ccl.c \
  104.     dfa.c \
  105.     ecs.c \
  106.     gen.c \
  107.     main.c \
  108.     misc.c \
  109.     nfa.c \
  110.     parse.c \
  111.     scan.c \
  112.     sym.c \
  113.     tblcmp.c \
  114.     yylex.c
  115.  
  116. # lib is used to get around the 128 character command-line limit of 'link'.
  117. flex.exe : $(FLEXOBJS1) $(FLEXOBJS2)
  118.     lib tmplib $(FLEXOBJS1);
  119.     link $(LDFLAGS) $(FLEXOBJS2),$*.exe,,tmplib;
  120.     rm -f tmplib.lib
  121.  
  122. # the second 'make flex.exe' causes scan.l to be RE-flexed.  The resulting
  123. # scan.c is different from initscan.c in that \r\n are added instead of
  124. # just \n.  Since \r\n is DOS language and this is targetted for PCs, and
  125. # since I don't know what would happen for all cases in DOS-land, I went
  126. # ahead and did it.
  127. first_flex:
  128.     cp initscan.c scan.c
  129.     make $(MFLAGS) flex.exe
  130.     rm -f scan.c
  131.     make flex.exe
  132.  
  133. parse.obj: parse.c parse.h
  134.  
  135. parse.h parse.c : parse.y
  136.     $(YACC) -d parse.y
  137.     @mv ytab.c parse.c
  138.     @mv ytab.h parse.h
  139.  
  140. scan.c : scan.l
  141.     $(FLEX) -ist $(FLEX_FLAGS) scan.l > scan.c
  142.  
  143. scan.obj : scan.c parse.h
  144.  
  145. main.obj : main.c
  146.     $(CC) $(CFLAGS) $(SKELFLAGS) main.c
  147.  
  148. ###################
  149. #don't have, or need, anything else except maybe the 'test' rule.
  150. #
  151. # don't have nroff
  152. #flex.man : flex.1
  153. #    nroff -man flex.1 >flex.man
  154. #
  155. # don't have lint
  156. #lint : $(FLEX_C_SOURCES)
  157. #    lint $(FLEX_C_SOURCES) > flex.lint
  158. #
  159. #distrib :
  160. #    mv scan.c initscan.c
  161. #    chmod 444 initscan.c
  162. #    $(MAKE) $(MFLAGS) clean
  163. #
  164. #clean :
  165. #    rm -f core errs flex *.o parse.c *.lint parse.h flex.man tags
  166. #
  167. #tags :
  168. #    ctags $(FLEX_C_SOURCES)
  169. #
  170. #vms :    flex.man
  171. #    $(MAKE) $(MFLAGS) distrib
  172. #
  173. # break this up into multiple lines...Aztec 'make' limitation
  174. test :
  175.     $(FLEX) -ist $(FLEX_FLAGS) scan.l > scan.tst
  176.     diff scan.c scan.tst
  177.     rm -f scan.tst
  178.