bug-make
[Top][All Lists]
Advanced

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

Re: Idea: .MUSTCREATE


From: Paul Smith
Subject: Re: Idea: .MUSTCREATE
Date: Sun, 09 Jun 2019 18:34:47 -0400
User-agent: Evolution 3.32.1-2

On Sun, 2019-06-09 at 17:13 -0400, David A. Wheeler wrote:
> I propose a new special target .MUSTCREATE.
> Its prerequisites would list the targets that would fail in error
> if the target rule is run and it fails to create the target.
> If there's nothing on the list, then all non-.PHONY targets will
> fail in error if the rule runs without creating its target.

I understand the goal, but I'm not sure about this implementation.

For one thing, I'm not sure I see the utility in having a list of
targets after .MUSTCREATE... surely this option is there for ensuring
targets are written properly.  It seems not-so-useful as a validation
if you have to add a new target as a prerequisite to pseudo-target
before it will be checked.  So I suggest that this mode of listing
explicit targets is not something anyone would really use.

Having this pseudo target with no prerequisites enable a mode where all
targets are either PHONY or checked seems like something more people
would find useful (as you yourself would use it).

My main concern with this is that I'm not sure it's so black-and-white
out there in "the real world", that every rule will either be PHONY or
create a target.  What about, for example, FORCE-style rules for
portability with make instances that don't support PHONY?  Or, how
about auto-dependency tracking implementations that have empty rules?

Perhaps an adjustment to the definition, which is that "if make invokes
a command and the target is not created" would help, so that empty
recipes aren't considered.  This still doesn't help the FORCE trick.

The problem with your suggestion is that if you have even one rule
that, legitimately, doesn't create the target then this entire feature
is useless to you: enabling it causes your build to fail.

Here's an alternative:

A pseudo-target .WONTCREATE:
If that target exists in the makefile then the target existence
checking is enabled, as follows:
- Any PHONY rule is not considered
- After any target is built that actually invoked at least one command,
  the existence of the target make expected is checked.
  If it does exist, then no error is given.
- If the target does NOT exist, then the target is checked against the
  prerequisites of .WONTCREATE.  If the target is a prerequisite of
  .WONTCREATE, then no error is given.
- Else make generates an error as the recipe did not create the target.

If the target doesn't exist in the makefile then make behaves as
before.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]