bug-make
[Top][All Lists]
Advanced

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

Idea: Allow some special targets to also be given as prerequisites (foo:


From: David A. Wheeler
Subject: Idea: Allow some special targets to also be given as prerequisites (foo: .PHONY == .PHONY: foo)
Date: Thu, 31 Oct 2024 13:18:38 -0400

GNU Make supports a number of special built-in target names
<https://www.gnu.org/software/make/manual/make.html#Special-Targets>.

I think it'd be helpful if some special target names could be listed as
*prerequisites* (foo: .PHONY) and doing so would have the same effect
as listing them as targets with those as the prerequisites (.PHONY. foo).

The current approach can lead to wordiness & it's easy to accidentally swap 
them.
Also, having *separate* lines to set these attributes makes it easy
to not see that these are set.

Here's what you must currently do:

~~~~
foo:
        echo > foo
.PHONY: foo
~~~~

I propose also allowing:

~~~~
foo: .PHONY
        echo > foo
~~~~

Examples where this might be useful:
.PHONY, .PRECIOUS, .INTERMEDIATE, .NOTINTERMEDIATE,
.SECONDARY, .IGNORE, .SILENT,  .NOTPARALLEL,
.ONESHELL

Thoughts?

--- David A. Wheeler




reply via email to

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