Re: Deferred->immediate variable reassignment trick.

2023-06-21 Thread Paul Smith
On Wed, 2023-06-21 at 12:51 -0400, Paul Smith wrote: >   V ?= foo Sorry of course this should be "V = foo" or "V := foo"; whatever assignment operator you use here doesn't matter, you'll always see "bar" if you run "make V=bar".

Re: Deferred->immediate variable reassignment trick.

2023-06-21 Thread Paul Smith
On Wed, 2023-06-21 at 11:55 -0400, Brian J. Murrell wrote: > On Wed, 2023-06-21 at 11:47 -0400, Paul Smith wrote: > > On Wed, 2023-06-21 at 08:31 -0700, Kaz Kylheku wrote: > > > If I just have this: > > > > > >   IMPORTANT_VAR := $(shell sh -c "echo calculate; echo executed > > > 1>&2") > > > > >

Re: Deferred->immediate variable reassignment trick.

2023-06-21 Thread Brian J. Murrell
On Wed, 2023-06-21 at 11:47 -0400, Paul Smith wrote: > On Wed, 2023-06-21 at 08:31 -0700, Kaz Kylheku wrote: > > 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 s

Re: Deferred->immediate variable reassignment trick.

2023-06-21 Thread Paul Smith
On Wed, 2023-06-21 at 08:31 -0700, Kaz Kylheku wrote: > 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. IMO that is a bug and it should be reported as such

Re: Deferred->immediate variable reassignment trick.

2023-06-21 Thread Kaz Kylheku
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 b

Re: Deferred->immediate variable reassignment trick.

2023-06-20 Thread Paul Smith
On Tue, 2023-06-20 at 11:46 -0700, Kaz Kylheku wrote: > I used a trick in a makefile along the following pattern. It works > fine. I'm just circulating it for any comments/discussion. > >   # Delayed evaluation on purpose: > >   IMPORTANT_VAR = $(shell $CODE_TO_CALCULATE_IMPORTANT_VAR) > >  

Deferred->immediate variable reassignment trick.

2023-06-20 Thread Kaz Kylheku
I used a trick in a makefile along the following pattern. It works fine. I'm just circulating it for any comments/discussion. # Delayed evaluation on purpose: IMPORTANT_VAR = $(shell $CODE_TO_CALCULATE_IMPORTANT_VAR) # Force lazy variable to be eager: IMPORTANT_VAR := $(IMPORTANT_VA