On Thu, Oct 31, 2024 at 9:19 AM David A. Wheeler <dwhee...@dwheeler.com> wrote:
>
> 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
> ~~~~

Seems reasonable though I haven't thought carefully about it.

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

Last I checked .ONESHELL was global (which is a real shame).
Supporting this for special targets that don't actually work per-target
would be very confusing.

Britton

Reply via email to