NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/43502: make failes to stip suffix if target is phony

The following reply was made to PR bin/43502; it has been noted by GNATS.

From: David Holland <>
Subject: Re: bin/43502: make failes to stip suffix if target is phony
Date: Sun, 27 Jun 2010 00:55:11 +0000

 On Thu, Jun 24, 2010 at 10:15:01AM +0000, wrote:
  > The following makefile fails to do the rigth thing - at least
  > from my understanding of make.
  > [...]
  > The problem seems to be, that if a target is marked PHONY the
  > suffix detection stuff in make does not work anymore.
 Since suffix rules are based on matching against things that exist,
 I'm surprised this works even halfway. I would expect it to not find
 the PHONY .tg rules as valid sources for the suffix rule; but
 apparently it does.
 Note though that line 2412 of suff.c says
     * If this is a .PHONY target, we do not apply suffix rules.
 so the behavior you're seeing is apparently intentional, though
 That said, I would advise against relying on the detailed behavior of
 suffix rules because it isn't very portable. gmake, for example, does
 not exhibit the same behavior on your makefile. (Arguably it is even
 less useful in that it silently skips t4.) I don't have ready access
 to any of the various vendor variants of legacy System V make to test
 any more, but I wouldn't be surprised if those also did one or more
 different things.
 I'm finding it hard to guess what you're trying to really do that this
 is a simplified fragment of; but my guess is that you're better off
 approaching it some other way. Usually if you can afford to be
 bmake-specific, explicit rules defined with .for loops are the best
 way to tackle these sorts of issues. If you can't, it gets murkier.
 The fact that $* is not defined for t2 appears to be a legitimate bug;
 it seems to arise for all .PHONY targets. It's also not so obvious how
 to fix it. In order to avoid confusion I think I'm going to open a new
 PR for that.
 David A. Holland

Home | Main Index | Thread Index | Old Index