xref: /freebsd/usr.bin/lex/Makefile (revision 2ed3236082a4473c1da8f72c1ebc071a7b54321f)
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
17FLEXDIR=	${SRCTOP}/contrib/flex/src
18
19.PATH:		${FLEXDIR}
20
21SRCS=		buf.c ccl.c dfa.c ecs.c filter.c gen.c main.c misc.c \
22		nfa.c options.c parse.y regex.c scan.c scanflags.c \
23		scanopt.c skel.c sym.c tables.c tables_shared.c \
24		tblcmp.c yylex.c
25LFLAGS+=	-is
26CFLAGS+=	-I. -I${.CURDIR} -I${FLEXDIR} -DHAVE_CONFIG_H
27INCS=		FlexLexer.h
28INCSDIR=	${INCLUDEDIR}
29MLINKS+=	lex.1 flex.1
30MLINKS+=	lex.1 flex++.1
31MLINKS+=	lex.1 lex++.1
32
33WARNS?=		3
34
35NO_WMISLEADING_INDENTATION=
36
37CLEANFILES=	scan.c skel.c
38GENFILES=	parse.c parse.h scan.c skel.c
39
40SUBDIR=		lib
41
42FLEX_VERSION=	`awk -f ${.CURDIR}/version.awk ${.CURDIR}/config.h`
43
44skel.c: config.h mkskel.sh flex.skl version.awk
45	sh ${FLEXDIR}/mkskel.sh ${FLEXDIR} m4 ${FLEX_VERSION} > ${.TARGET}
46
47bootstrap: ${GENFILES:S/^/init/g}
48.for _f in ${GENFILES}
49	@diff -I '^#line ' -I '\$$FreeBS[D]: .*\$$' -q \
50	    ${.CURDIR}/init${_f} ${_f} 2> /dev/null || { \
51		echo "Bootstrapping ${_f}" ; \
52		${CP} ${.CURDIR}/init${_f} ${_f} ; \
53	}
54.endfor
55
56test: check
57check: ${PROG}
58	./${PROG} ${LFLAGS} -t ${COMPRESSION} ${FLEXDIR}/scan.l | \
59	diff -I '^#line ' -I '\$$FreeBS[D]: .*\$$' ${.CURDIR}/initscan.c -
60	@echo "Check successful"
61
62.include <bsd.prog.mk>
63