[Top][All Lists]

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

Re: meaning of # in the variable used as a list of targets

From: Paul Smith
Subject: Re: meaning of # in the variable used as a list of targets
Date: Sun, 26 Feb 2023 13:54:14 -0500
User-agent: Evolution 3.46.4 (by Flathub.org)

On Sun, 2023-02-26 at 19:19 +0100, Arkadiusz Drabczyk wrote:
> In the manual it says:
> "Within a @code{define} directive, comments are not ignored during
> the definition of the variable, but rather kept intact in the value
> of the variable.  When the variable is expanded they will either be
> treated as @code{make} comments or as recipe text, depending on the
> context in which the variable is evaluated."
> But take the following example:
> define var
> 1 2 3 #something
> endef
> $(info $$var is [${var}])
> $(var):
>         echo target from a variable
> It's possible to call \#something target:
> $ make \#something
> $var is [1 2 3 #something]
> echo target from a variable
> target from a variable
> $(var) is not a _recipe text_ so according to the manual it should be
> treated as a comment like that:
> 1 2 3 #something:
>         echo target from a variable
> which should result in
> $ make \#something
> $var is [1 2 3 #something]
> Makefile:7: *** missing separator.  Stop.
> right? Is this an oversight in the manual?

I guess it's an inaccuracy in the wording of the manual.  The

  define var
  a #b

is the same as writing:

  var = a \#b

and will have the same effect; that is if you use:


you will be defining two targets "a" and "#b".

The manual is making this statement because in a define/endef people
use comments without really considering how they are handled so it
seemed prudent to call it out specifically.  But the statement made
there is less clear than it should be.

reply via email to

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