5bb9250e0a
The most awkward bit in this patch is the bootstrapping of m4: We can't simply use the host version of m4 since that is not compatible with the flags passed by lex (at least on macOS, possibly also on Linux). Therefore we need to bootstrap m4, but lex needs m4 to build and m4 also depends on lex (which needs m4 to generate any files). To work around this cyclic dependency we can build a bootstrap version of m4 (with pre-generated files) then use that to build the real m4. This patch also changes the xz/unxz/dd tools to always use the host version since the version in the source tree cannot easily be bootstrapped on macOS or Linux. Reviewed By: brooks, imp (earlier version) Differential Revision: https://reviews.freebsd.org/D25992
28 lines
789 B
Makefile
28 lines
789 B
Makefile
# $FreeBSD$
|
|
|
|
# Build a bootstrap version of m4 (needed in order to build libelf and lex)
|
|
.PATH: ${SRCTOP}/usr.bin/m4 ${.CURDIR}
|
|
|
|
# Avoid using lex or yacc to generate sources
|
|
LEX:=/this/should/not/be/used
|
|
|
|
tokenizer.c: bootstrap_m4_tokenizer
|
|
test -e ${.TARGET}
|
|
|
|
# This target is used as a marker in usr.bin/m4/Makefile to not add the
|
|
# lex and yacc includes. Therefore we must define it before including
|
|
# the other Makefile.
|
|
bootstrap_m4_tokenizer: inittokenizer.c
|
|
.for _f in tokenizer.c
|
|
@cmp -s ${.CURDIR}/init${_f} ${_f} || { \
|
|
echo "Bootstrapping ${_f}" ; \
|
|
${CP} ${.CURDIR}/init${_f} ${_f} ; \
|
|
}
|
|
.endfor
|
|
|
|
BINDIR= /usr/bin
|
|
.include "${SRCTOP}/usr.bin/m4/Makefile"
|
|
|
|
regen:
|
|
(cd ${SRCTOP}/usr.bin/m4 && lex -t ${SRCTOP}/usr.bin/m4/tokenizer.l) | grep -v '#line' > inittokenizer.c
|