[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Idea: Standard way to negate special targets
From: |
David A. Wheeler |
Subject: |
Idea: Standard way to negate special targets |
Date: |
Tue, 11 Jun 2019 16:25:31 -0400 (EDT) |
Idea: Standard way to negate special targets
Problem:
Sometimes you want to set a default value using a
special target, but in a few cases you want to *disable*
the special target.
For example, you might want to use:
.ONESHELL:
for *almost* all the rules, except for a few rules
where you want to *disable* .ONESHELL.
There currently isn't a way to do this.
Proposed solution:
Add a syntax to *disable* a special target for
a particular rule. I propose that it be
a whitespace-surrounded "!" in the prerequisites
followed by the special target being disabled. E.g.:
~~~~
.ONESHELL:
tricky_target: ! .ONESHELL prerequisite
~~~~
Having a reusable syntactic solution seems better
than having weird special cases. It means there's less to remember
(the same approach works every time) and it's easy to generalize.
I propose that disabling a special target *NOT* be inherited.
If you call on something else, and it wants to disable a
special target, then it has to do the same thing.
I know of no other use for "!" in prerequisites.
If that's not okay, perhaps ".NOT" would be a good alternative.
--- David A. Wheeler
- Idea: Standard way to negate special targets,
David A. Wheeler <=