xref: /freebsd/usr.bin/lex/Makefile (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1#
2# By default, flex will be configured to generate 8-bit scanners only if the
3# -8 flag is given.  If you want it to always generate 8-bit scanners, add
4# "-DDEFAULT_CSIZE=256" to CFLAGS.  Note that doing so will double the size
5# of all uncompressed scanners.
6#
7# Bootstrapping of lex is handled automatically.
8# Also note that flex.skel no longer gets installed.
9#
10
11PROG=		lex
12LINKS+=	${BINDIR}/lex ${BINDIR}/lex++
13LINKS+=	${BINDIR}/lex ${BINDIR}/flex
14LINKS+=	${BINDIR}/lex ${BINDIR}/flex++
15
16FLEXDIR=	${SRCTOP}/contrib/flex/src
17
18.PATH:		${FLEXDIR}
19
20SRCS=		buf.c ccl.c dfa.c ecs.c filter.c gen.c main.c misc.c \
21		nfa.c options.c parse.y regex.c scan.c scanflags.c \
22		scanopt.c skel.c sym.c tables.c tables_shared.c \
23		tblcmp.c yylex.c
24LFLAGS+=	-is
25CFLAGS+=	-I. -I${.CURDIR} -I${FLEXDIR} -DHAVE_CONFIG_H
26INCS=		FlexLexer.h
27INCSDIR=	${INCLUDEDIR}
28MLINKS+=	lex.1 flex.1
29MLINKS+=	lex.1 flex++.1
30MLINKS+=	lex.1 lex++.1
31
32WARNS?=		3
33
34NO_WMISLEADING_INDENTATION=
35
36CLEANFILES=	scan.c skel.c
37GENFILES=	parse.c parse.h scan.c skel.c
38
39SUBDIR=		lib
40
41FLEX_VERSION=	`awk -f ${.CURDIR}/version.awk ${.CURDIR}/config.h`
42
43skel.c: config.h mkskel.sh flex.skl version.awk
44	sh ${FLEXDIR}/mkskel.sh ${FLEXDIR} m4 ${FLEX_VERSION} > ${.TARGET}
45
46bootstrap: ${GENFILES:S/^/init/g}
47.for _f in ${GENFILES}
48	@diff -I '^#line ' -I '\$$FreeBS[D]: .*\$$' -q \
49	    ${.CURDIR}/init${_f} ${_f} 2> /dev/null || { \
50		echo "Bootstrapping ${_f}" ; \
51		${CP} ${.CURDIR}/init${_f} ${_f} ; \
52	}
53.endfor
54
55test: check
56check: ${PROG}
57	./${PROG} ${LFLAGS} -t ${COMPRESSION} ${FLEXDIR}/scan.l | \
58	diff -I '^#line ' -I '\$$FreeBS[D]: .*\$$' ${.CURDIR}/initscan.c -
59	@echo "Check successful"
60
61.include <bsd.prog.mk>
62