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