xref: /freebsd/usr.bin/lex/Makefile (revision c86f28d27bd21a49564bf795b1d3b989e394db90)
1# $FreeBSD$
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.y \
18		skel.c sym.c tblcmp.c yylex.c
19LFLAGS+=	-is
20CFLAGS+=	-I. -I${.CURDIR}
21MLINKS+=	lex.1 flex.1
22MLINKS+=	lex.1 flex++.1
23MLINKS+=	lex.1 lex++.1
24
25CLEANFILES=	scan.c skel.c
26
27SUBDIR=		lib
28
29skel.c: mkskel.sh flex.skl
30	sh ${.CURDIR}/mkskel.sh ${.CURDIR}/flex.skl > skel.c
31
32beforeinstall:
33	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
34		${.CURDIR}/FlexLexer.h ${DESTDIR}/usr/include/g++
35
36bootstrap: initscan.c
37	@cmp -s ${.CURDIR}/initscan.c scan.c || { \
38		echo "Bootstrapping flex" ; \
39		rm -f scan.c ; \
40		cp -f ${.CURDIR}/initscan.c scan.c ; \
41	}
42
43test: check
44check: $(PROG)
45	./$(PROG) $(LFLAGS) -t $(COMPRESSION) $(.CURDIR)/scan.l \
46	| sed s,\"$(.CURDIR)/scan.l",\"scan.l", \
47	| diff $(.CURDIR)/initscan.c -
48	@echo "Check successful"
49
50.include <bsd.prog.mk>
51