1 # from: @(#)Makefile 5.4 (Berkeley) 6/24/90 2 # $NetBSD: Makefile,v 1.17 2023/06/03 09:09:03 lukem Exp $ 3 # 4 # By default, flex will be configured to generate 8-bit scanners only if the 5 # -8 flag is given. If you want it to always generate 8-bit scanners, add 6 # "-DDEFAULT_CSIZE=256" to CPPFLAGS. Note that doing so will double the size 7 # of all uncompressed scanners. 8 # 9 # If on your system you have trouble building flex due to 8-bit character 10 # problems, remove the -8 from FLEX_FLAGS and the "#define FLEX_8_BIT_CHARS" 11 # from the beginning of flexdef.h. 12 # 13 # To bootstrap lex, cp initscan.c to scan.c and run make. 14 15 .include <bsd.init.mk> 16 17 PROG= lex 18 CPPFLAGS+=-I. -I${.CURDIR} -DVERSION=\"${VERSION}\" 19 SRCS= \ 20 buf.c \ 21 ccl.c \ 22 dfa.c \ 23 ecs.c \ 24 filter.c \ 25 gen.c \ 26 main.c \ 27 misc.c \ 28 nfa.c \ 29 options.c \ 30 parse.y \ 31 regex.c \ 32 scan.l \ 33 scanflags.c \ 34 scanopt.c \ 35 skel.c \ 36 sym.c \ 37 tables.c \ 38 tables_shared.c \ 39 tblcmp.c \ 40 yylex.c 41 42 YHEADER=1 43 CLEANFILES+=skel.c 44 INCS =FlexLexer.h 45 INCSDIR=/usr/include/g++ 46 LDADD+=-lm 47 .ifndef HOSTPROG 48 DPADD+=${LIBM} 49 .endif 50 51 MAN = flex.1 52 53 LINKS= ${BINDIR}/lex ${BINDIR}/flex \ 54 ${BINDIR}/lex ${BINDIR}/flex++ 55 MLINKS= flex.1 lex.1 56 57 skel.c: flex.skl mkskel.sh flexint.h tables_shared.h 58 ${TOOL_SED} -e 's/4_/a4_/g; s/m4preproc_/m4_/g' \ 59 ${IDIST}/flex.skl | ${TOOL_M4} -I${IDIST} -P \ 60 -DFLEX_MAJOR_VERSION=`echo ${VERSION} | cut -f 1 -d .` \ 61 -DFLEX_MINOR_VERSION=`echo ${VERSION} | cut -f 2 -d .` \ 62 -DFLEX_SUBMINOR_VERSION=`echo ${VERSION} | cut -f 3 -d .` | \ 63 ${TOOL_SED} -e 's/m4postproc_/m4_/g' | \ 64 ${HOST_SH} ${IDIST}/mkskel.sh ${IDIST} ${TOOL_M4} ${VERSION} > ${.TARGET} 65 66 .ifndef HOSTPROG 67 scan.c: scan.l 68 ${_MKTARGET_LEX} 69 ${LEX} -t -p ${.ALLSRC} >${.TARGET} 70 .endif 71 72 scan.o yylex.o: parse.h 73 74 # Ugh. Generates too large offsets with -O2. 75 .if defined(HAVE_GCC) && ${HAVE_GCC} >= 7 && ${ACTIVE_CC} == "gcc" 76 . if ${MACHINE_CPU} == "m68k" && empty(CFLAGS:M-O0) 77 COPTS.scan.c+= -O1 78 . endif 79 .endif 80 81 COPTS.filter.c+= ${CC_WNO_FORMAT_TRUNCATION} 82 COPTS.misc.c+= ${CC_WNO_FORMAT_TRUNCATION} 83 COPTS.parse.c+= ${CC_WNO_FORMAT_TRUNCATION} 84 85 .include <bsd.prog.mk> 86