freebsd-dev/usr.bin/awk/Makefile
Warner Losh c50c8502cb awk: Fix dependencies
proctab.c is generated from awktab.h, so needs to depend on it.
maketab does not depend on awktab.h, and gets the maketab.c dependency
automatically, so remove them both.

Normally, these don't matter. However, for a meta build, they can cause
us to build maketab twice (once host, once for target) resulting in a
binary that can't run on the host due to proctab.c racing maketab in
parallel legs. In stable/12, this was a reliably lost race, while in
main I've been unable to trigger the race at all (maybe due to dirdep
changes making main more robust).

MFC After:	1 day (build breakage)
Reported by:	kp
Sponsored by:	Netflix
2021-07-31 15:48:26 -06:00

37 lines
713 B
Makefile

# $FreeBSD$
.include <src.opts.mk>
AWKSRC= ${SRCTOP}/contrib/one-true-awk
.PATH: ${AWKSRC}
PROG= awk
SRCS= awkgram.y b.c lex.c lib.c main.c parse.c proctab.c run.c tran.c awkgram.tab.h
CFLAGS+= -DHAS_ISBLANK -I. -I${AWKSRC} -DFOPEN_MAX=64
WARNS?= 1
LIBADD= m
LINKS= ${BINDIR}/awk ${BINDIR}/nawk
MLINKS= awk.1 nawk.1
CLEANFILES= maketab proctab.c awkgram.tab.h
awkgram.tab.h: awkgram.h
ln -sf ${.ALLSRC:M*.h} ${.TARGET}
proctab.c: maketab awkgram.h
${BTOOLSPATH:U.}/maketab awkgram.h > proctab.c
DEPENDOBJS+= maketab
build-tools: maketab
maketab: ${BUILD_TOOLS_META}
# awk needs some work before we can connect these tests to the build
#HAS_TESTS=
#SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>