Pristine Ack-5.5
[Ack-5.5.git] / util / flex / proto.make
1 # $Id: proto.make,v 1.7 1994/06/24 10:57:22 ceriel Exp $
2
3 #PARAMS         do not remove this line!
4
5 SRC_DIR = $(SRC_HOME)/util/flex
6
7 # make file for "flex" tool
8
9 # Porting considerations:
10 #
11 #    For System V Unix machines, add -DUSG to CFLAGS (if it's not
12 #         automatically defined)
13 #    For Vax/VMS, add "-DVMS -DUSG" to CFLAGS.
14 #    For MS-DOS, add "-DMS_DOS -DUSG" to CFLAGS.  Create \tmp if not present.
15 #         You will also want to rename flex.skel to something with a three
16 #         character extension, change SKELETON_FILE below appropriately,
17 #         See MSDOS.notes for more info.
18 #    For Amiga, add "-DAMIGA -DUSG" to CFLAGS.
19 #    For SCO Unix, add "-DSCO_UNIX" to CFLAGS.
20 #
21 #    For C compilers which don't know about "void", add -Dvoid=int to CFLAGS.
22 #
23 #    If your C compiler is ANSI standard but does not include the <stdlib.h>
24 #    header file (some installations of gcc have this problem), then add
25 #    -DDONT_HAVE_STDLIB_H to CFLAGS.
26 #
27 # By default, flex will be configured to generate 8-bit scanners only
28 # if the -8 flag is given.  If you want it to always generate 8-bit
29 # scanners, add "-DDEFAULT_CSIZE=256" to CFLAGS.  Note that doing
30 # so will double the size of all uncompressed scanners.
31
32 # If on your system you have trouble building flex due to 8-bit
33 # character problems, remove the -8 from FLEX_FLAGS and the
34 # "#define FLEX_8_BIT_CHARS" from the beginning of flexdef.h.
35
36
37 # the first time around use "make first_flex"
38
39
40 # Installation targeting.  Files will be installed under the tree rooted
41 # at DESTDIR.  User commands will be installed in BINDIR, library files
42 # in LIBDIR (which will be created if necessary), auxiliary files in
43 # AUXDIR;
44 DESTDIR =
45 BINDIR = $(TARGET_HOME)/bin
46 AUXDIR = $(TARGET_HOME)/lib/flex
47
48 # MAKE = make
49
50 SKELETON_FILE = \"$(AUXDIR)/flex.skel\"
51 SKELFLAGS = -DDEFAULT_SKELETON_FILE=$(SKELETON_FILE)
52 INCLUDES = -I$(SRC_DIR) -I.
53 CFLAGS = $(COPTIONS) -DACK_MOD $(INCLUDES)
54 LDFLAGS = $(LDOPTIONS)
55
56 COMPRESSION =
57 FLEX_FLAGS = -ist8 -Sflex.skel
58 # which "flex" to use to generate scan.c from scan.l
59 FLEX = flex
60
61 FLEXOBJS = \
62         ccl.$(SUF) \
63         dfa.$(SUF) \
64         ecs.$(SUF) \
65         gen.$(SUF) \
66         main.$(SUF) \
67         misc.$(SUF) \
68         nfa.$(SUF) \
69         parse.$(SUF) \
70         scan.$(SUF) \
71         sym.$(SUF) \
72         tblcmp.$(SUF) \
73         yylex.$(SUF)
74
75 FLEX_C_SOURCES = \
76         $(SRC_DIR)/ccl.c \
77         $(SRC_DIR)/dfa.c \
78         $(SRC_DIR)/ecs.c \
79         $(SRC_DIR)/gen.c \
80         $(SRC_DIR)/main.c \
81         $(SRC_DIR)/misc.c \
82         $(SRC_DIR)/nfa.c \
83         $(SRC_DIR)/parse.c \
84         $(SRC_DIR)/scan.c \
85         $(SRC_DIR)/sym.c \
86         $(SRC_DIR)/tblcmp.c \
87         $(SRC_DIR)/yylex.c
88
89
90 all : flex
91
92 flex : $(FLEXOBJS)
93         $(CC) -o flex $(LDFLAGS) $(FLEXOBJS)
94
95 first_flex:
96         cp $(SRC_DIR)/initscan.c scan.c
97         chmod +w scan.c
98         make $(MFLAGS) flex
99
100 parse.h parse.c : $(SRC_DIR)/parse.y
101         yacc -d $(SRC_DIR)/parse.y
102         @mv y.tab.c parse.c
103         @mv y.tab.h parse.h
104
105 scan.c : $(SRC_DIR)/scan.l
106         $(FLEX) $(FLEX_FLAGS) $(COMPRESSION) $(SRC_DIR)/scan.l >scan.c
107
108 scan.$(SUF) : scan.c parse.h $(SRC_DIR)/flexdef.h
109         $(CC) $(CFLAGS) -c scan.c
110
111 main.$(SUF) : $(SRC_DIR)/main.c $(SRC_DIR)/flexdef.h
112         -mkdir $(AUXDIR)
113         $(CC) $(CFLAGS) -c $(SKELFLAGS) $(SRC_DIR)/main.c
114
115 ccl.$(SUF) : $(SRC_DIR)/ccl.c $(SRC_DIR)/flexdef.h
116         $(CC) $(CFLAGS) -c $(SRC_DIR)/ccl.c
117 dfa.$(SUF) : $(SRC_DIR)/dfa.c $(SRC_DIR)/flexdef.h
118         $(CC) $(CFLAGS) -c $(SRC_DIR)/dfa.c
119 ecs.$(SUF) : $(SRC_DIR)/ecs.c $(SRC_DIR)/flexdef.h
120         $(CC) $(CFLAGS) -c $(SRC_DIR)/ecs.c
121 gen.$(SUF) : $(SRC_DIR)/gen.c $(SRC_DIR)/flexdef.h
122         $(CC) $(CFLAGS) -c $(SRC_DIR)/gen.c
123 misc.$(SUF) : $(SRC_DIR)/misc.c $(SRC_DIR)/flexdef.h
124         $(CC) $(CFLAGS) -c $(SRC_DIR)/misc.c
125 nfa.$(SUF) : $(SRC_DIR)/nfa.c $(SRC_DIR)/flexdef.h
126         $(CC) $(CFLAGS) -c $(SRC_DIR)/nfa.c
127 parse.$(SUF) : parse.c $(SRC_DIR)/flexdef.h
128         $(CC) $(CFLAGS) -c parse.c
129 sym.$(SUF) : $(SRC_DIR)/sym.c $(SRC_DIR)/flexdef.h
130         $(CC) $(CFLAGS) -c $(SRC_DIR)/sym.c
131 tblcmp.$(SUF) : $(SRC_DIR)/tblcmp.c $(SRC_DIR)/flexdef.h
132         $(CC) $(CFLAGS) -c $(SRC_DIR)/tblcmp.c
133 yylex.$(SUF) : $(SRC_DIR)/yylex.c $(SRC_DIR)/flexdef.h
134         $(CC) $(CFLAGS) -c $(SRC_DIR)/yylex.c
135
136 LINTFLAGS = $(LINTOPTIONS) $(INCLUDES)
137 lint : $(FLEX_C_SOURCES)
138         $(LINT) $(LINTFLAGS) $(FLEX_C_SOURCES)
139
140 firstinstall: first_flex $(SRC_DIR)/flex.skel
141         rm -f $(BINDIR)/flex
142         cp flex $(BINDIR)/flex
143         if [ $(DO_MACHINE_INDEP) = y ] ; \
144         then    cp $(SRC_DIR)/flex.skel $(AUXDIR)/flex.skel ; \
145                 mk_manpage $(SRC_DIR)/flex.1 $(TARGET_HOME) ; \
146                 mk_manpage $(SRC_DIR)/flexdoc.1 $(TARGET_HOME) ; \
147         fi
148
149 install: flex $(SRC_DIR)/flex.skel
150         rm -f $(BINDIR)/flex
151         cp flex $(BINDIR)/flex
152         if [ $(DO_MACHINE_INDEP) = y ] ; \
153         then    cp $(SRC_DIR)/flex.skel $(AUXDIR)/flex.skel ; \
154                 mk_manpage $(SRC_DIR)/flex.1 $(TARGET_HOME) ; \
155                 mk_manpage $(SRC_DIR)/flexdoc.1 $(TARGET_HOME) ; \
156         fi
157
158 cmp: flex $(SRC_DIR)/flex.skel
159         -cmp flex $(BINDIR)/flex
160         -cmp $(SRC_DIR)/flex.skel $(AUXDIR)/flex.skel 
161
162 clean :
163         rm -f core errs flex *.$(SUF) parse.c *.lint parse.h tags scan.c
164
165 tags :
166         ctags $(FLEX_C_SOURCES)
167
168 test : flex
169         ./flex $(FLEX_FLAGS) $(COMPRESSION) scan.l | diff scan.c -
170
171 bigtest :
172         rm -f scan.c ; $(MAKE) COMPRESSION="-C" test
173         rm -f scan.c ; $(MAKE) COMPRESSION="-Ce" test
174         rm -f scan.c ; $(MAKE) COMPRESSION="-Cm" test
175         rm -f scan.c ; $(MAKE) COMPRESSION="-Cfe" test
176         rm -f scan.c ; $(MAKE) COMPRESSION="-CFe" test
177         rm -f scan.c ; $(MAKE) COMPRESSION="-Cf" test
178         rm -f scan.c ; $(MAKE) COMPRESSION="-CF" test
179         rm -f scan.c ; $(MAKE)