On Wed, 12 Jun 2019 14:40:40 +0300, Michael Livshin <mlivs...@gmail.com> wrote: > Or! > How about a general syntax for canceling prerequisites (not just for > special targets)? Say, "!:" (inspired by "&:")? > > Then you'd just say ".ONESHELL!: my-tricky-target". More verbose than > "my-tricky-target: ! .ONESHELL" or whatever,
I think the verbosity is a problem - it increases the risk of bugs & time to change things. Every time you have to repeat a name you increase the chance of *almost* repeating the name & having a mysterious bug. It also means that reading the Makefile will take more time (and you have to read a Makefile to review or edit it). But the idea of generalizing it to cancel prerequisites in general, not just special targets, is a good idea. If you're going to have a capability, I think it should avoid limitations where reasonable. So I like that expansion. I think the removal would happen at the first expansion, just like any other rule. So you could add & remove as desired, with the last one winning. So you'd have to have a removal rule after all its adding rules. That'd be easiest to implement & would be relatively unsurprising. On Wed, 12 Jun 2019 09:43:26 -0400, Paul Smith <psm...@gnu.org> wrote: > The thing I don't like about this is it's not clear where the "!" > applies. Does it apply to just the next prereq? That was my intent. > What about modifying the target name itself, like: > > tricky_target: .!ONESHELL .PHONY ... I think modifying the target name itself is MUCH worse. I don't the problem is serious, but I *do* see your point. I think a better alternative syntax would be to start with "!" *without* a space after it. For example: tricky_target: !.ONESHELL .PHONY ... There's some logic to it; the prerequisites are space-separated, and now they're still space-separated including the "not a prerequisite" statement. That would create pain for filenames that begin with "!", but prefixing them with "./" would resolve that problem, and make already limits filenames. --- David A. Wheeler _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make