1219019Sgabor#
2219019Sgabor# By default, flex will be configured to generate 8-bit scanners only if the
3219019Sgabor# -8 flag is given.  If you want it to always generate 8-bit scanners, add
4219019Sgabor# "-DDEFAULT_CSIZE=256" to CFLAGS.  Note that doing so will double the size
5219019Sgabor# of all uncompressed scanners.
6219019Sgabor#
7219019Sgabor# Bootstrapping of lex is handled automatically.
8219019Sgabor# Also note that flex.skel no longer gets installed.
9219019Sgabor#
10219019Sgabor
11219019SgaborPROG=		lex
12219019SgaborLINKS+=	${BINDIR}/lex ${BINDIR}/lex++
13219019SgaborLINKS+=	${BINDIR}/lex ${BINDIR}/flex
14219019SgaborLINKS+=	${BINDIR}/lex ${BINDIR}/flex++
15219019Sgabor
16219019SgaborFLEXDIR=	${SRCTOP}/contrib/flex/src
17219019Sgabor
18219019Sgabor.PATH:		${FLEXDIR}
19219019Sgabor
20219019SgaborSRCS=		buf.c ccl.c dfa.c ecs.c filter.c gen.c main.c misc.c \
21219019Sgabor		nfa.c options.c parse.y regex.c scan.c scanflags.c \
22219019Sgabor		scanopt.c skel.c sym.c tables.c tables_shared.c \
23219019Sgabor		tblcmp.c yylex.c
24219019SgaborLFLAGS+=	-is
25219019SgaborCFLAGS+=	-I. -I${.CURDIR} -I${FLEXDIR} -DHAVE_CONFIG_H
26219019SgaborINCS=		FlexLexer.h
27219019SgaborINCSDIR=	${INCLUDEDIR}
28219019SgaborMLINKS+=	lex.1 flex.1
29219019SgaborMLINKS+=	lex.1 flex++.1
30219019SgaborMLINKS+=	lex.1 lex++.1
31219019Sgabor
32219019SgaborWARNS?=		3
33219019Sgabor
34219019SgaborNO_WMISLEADING_INDENTATION=
35219019Sgabor
36219019SgaborCLEANFILES=	scan.c skel.c
37219019SgaborGENFILES=	parse.c parse.h scan.c skel.c
38219019Sgabor
39219019SgaborSUBDIR=		lib
40219019Sgabor
41219019SgaborFLEX_VERSION=	`awk -f ${.CURDIR}/version.awk ${.CURDIR}/config.h`
42219019Sgabor
43219019Sgaborskel.c: config.h mkskel.sh flex.skl version.awk
44219019Sgabor	sh ${FLEXDIR}/mkskel.sh ${FLEXDIR} m4 ${FLEX_VERSION} > ${.TARGET}
45219019Sgabor
46219019Sgaborbootstrap: ${GENFILES:S/^/init/g}
47219019Sgabor.for _f in ${GENFILES}
48219019Sgabor	@diff -I '^#line ' -I '\$$FreeBS[D]: .*\$$' -q \
49219019Sgabor	    ${.CURDIR}/init${_f} ${_f} 2> /dev/null || { \
50219019Sgabor		echo "Bootstrapping ${_f}" ; \
51219019Sgabor		${CP} ${.CURDIR}/init${_f} ${_f} ; \
52219019Sgabor	}
53219019Sgabor.endfor
54219019Sgabor
55219019Sgabortest: check
56219019Sgaborcheck: ${PROG}
57219019Sgabor	./${PROG} ${LFLAGS} -t ${COMPRESSION} ${FLEXDIR}/scan.l | \
58219019Sgabor	diff -I '^#line ' -I '\$$FreeBS[D]: .*\$$' ${.CURDIR}/initscan.c -
59219019Sgabor	@echo "Check successful"
60219019Sgabor
61219019Sgabor.include <bsd.prog.mk>
62219019Sgabor