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