git: fcc8d727023c - main - Separate dependencies on tools built for host.

From: Simon J. Gerraty <sjg_at_FreeBSD.org>
Date: Fri, 30 Jun 2023 06:52:50 UTC
The branch main has been updated by sjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=fcc8d727023c3ac0f12b8aebc50f892cfd32992b

commit fcc8d727023c3ac0f12b8aebc50f892cfd32992b
Author:     Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2023-06-30 06:52:03 +0000
Commit:     Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2023-06-30 06:52:03 +0000

    Separate dependencies on tools built for host.
    
    When generated files depend on tools that need to be built for host,
    we need to carefully separate them for the DIRDEPS_BUILD so we
    only build them once.
    
    Reviewed by:    stevek
    Sponsored by:   Juniper Networks, Inc.
---
 bin/sh/Makefile      | 9 ++++++---
 usr.bin/awk/Makefile | 3 ++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/bin/sh/Makefile b/bin/sh/Makefile
index 039da7309adc..fafc223b4b29 100644
--- a/bin/sh/Makefile
+++ b/bin/sh/Makefile
@@ -44,22 +44,25 @@ build-tools: mknodes mksyntax
 
 DEPENDOBJS+= mknodes mksyntax
 mknodes mksyntax: ${BUILD_TOOLS_META}
+builtins.c builtins.h: mkbuiltins
+syntax.c syntax.h: mksyntax
+nodes.c nodes.h: mknodes
 .endif
 
 .ORDER: builtins.c builtins.h
 builtins.h: .NOMETA
-builtins.c builtins.h: mkbuiltins builtins.def
+builtins.c builtins.h: builtins.def
 	sh ${.CURDIR}/mkbuiltins ${.CURDIR}
 
 
 .ORDER: nodes.c nodes.h
 nodes.h: .NOMETA
-nodes.c nodes.h: mknodes nodetypes nodes.c.pat
+nodes.c nodes.h: nodetypes nodes.c.pat
 	${BTOOLSPATH:U.}/mknodes ${.CURDIR}/nodetypes ${.CURDIR}/nodes.c.pat
 
 .ORDER: syntax.c syntax.h
 syntax.h: .NOMETA
-syntax.c syntax.h: mksyntax
+syntax.c syntax.h:
 	${BTOOLSPATH:U.}/mksyntax
 
 token.h: mktokens
diff --git a/usr.bin/awk/Makefile b/usr.bin/awk/Makefile
index f604684804fa..ee8f7c3f282b 100644
--- a/usr.bin/awk/Makefile
+++ b/usr.bin/awk/Makefile
@@ -22,12 +22,13 @@ CLEANFILES= maketab proctab.c awkgram.tab.h
 awkgram.tab.h: awkgram.h
 	ln -sf ${.ALLSRC:M*.h} ${.TARGET}
 
-proctab.c: maketab awkgram.tab.h
+proctab.c: awkgram.tab.h
 	${BTOOLSPATH:U.}/maketab awkgram.tab.h > proctab.c
 
 .if ${MACHINE} == "host" || ${MK_DIRDEPS_BUILD} == "no"
 DEPENDOBJS+= maketab
 build-tools: maketab
+proctab.c: maketab
 maketab: awkgram.tab.h ${BUILD_TOOLS_META}
 .endif