help-make
[Top][All Lists]
Advanced

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

Re: Evaluating a variable only once after a recipe has run


From: R. Diez
Subject: Re: Evaluating a variable only once after a recipe has run
Date: Sat, 18 Apr 2020 19:34:06 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

 > You may find this trick from my blog to be helpful: >  >>  > 
http://make.mad-scientist.net/deferred-simple-variable-expansion/
Would it be possible to encapsulate it somehow, so that other people 
immediately know what is going on?

I mean something like this:


# This definition does this because of that...

define DeferredSimpleVariableExpansion =

  ... something complicated here like this ...

  OUTPUT = $(eval OUTPUT := $$(shell some-comand))$(OUTPUT)

endef


Then the makefile user only has to do this:


$(call DeferredSimpleVariableExpansion VARIABLE some shell command with some 
arguments)


The name of the function is enough of a hint, and if not, the function 
definition has some advanced explanation.

Thanks in advance,
  rdiez


reply via email to

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