xref: /freebsd/usr.bin/lex/Makefile (revision df7f5d4de4592a8948a25ce01e5bddfbb7ce39dc)
1# $Id$
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
12PROG=		lex
13LINKS+=	${BINDIR}/lex ${BINDIR}/lex++
14LINKS+=	${BINDIR}/lex ${BINDIR}/flex
15LINKS+=	${BINDIR}/lex ${BINDIR}/flex++
16
17SRCS=		scan.c ccl.c dfa.c ecs.c gen.c main.c misc.c nfa.c parse.c \
18		skel.c sym.c tblcmp.c yylex.c
19LFLAGS+=	-is
20CFLAGS+=	-I. -I${.CURDIR}
21MAN1=		lex.1
22MLINKS+=	lex.1 flex.1
23MLINKS+=	lex.1 flex++.1
24MLINKS+=	lex.1 lex++.1
25
26CLEANFILES+=	parse.c parse.h scan.c y.tab.h y.tab.c
27
28.if !defined(NOLIB)
29SUBDIR=		lib
30.endif
31
32beforeinstall:
33	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 644 \
34		${.CURDIR}/FlexLexer.h ${DESTDIR}/usr/include/g++
35
36
37parse.c parse.h: parse.y
38	$(YACC) -d $(.CURDIR)/parse.y
39	mv -f y.tab.c parse.c
40	mv -f y.tab.h parse.h
41
42bootstrap: initscan.c
43	@cmp -s ${.CURDIR}/initscan.c scan.c || { \
44		echo "Bootstrapping flex" ; \
45		rm -f scan.c ; \
46		cp -f ${.CURDIR}/initscan.c scan.c ; \
47	}
48
49beforedepend: parse.h
50scan.o:	parse.h
51
52test: check
53check: $(PROG)
54	./$(PROG) $(LFLAGS) -t $(COMPRESSION) $(.CURDIR)/scan.l \
55	| sed s,\"$(.CURDIR)/scan.l",\"scan.l", \
56	| diff $(.CURDIR)/initscan.c -
57	@echo "Check successful"
58
59.include <bsd.prog.mk>
60