xref: /freebsd/usr.bin/lex/Makefile (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
18387c24dSGeoff Rehmet#
28387c24dSGeoff Rehmet# By default, flex will be configured to generate 8-bit scanners only if the
38387c24dSGeoff Rehmet# -8 flag is given.  If you want it to always generate 8-bit scanners, add
48387c24dSGeoff Rehmet# "-DDEFAULT_CSIZE=256" to CFLAGS.  Note that doing so will double the size
58387c24dSGeoff Rehmet# of all uncompressed scanners.
68387c24dSGeoff Rehmet#
78387c24dSGeoff Rehmet# Bootstrapping of lex is handled automatically.
8c5e63f9aSGeoff Rehmet# Also note that flex.skel no longer gets installed.
98387c24dSGeoff Rehmet#
108387c24dSGeoff Rehmet
118387c24dSGeoff RehmetPROG=		lex
125ff3832bSPeter WemmLINKS+=	${BINDIR}/lex ${BINDIR}/lex++
135ff3832bSPeter WemmLINKS+=	${BINDIR}/lex ${BINDIR}/flex
145ff3832bSPeter WemmLINKS+=	${BINDIR}/lex ${BINDIR}/flex++
158387c24dSGeoff Rehmet
16*7e382390SJung-uk KimFLEXDIR=	${SRCTOP}/contrib/flex/src
17ab76bc97SJung-uk Kim
18ab76bc97SJung-uk Kim.PATH:		${FLEXDIR}
19ab76bc97SJung-uk Kim
20ab76bc97SJung-uk KimSRCS=		buf.c ccl.c dfa.c ecs.c filter.c gen.c main.c misc.c \
21ab76bc97SJung-uk Kim		nfa.c options.c parse.y regex.c scan.c scanflags.c \
22ab76bc97SJung-uk Kim		scanopt.c skel.c sym.c tables.c tables_shared.c \
23ab76bc97SJung-uk Kim		tblcmp.c yylex.c
248387c24dSGeoff RehmetLFLAGS+=	-is
25ab76bc97SJung-uk KimCFLAGS+=	-I. -I${.CURDIR} -I${FLEXDIR} -DHAVE_CONFIG_H
26c7b111cbSRuslan ErmilovINCS=		FlexLexer.h
279eaa475eSAlexander KabaevINCSDIR=	${INCLUDEDIR}
285ff3832bSPeter WemmMLINKS+=	lex.1 flex.1
295ff3832bSPeter WemmMLINKS+=	lex.1 flex++.1
305ff3832bSPeter WemmMLINKS+=	lex.1 lex++.1
318387c24dSGeoff Rehmet
32ab76bc97SJung-uk KimWARNS?=		3
33b7946da9SEd Schouten
34533a4a62SDimitry AndricNO_WMISLEADING_INDENTATION=
35533a4a62SDimitry Andric
36d5a53b4fSDmitrij TejblumCLEANFILES=	scan.c skel.c
37ab76bc97SJung-uk KimGENFILES=	parse.c parse.h scan.c skel.c
388387c24dSGeoff Rehmet
398387c24dSGeoff RehmetSUBDIR=		lib
408387c24dSGeoff Rehmet
41ab76bc97SJung-uk KimFLEX_VERSION=	`awk -f ${.CURDIR}/version.awk ${.CURDIR}/config.h`
42d5a53b4fSDmitrij Tejblum
43ab76bc97SJung-uk Kimskel.c: config.h mkskel.sh flex.skl version.awk
44*7e382390SJung-uk Kim	sh ${FLEXDIR}/mkskel.sh ${FLEXDIR} m4 ${FLEX_VERSION} > ${.TARGET}
45ab76bc97SJung-uk Kim
46ab76bc97SJung-uk Kimbootstrap: ${GENFILES:S/^/init/g}
47ab76bc97SJung-uk Kim.for _f in ${GENFILES}
48ab76bc97SJung-uk Kim	@diff -I '^#line ' -I '\$$FreeBS[D]: .*\$$' -q \
49ab76bc97SJung-uk Kim	    ${.CURDIR}/init${_f} ${_f} 2> /dev/null || { \
50ab76bc97SJung-uk Kim		echo "Bootstrapping ${_f}" ; \
517a37b5fcSWill Andrews		${CP} ${.CURDIR}/init${_f} ${_f} ; \
5225c04ed2SPeter Wemm	}
53ab76bc97SJung-uk Kim.endfor
54693e5997SNate Williams
558387c24dSGeoff Rehmettest: check
56ab76bc97SJung-uk Kimcheck: ${PROG}
57ab76bc97SJung-uk Kim	./${PROG} ${LFLAGS} -t ${COMPRESSION} ${FLEXDIR}/scan.l | \
58ab76bc97SJung-uk Kim	diff -I '^#line ' -I '\$$FreeBS[D]: .*\$$' ${.CURDIR}/initscan.c -
598387c24dSGeoff Rehmet	@echo "Check successful"
608387c24dSGeoff Rehmet
618387c24dSGeoff Rehmet.include <bsd.prog.mk>
62