xref: /openbsd/usr.bin/lex/Makefile (revision 4cfece93)
1#	$OpenBSD: Makefile,v 1.17 2017/04/30 20:30:39 millert Exp $
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# If on your system you have trouble building flex due to 8-bit character
9# problems, remove the -8 from FLEX_FLAGS and the "#define FLEX_8_BIT_CHARS"
10# from the beginning of flexdef.h.
11#
12# To bootstrap lex, cp initscan.c to scan.c and run make.
13
14PROG=   lex
15CFLAGS+=-I. -I${.CURDIR} -DHAVE_CONFIG_H
16SRCS= buf.c ccl.c dfa.c ecs.c filter.c gen.c main.c misc.c \
17	  nfa.c options.c parse.y regex.c scan.l scanflags.c \
18	  scanopt.c skel.c sym.c tables.c tables_shared.c \
19	  tblcmp.c yylex.c
20
21CLEANFILES+=skel.c parse.c parse.h
22LDADD+=-lm
23
24MAN = flex.1
25
26LINKS=  ${BINDIR}/lex ${BINDIR}/flex \
27		${BINDIR}/lex ${BINDIR}/flex++
28
29VERSION="2.5.39"
30
31parse.h parse.c: parse.y
32	yacc -d -o parse.c ${.CURDIR}/parse.y
33
34skel.c: flex.skl mkskel.sh flexint.h tables_shared.h
35	sed -e 's/m4_/m4postproc_/g' -e 's/m4preproc_/m4_/g' \
36		${.CURDIR}/flex.skl | m4 -I${.CURDIR} -P \
37		-DFLEX_MAJOR_VERSION=`echo ${VERSION} | cut -f 1 -d .` \
38		-DFLEX_MINOR_VERSION=`echo ${VERSION} | cut -f 2 -d .` \
39		-DFLEX_SUBMINOR_VERSION=`echo ${VERSION} | cut -f 3 -d .` | \
40		sed -e 's/m4postproc_/m4_/g' | \
41		sh ${.CURDIR}/mkskel.sh  > ${.TARGET}
42
43includes:
44	${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \
45		${.CURDIR}/FlexLexer.h ${DESTDIR}/usr/include
46
47.include <bsd.prog.mk>
48