1
2# Build a bootstrap version of m4 (needed in order to build libelf and lex)
3.PATH: ${SRCTOP}/usr.bin/m4 ${.CURDIR}
4
5# Avoid using lex or yacc to generate sources
6LEX:=/this/should/not/be/used
7
8tokenizer.c: bootstrap_m4_tokenizer
9	test -e ${.TARGET}
10
11# This target is used as a marker in usr.bin/m4/Makefile to not add the
12# lex and yacc includes. Therefore we must define it before including
13# the other Makefile.
14bootstrap_m4_tokenizer: inittokenizer.c
15.for _f in tokenizer.c
16	@cmp -s ${.CURDIR}/init${_f} ${_f} || { \
17		echo "Bootstrapping ${_f}" ; \
18		${CP} ${.CURDIR}/init${_f} ${_f} ; \
19	}
20.endfor
21
22BINDIR=	/usr/bin
23.include "${SRCTOP}/usr.bin/m4/Makefile"
24
25regen:
26	(cd ${SRCTOP}/usr.bin/m4 && lex -t ${SRCTOP}/usr.bin/m4/tokenizer.l) | grep -v '#line' > inittokenizer.c
27