Makefile revision 15679
115679Swosch# $Id: Makefile,v 1.3 1996/01/08 09:17:39 peter Exp $
22258Scsgr#
32258Scsgr# By default, flex will be configured to generate 8-bit scanners only if the
42258Scsgr# -8 flag is given.  If you want it to always generate 8-bit scanners, add
52258Scsgr# "-DDEFAULT_CSIZE=256" to CFLAGS.  Note that doing so will double the size
62258Scsgr# of all uncompressed scanners.
72258Scsgr#
82258Scsgr# Bootstrapping of lex is handled automatically.
92307Scsgr# Also note that flex.skel no longer gets installed.
102258Scsgr#
112258Scsgr
122258ScsgrPROG=		lex
1313343SpeterLINKS+=	${BINDIR}/lex ${BINDIR}/lex++
1413343SpeterLINKS+=	${BINDIR}/lex ${BINDIR}/flex
1513343SpeterLINKS+=	${BINDIR}/lex ${BINDIR}/flex++
162258Scsgr
172258ScsgrSRCS=		ccl.c dfa.c ecs.c gen.c main.c misc.c nfa.c parse.y \
182258Scsgr		skel.c sym.c tblcmp.c yylex.c
192258ScsgrOBJS+=		scan.o
202258ScsgrLFLAGS+=	-is
212258ScsgrCFLAGS+=	-I. -I${.CURDIR}
222307ScsgrMAN1=		lex.1 lexdoc.1
2313343SpeterMLINKS+=	lex.1 flex.1
2413343SpeterMLINKS+=	lex.1 flex++.1
2513343SpeterMLINKS+=	lex.1 lex++.1
262258Scsgr
272307ScsgrCLEANFILES+=	parse.c parse.h scan.c y.tab.h y.tab.c
282258Scsgr
292258Scsgr
302258ScsgrSUBDIR=		lib
312258Scsgr
3213343Speterbeforeinstall:
3313343Speter	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 644 \
3413343Speter		${.CURDIR}/FlexLexer.h ${DESTDIR}/usr/include/g++
3513343Speter
362258Scsgr.depend: parse.h
372258Scsgr
382258Scsgrparse.c parse.h: parse.y
392258Scsgr	$(YACC) -d $(.CURDIR)/parse.y
4015679Swosch	mv -f y.tab.c parse.c
4115679Swosch	mv -f y.tab.h parse.h
422258Scsgr
432258Scsgr.if exists(/usr/bin/lex)
442258Scsgrscan.o:	parse.c
452258Scsgr.else
462258Scsgr# We must bootstrap
472258Scsgrscan.o: scan.c parse.h
482258Scsgr
492258Scsgrscan.c:
502258Scsgr	@echo "Bootstrapping flex"
512258Scsgr	@rm -f scan.c
522258Scsgr	@cp -pf ${.CURDIR}/initscan.c scan.c
532258Scsgr.endif
542258Scsgr
552258Scsgrtest: check
562258Scsgrcheck: $(PROG)
572258Scsgr	./$(PROG) $(LFLAGS) -t $(COMPRESSION) $(.CURDIR)/scan.l \
582258Scsgr	| sed s,\"$(.CURDIR)/scan.l",\"scan.l", \
592258Scsgr	| diff $(.CURDIR)/initscan.c -
602258Scsgr	@echo "Check successful"
612258Scsgr
622258Scsgr.include <bsd.prog.mk>
63