[BACK]Return to Makefile CVS log [TXT][DIR] Up to [local] / src / usr.bin / lex

File: [local] / src / usr.bin / lex / Makefile (download)

Revision 1.12, Thu Nov 19 19:43:40 2015 UTC (8 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.11: +26 -22 lines

Update flex from ancient 2.5.4 to the recent 2.5.39.
This work was all done by Serguey Parkhomovsky. Thanks.
Some changes from upstream:
* Removed autotools cruft/localization/texinfo manual/etc
* Kept the old manpage, as the new manpage is content-free
* Used safe string handling functions and fixed several compiler warnings
* pledge(2). Flex 2.5.39 now forks/execs its filter chains and needs proc
  exec in addition to what was previously pledged
* Removed register keyword from all variable declarations
* renamed parse.c, parse.h, scan.c, skel.c with init prefix so compiling
  flex outside of obj by accident wouldn't clobber the bootstrap files
* Minor fixes (spelling, accessing buf[strlen(buf) - 1] for zero-length
  strings in initscan.c/scan.l, etc) that were already in our tree

This is a huge change, so it's going in the tree code bomb style.
I'm not excited about the growth in complexity (like now running m4
to _post_ process lexers) but hopefully this will be a one time update
and we will now take "ownership" of the code.

#	$OpenBSD: Makefile,v 1.12 2015/11/19 19:43:40 tedu Exp $
#
# By default, flex will be configured to generate 8-bit scanners only if the
# -8 flag is given.  If you want it to always generate 8-bit scanners, add
# "-DDEFAULT_CSIZE=256" to CFLAGS.  Note that doing so will double the size
# of all uncompressed scanners.
#
# If on your system you have trouble building flex due to 8-bit character
# problems, remove the -8 from FLEX_FLAGS and the "#define FLEX_8_BIT_CHARS"
# from the beginning of flexdef.h.
#
# To bootstrap lex, cp initscan.c to scan.c and run make.

PROG=   lex
CFLAGS+=-I. -I${.CURDIR} -DHAVE_CONFIG_H
SRCS= buf.c ccl.c dfa.c ecs.c filter.c gen.c main.c misc.c \
	  nfa.c options.c parse.y regex.c scan.l scanflags.c \
	  scanopt.c skel.c sym.c tables.c tables_shared.c \
	  tblcmp.c yylex.c

CLEANFILES+=skel.c parse.h
LDADD+=-lm

MAN = flex.1

LINKS=  ${BINDIR}/lex ${BINDIR}/flex \
		${BINDIR}/lex ${BINDIR}/flex++
MLINKS= flex.1 lex.1

VERSION="2.5.39"

# Our yacc is too old to compile parse.y; use bootstrapped parse.c instead
parse.h parse.c: parse.y
	cp ${.CURDIR}/initparse.c parse.c
	cp ${.CURDIR}/initparse.h parse.h

skel.c: flex.skl mkskel.sh flexint.h tables_shared.h
	sed -e 's/m4_/m4postproc_/g' -e 's/m4preproc_/m4_/g' \
		${.CURDIR}/flex.skl | m4 -I${.CURDIR} -P \
		-DFLEX_MAJOR_VERSION=`echo ${VERSION} | cut -f 1 -d .` \
		-DFLEX_MINOR_VERSION=`echo ${VERSION} | cut -f 2 -d .` \
		-DFLEX_SUBMINOR_VERSION=`echo ${VERSION} | cut -f 3 -d .` | \
		sed -e 's/m4postproc_/m4_/g' | \
		sh ${.CURDIR}/mkskel.sh  > ${.TARGET}

includes:
.if !exists(${DESTDIR}/usr/include/g++)
	${INSTALL} -d -o root -g bin -m 755 \
		${DESTDIR}/usr/include/g++
.endif
	${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \
		${.CURDIR}/FlexLexer.h ${DESTDIR}/usr/include/g++/

.include <bsd.prog.mk>