[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Idea: Allow some special targets to also be given as prerequisites (
From: |
Britton Kerin |
Subject: |
Re: Idea: Allow some special targets to also be given as prerequisites (foo: .PHONY == .PHONY: foo) |
Date: |
Thu, 31 Oct 2024 12:10:56 -0800 |
On Thu, Oct 31, 2024 at 9:19 AM David A. Wheeler <dwheeler@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