home *** CD-ROM | disk | FTP | other *** search
- (Message inbox:40)
- Date: Sat, 30 Jun 90 20:55:22 EDT
- From: Russell Herman <rwh@me.utoronto.ca>
- Subject: Re: flex release 2.3
- To: vern@cs.cornell.edu
- Newsgroups: comp.sources.d
- Organization: none
-
- Kudos on the latest version of Flex. It was a pleasant surprise to get
- a piece of code, push it through a PC compiler, and not get a tonne of
- warning messages. However, it was also an unpleasant unsurprise to
- discover that it didn't work due to Microsoft's perpetually buggy
- compilers. Here's a Makefile for one that finally did work; at least,
- it ran the test case. Any idea of a good source to really learn about
- the lex/yacc class of tools?
-
- Russ Herman
- INTERNET: rwh@me.utoronto.ca UUCP: ..uunet!utai!me!rwh
-
- ============================================================================
- # make file for "flex" tool using MSC6 and nmk, derived from
- # @(#) $Header: Makefile,v 2.3 89/06/20 17:27:12 vern Exp $ (LBL)
- # by rwh@me.utoronto.ca
-
- # **********************************************************************
- # Change SKELETON_FILE and SKELETON DIR to reflect your layout
- # You may also have to add a
- # #define register
- # to flexdef.h - I (rwh) did
- # **********************************************************************
-
- # the first time around use "make first_flex" if scan.c absent
-
-
- YACC=yacc
- SKELETON_DIR = e:\\includes
- SKELETON_FILE = flexskel.h
- SKELFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_DIR)\\$(SKELETON_FILE)\"
- # Use next flag set for debugging
- # CFLAGS = /AL /DMSC6 /Gt768 /Od /Zi
- # /Ox blows up with R6001/R6000 on test case, so fall back some opt-levels
- CFLAGS = /AC /DMSC6 /Gt768 /Oitc
- LDFLAGS = /noi /cp:1 /stack:8192
-
- #this null definition prevents a returned error code
- MFLAGS =
-
- FLEX_FLAGS =
- FLEX = flex
- CC = cl
-
- # break obj-list into two because of 128 character command-line limit of
- # Microsoft's link and lib utilities.
- FLEXOBJS1 = ccl.obj dfa.obj ecs.obj gen.obj main.obj misc.obj nfa.obj parse.obj
- FLEXOBJS2 = scan.obj sym.obj tblcmp.obj yylex.obj
-
- FLEX_C_SOURCES = \
- ccl.c \
- dfa.c \
- ecs.c \
- gen.c \
- main.c \
- misc.c \
- nfa.c \
- parse.c \
- scan.c \
- sym.c \
- tblcmp.c \
- yylex.c
-
- # lib is used to get around the 128 character command-line limit of 'link'.
- flex.exe: tmplib.lib $(FLEXOBJS2)
- link $(LDFLAGS) $(FLEXOBJS2),$*.exe,,tmplib;
- # Use next line for Codeview
- # link $(LDFLAGS) $(FLEXOBJS2),$*.exe,,tmplib /CO;
- -del tmplib.lib
-
- tmplib.lib: $(FLEXOBJS1)
- lib tmplib $(FLEXOBJS1);
-
- # the second 'make flex.exe' causes scan.l to be RE-flexed. The resulting
- # scan.c is different from initscan.c in that \r\n are added instead of
- # just \n. Since \r\n is DOS language and this is targetted for PCs, and
- # since I don't know what would happen for all cases in DOS-land, I went
- # ahead and did it.
- first_flex:
- copy initscan.c scan.c
- nmk $(MFLAGS) -f makefile.dos flex.exe
- -del scan.c
- nmk -f makefile.dos flex.exe
-
- parse.obj: parse.c parse.h
-
- parse.h parse.c : parse.y
- $(YACC) -d parse.y
- @mv ytab.c parse.c
- @mv ytab.h parse.h
-
- scan.c : scan.l
- $(FLEX) -ist8 $(FLEX_FLAGS) scan.l > scan.c
-
- scan.obj : scan.c parse.h
-
- main.obj : main.c
- $(CC) -c $(CFLAGS) $(SKELFLAGS) main.c
-
- ###################
- #
- # If you have MKS utilities, or other DIFFer
- test :
- $(FLEX) -ist8 $(FLEX_FLAGS) scan.l > scan.tst
- # Use next line for Codeview
- # cvexe /S /B /X $(FLEX) -ist8 $(FLEX_FLAGS) scan.l > scan.tst
- diff -b scan.c scan.tst
- # -del scan.tst
-
-