This is a fix for PR bin/23328. It has been ported to -STABLE and successfully tested by the PR originator. The patched make also did a world build without any problems. The problem is that null suffixes will not be cleared using .SUFFIXES: , and additions of new suffix rules thereafter may not have the desired effect. Fix: See the patch below. The first hunk is a fix for Suff_ClearSuffixes. First, sNum should not be reset to 0, because 0 is the sNum of suffNull. Instead, it is set to 1, so SuffClearSuffixes restores the same state that was present after SuffInit. Second, all old suffixes are removed in Suff_ClearSuffixes (and the graph is later rebuilt in SuffRebuildGraph), _except_ suffNull, which is used later on and may still contain old entries in its child list! This causes old null suffix rules not to be cleared, and adding new rules may fail if an old rule is present which has by chance the same sNum (which is possible since sNum is reset to 1). As a fix, the child list of suffNull is destroyed (without freeing the entries, because those should already be in suffClean) and reinitialized. The second hunk fixes another problem: when the graph is rebuilt in SuffRebuildGraph, transformations to the null suffix were not included, because the null suffix is not in the suffix list. This is now done with that fix. The third hunk is merely a cosmetical change: it causes `' to be printed around the debug output of suffixes. This is done already in other places and makes it possible to know the null suffix from an empty list. Here comes the diff for -CURRENT; in case that it gets munged somehow, it is also available at http://www.tu-bs.de/~y0015675/make.diff. How-To-Repeat: See PR bin/23328 for a full description. The bug did apparently surface in some autoconf-generated Makefiles, like the one of amanda 2.4.2 (specifically in the module amplot).
Responsible Changed From-To: freebsd-bugs->will Will is looking after Make(1) these days.
Responsible Changed From-To: will->tmm I'll take this over (with permission from will)
State Changed From-To: open->closed Committed to -CURRENT.