On Mon, Nov 23, 2015 at 9:57 AM, Paul Smith <psm...@gnu.org> wrote:
> Well, make doesn't know anything about backticks and doesn't ever do
> anything special with them, so the answer is always "no, the command
> inside the backticks is not executed when the variable is assigned".

I stand corrected.  Here's a little demo of the interaction of backticks
vs. $(shell ) and = vs :=
$ cat Makefile; make
FOO1 = `date; sleep 1`
FOO2 := `date; sleep 1`
FOO3 = $(shell date; sleep 1)
FOO4 := $(shell date; sleep 1)

all:
@echo FOO1 is $(FOO1)
@echo FOO1 is $(FOO1)
@echo FOO2 is $(FOO2)
@echo FOO2 is $(FOO2)
@echo FOO3 is $(FOO3)
@echo FOO3 is $(FOO3)
@echo FOO4 is $(FOO4)
@echo FOO4 is $(FOO4)

FOO1 is Mon Nov 23 10:21:12 PST 2015
FOO1 is Mon Nov 23 10:21:13 PST 2015
FOO2 is Mon Nov 23 10:21:14 PST 2015
FOO2 is Mon Nov 23 10:21:15 PST 2015
FOO3 is Mon Nov 23 10:21:10 PST 2015
FOO3 is Mon Nov 23 10:21:11 PST 2015
FOO4 is Mon Nov 23 10:21:09 PST 2015
FOO4 is Mon Nov 23 10:21:09 PST 2015

$(shell ...) is executed when the rule body is parsed
`` is executed by the final shell
_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to