Home | History | Annotate | Download | only in Borland
      1 ###############################################################################
      2 # Makefile for flex 2.5.0.6 (beta) with Borland C/C++ version 4.02
      3 #
      4 # This will probably need to be adjusted for your existing lexer/parser
      5 # generators.  See definitions for FLEX and YACC near the bottom of the
      6 # makefile.
      7 #
      8 # This makefile builds initflex.exe and flex.exe by default.  It
      9 # removes initflex.exe after making flex.exe.  After that, you may
     10 # choose to try alternate compression options for your everyday flex
     11 # executable.
     12 #
     13 # This will build flex with the large model.  Don't use huge, but if you
     14 # feel like experimenting with other models, post your success stories to 
     15 # comp.compilers, OK?
     16 #
     17 # This makefile does *not* implement the big testing found in "makefile.in".
     18 #
     19 # I also assume the availability of sed and the gnu file utilities on the
     20 # system - they're readily available, so if you don't have them, why not?
     21 #                                                                 <grin>
     22 #
     23 # The resulting generated lexer (the real goal, right?) will compile
     24 # (and run nicely, too) as a .c file, as well as being included such as
     25 # extern "C" { #include "lexyyc" } in a .cplusplus file.
     26 #
     27 ###############################################################################
     28 
     29 DEBUG = 1
     30 
     31 .autodepend
     32 
     33 all:	initflex.exe flex.exe
     34 	rm initflex.exe initflex.map
     35 
     36 ###############################################################################
     37 #
     38 # standard utilitities? ha.
     39 #
     40 
     41 CC	= bcc
     42 CPP     = bcc
     43 
     44 ###############################################################################
     45 #
     46 
     47 MODEL	= l
     48 
     49 !if $(DEBUG) == 1
     50 !message Building with debug.
     51 debugCompile = -v
     52 debugLink = /v
     53 !else
     54 !message Building without debug.
     55 debugCompile =
     56 debugLink =
     57 !endif
     58 
     59 LOADER	= c0$(MODEL).obj
     60 LIBS	= c$(MODEL).lib
     61 LINKFLAGS = $(debugLink)
     62 
     63 DATASEG	= -dc -Ff
     64 SizeOPT	= -Os -G-
     65 Defines =
     66 
     67 COMMON	= -A -c -m$(MODEL) $(SizeOPT) $(DATASEG) $(Defines) $(debugCompile)
     68 CFLAGS  = -o$@ $(COMMON)
     69 CCFLAGS  = -o$@ $(COMMON) -Pcc
     70 
     71 ###############################################################################
     72 
     73 .SUFFIXES:	.cc
     74 
     75 .cc.obj:
     76 	$(CPP) $(CCFLAGS) $<
     77 
     78 .c.obj:
     79 	$(CPP) $(CFLAGS) $<
     80 
     81 ###############################################################################
     82 #
     83 # source & object files
     84 #
     85 
     86 BASESRC = ccl.c dfa.c ecs.c gen.c main.c misc.c nfa.c parse.c \
     87 	sym.c tblcmp.c yylex.c skel.c
     88 
     89 INITSRC = $(BASESRC) initscan.c
     90 
     91 INITOBJS = $(INITSRC:.c=.obj)
     92 
     93 SRC = $(BASESRC) scan.c
     94 
     95 OBJS = $(SRC:.c=.obj)
     96 
     97 objects:	$(OBJS)
     98 	@echo $(OBJS)
     99 
    100 ###############################################################################
    101 #
    102 # Executable
    103 #
    104 
    105 initflex.exe:      $(INITOBJS)
    106 	tlink $(LINKFLAGS) @&&!
    107 $(LOADER) $**
    108 $&.exe
    109 
    110 $(LIBS)
    111 !
    112 
    113 flex.exe:      $(OBJS)
    114 	tlink $(LINKFLAGS) @&&!
    115 $(LOADER) $**
    116 $&.exe
    117 
    118 $(LIBS)
    119 !
    120 
    121 # 
    122 ###############################################################################
    123 #
    124 # Lex files
    125 #
    126 
    127 FLEX	= .\initflex
    128 FLEX_FLAGS = -ist
    129 
    130 scan.c: scan.l
    131 	$(FLEX) $(FLEX_FLAGS) scan.l >scan.tmp
    132 	sed s,\"$(srcdir)/scan.l\",\"scan.l\", <scan.tmp >scan.c
    133 	@rm scan.tmp
    134 
    135 ###############################################################################
    136 #
    137 # YACC files
    138 #
    139 
    140 YACC	= .\bison
    141 YFLAGS  = -vdyl
    142 
    143 parse.c: parse.y
    144 	$(YACC) -ydl parse.y
    145 	@sed "/extern char.*malloc/d" <y_tab.c >parse.c
    146 	@rm -f y_tab.c
    147 	@mv y_tab.h parse.h
    148 
    149 ###############################################################################
    150 #
    151 # cleanup
    152 #
    153 
    154 clean:
    155 	-rm *.obj *.map initflex.exe
    156 
    157 realclean:	clean
    158 	-rm flex.exe
    159 
    160 #
    161 # end Makefile
    162 #
    163 ###############################################################################
    164