git: 79a095fa8a66 - stable/13 - crunchgen: slap a dependency on the generated makefile for .lo

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Mon, 18 Mar 2024 03:40:51 UTC
The branch stable/13 has been updated by kevans:

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

commit 79a095fa8a66a55e21d75c540a56249718d4eb73
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2024-03-09 02:01:17 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2024-03-18 03:34:09 +0000

    crunchgen: slap a dependency on the generated makefile for .lo
    
    crunchgen generates a foo.lo for each binary it will end up crunching
    into the final product.  While they have a dependency on the libs that
    are used to link them, nothing will force relinking if the set of libs
    needed to link them is changed.  Because of this, incremental builds may
    not be possible if one builds a version of, e.g., rescue/ with a broken
    set of libs specified for a project -- a subsequent fix won't be rolled
    in cleanly, it will require purging the rescue/ objdir.
    
    This is a bit crude, but the foo.mk we generate doesn't actually get
    regenerated all that often in practice, so a spurious relink for the
    vast majority of crunched objects won't actually happen all that often.
    
    Reviewed by:    bapt, emaste, imp
    
    (cherry picked from commit 6e2cfb24ee87fec0f538d04cd69d76a8d58c324f)
---
 usr.sbin/crunch/crunchgen/crunchgen.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/crunch/crunchgen/crunchgen.c b/usr.sbin/crunch/crunchgen/crunchgen.c
index 2315b139b8b6..31d64e8ab676 100644
--- a/usr.sbin/crunch/crunchgen/crunchgen.c
+++ b/usr.sbin/crunch/crunchgen/crunchgen.c
@@ -1129,8 +1129,8 @@ prog_makefile_rules(FILE *outmk, prog_t *p)
 	    "int _crunched_%s_stub(int argc, char **argv, char **envp)"
 	    "{return main(argc,argv,envp);}\" >%s_stub.c\n",
 	    p->ident, p->ident, p->name);
-	fprintf(outmk, "%s.lo: %s_stub.o $(%s_OBJPATHS)",
-	    p->name, p->name, p->ident);
+	fprintf(outmk, "%s.lo: %s_stub.o $(%s_OBJPATHS) %s",
+	    p->name, p->name, p->ident, outmkname);
 	if (p->libs)
 		fprintf(outmk, " $(%s_LIBS)", p->ident);