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