pdpmake-2.0.2-fix_single_suffix.patch (1793B)
- From 89025d0698f8b5a5dbb49670729151997350498c Mon Sep 17 00:00:00 2001
- From: Ron Yorston <rmy@pobox.com>
- Date: Mon, 20 Jan 2025 21:46:44 +0000
- Subject: [PATCH] Fix single-suffix inference rule regression
- Commit a64a52f (Extend inference rule search) added code to handle
- inference rules with arbitrary suffixes. Unfortunately it failed
- to check for a single-suffix rule in the case where no known suffix
- was found. Add the necessary code.
- (GitHub issue #72)
- ---
- rules.c | 19 ++++++++++++++-----
- 1 file changed, 14 insertions(+), 5 deletions(-)
- diff --git a/rules.c b/rules.c
- index 4e88191..964b69a 100644
- --- pdpmake-2.0.2/rules.c
- +++ pdpmake-2.0.2/rules.c
- @@ -147,22 +147,34 @@ dyndep(struct name *np, struct rule *infrule, const char **ptsuff)
- // targets of the form lib.a(member.o).
- if (!posix && member == NULL) {
- struct name *xp = newname(".SUFFIXES");
- + int found_suffix = FALSE;
- +
- for (struct rule *rp = xp->n_rule; rp; rp = rp->r_next) {
- for (struct depend *dp = rp->r_dep; dp; dp = dp->d_next) {
- tsuff = dp->d_name->n_name;
- base = has_suffix(name, tsuff);
- if (base) {
- + found_suffix = TRUE;
- pp = dyndep0(base, tsuff, infrule);
- free(base);
- if (pp) {
- - if (ptsuff)
- - *ptsuff = tsuff;
- goto done;
- }
- }
- }
- }
- + if (!found_suffix) {
- + // The name didn't have a known suffix. Try single-suffix rule.
- + tsuff = "";
- + pp = dyndep0(name, tsuff, infrule);
- + if (pp) {
- + done:
- + if (ptsuff) {
- + *ptsuff = tsuff;
- + }
- + }
- + }
- } else
- #endif
- {
- @@ -173,9 +185,6 @@ dyndep(struct name *np, struct rule *infrule, const char **ptsuff)
- pp = dyndep0(base, tsuff, infrule);
- free((void *)tsuff);
- }
- -#if ENABLE_FEATURE_MAKE_EXTENSIONS
- - done:
- -#endif
- free(name);
- return pp;