[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Idea: .MUSTCREATE
From: |
David A. Wheeler |
Subject: |
Re: Idea: .MUSTCREATE |
Date: |
Sun, 09 Jun 2019 19:21:19 -0400 (EDT) |
On Sun, 09 Jun 2019 18:34:47 -0400, Paul Smith <address@hidden> wrote:
> 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.
I love it! That's a much better implementation of the goal, thanks.
If I understand correctly, that means that a single:
.WONTCREATE:
will be enough to detect a problem if *all* my rules
are supposed to always create the non-PHONY targets.
That gets me the error detection I was looking for!
I separately posted "Idea: Allow certain special targets as dependencies".
If that is accepted, I would add .WONTCREATE to that list of
special targets, so people could do this:
~~~~
.WONTCREATE: # By default fail if rule won't create its target
# Don't fail when my_command fails to create weird-thing
weird-thing: .WONTCREATE otherthing
<TAB>my_command
~~~~
--- David A. Wheeler