xref: /freebsd/usr.bin/lex/Makefile (revision a316b26e50bbed7cf655fbba726ab87d8ab7599d)
1# $Id: Makefile,v 1.1.1.1 1994/08/24 13:10:33 csgr Exp $
2#
3# By default, flex will be configured to generate 8-bit scanners only if the
4# -8 flag is given.  If you want it to always generate 8-bit scanners, add
5# "-DDEFAULT_CSIZE=256" to CFLAGS.  Note that doing so will double the size
6# of all uncompressed scanners.
7#
8# Bootstrapping of lex is handled automatically.
9# Also note that flex.skel no longer gets installed.
10#
11# XXX Todo:
12#	Install as lex++, and install FlexLexer.h
13
14PROG=		lex
15#LINKS+=	${BINDIR}/lex ${BINDIR}/lex++ ${BINDIR}/flex ${BINDIR}/flex++
16
17SRCS=		ccl.c dfa.c ecs.c gen.c main.c misc.c nfa.c parse.y \
18		skel.c sym.c tblcmp.c yylex.c
19OBJS+=		scan.o
20LFLAGS+=	-is
21CFLAGS+=	-I. -I${.CURDIR}
22MAN1=		lex.1 lexdoc.1
23
24CLEANFILES+=	parse.c parse.h scan.c y.tab.h y.tab.c
25
26
27SUBDIR=		lib
28
29.depend: parse.h
30
31parse.c parse.h: parse.y
32	$(YACC) -d $(.CURDIR)/parse.y
33	mv y.tab.c parse.c
34	mv y.tab.h parse.h
35
36.if exists(/usr/bin/lex)
37scan.o:	parse.c
38.else
39# We must bootstrap
40scan.o: scan.c parse.h
41
42scan.c:
43	@echo "Bootstrapping flex"
44	@rm -f scan.c
45	@cp -pf ${.CURDIR}/initscan.c scan.c
46.endif
47
48test: check
49check: $(PROG)
50	./$(PROG) $(LFLAGS) -t $(COMPRESSION) $(.CURDIR)/scan.l \
51	| sed s,\"$(.CURDIR)/scan.l",\"scan.l", \
52	| diff $(.CURDIR)/initscan.c -
53	@echo "Check successful"
54
55.include <bsd.prog.mk>
56