[Top][All Lists]

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

Re: Idea: Allow certain special targets as dependencies

From: Britton Kerin
Subject: Re: Idea: Allow certain special targets as dependencies
Date: Mon, 10 Jun 2019 00:14:25 -0800

On Sun, Jun 9, 2019 at 2:47 PM David A. Wheeler <address@hidden> wrote:
> Idea: Allow certain special targets as dependencies
> Problem:
> It's often the case that a target also needs to be a special target. E.g.:
> .PHONY: all
> all: do-this do-that
> Obviously this *works*, but it consumes many extra lines &
> requires duplication of target names.  For example,
> if you misspell the "duplicated" names bad things happen.
> For short makefiles this isn't a big deal, but with lots of rules
> it gets annoying.
> Solution:
> As syntactic sugar,
> I'd like to see selected special targets allowed as dependencies.
> When this happens, it's the same thing as if the target was listed
> as a dependency of the special target. E.g., you could express
> the same thing above as:
> all: .PHONY do-this do-that
> This doesn't add new *functionality* to a makefile, but if you're
> creating a GNU make specific makefile anyway the savings of
> lines can be significant.  It also eliminates a source of errors.

I also find having to write .PHONY: all over annoying.  Not sure
the proposed syntax is the best (not that I have any particular
problem with it, just wonder if there are any good alternatives).

> I propose that this abbreviation with the following special targets:

Aren't e.g. NOTPARALLEL and ONESHELL global in effect at
the moment?  Is the proposal to allow making them target-local
or does make already allow that somehow and I'm not aware?

The manual says for ONESHELL:

If .ONESHELL is mentioned as a target, then when a target is built all
lines of the recipe will be given to a single invocation of the shell
rather than each line being invoked separately (see Recipe Execution).

The documentation for other special built-in targets mentions their
sensitivity to supplied prereqs (e.g. .PHONY).  Maybe the docs
need fixed here.


reply via email to

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