help-make
[Top][All Lists]
Advanced

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

Re: How to interpret commands between colon and first tab ?


From: Dan Kegel
Subject: Re: How to interpret commands between colon and first tab ?
Date: Mon, 23 Nov 2015 10:25:10 -0800

On Mon, Nov 23, 2015 at 9:57 AM, Paul Smith <address@hidden> 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


reply via email to

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