help-make
[Top][All Lists]
Advanced

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

Re: Deferred->immediate variable reassignment trick.


From: Kaz Kylheku
Subject: Re: Deferred->immediate variable reassignment trick.
Date: Wed, 21 Jun 2023 08:31:31 -0700
User-agent: Roundcube Webmail/1.4.13

On 2023-06-20 12:55, Paul Smith wrote:
> I don't understand how this is different than just:
> 
>     IMPORTANT_VAR := $(IMPORTANT_VAR)
> 
> If the user specifies an override of the variable on the command line
> then the value in the makefile will never be used, so the shell command
> will never be invoked.

If I just have this:

  IMPORTANT_VAR := $(shell sh -c "echo calculate; echo executed 1>&2")

and do "make IMPORTANT_VAR=alternative", I still see "executed"
on standard output. (In an installation with Make 4.1.)

If I just have this:

  IMPORTANT_VAR = $(shell sh -c "echo calculate; echo executed 1>&2")

and use $(IMPORTANT_VAR) in multiple places, I see multiple "executed",
of course.



reply via email to

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