[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: simple assignment of target-specific variables
From: |
Dmitry Goncharov |
Subject: |
Re: simple assignment of target-specific variables |
Date: |
Tue, 9 Jun 2020 11:51:57 -0400 |
On Tue, Jun 9, 2020 at 9:10 AM David Boyce <dboyce@broadcom.com> wrote:
> TARGETS := aa bb cc dd
> $(TARGETS): at := $(shell set -x; date)
Despite the same name "at" those are different variables.
Given that there are 4 simple variables defined, 4 calls to date take place.
$ cat makefile
.PHONY: all
all: aa bb
aa: at := $(shell set -x; date)
$(shell sleep 5)
bb: at := $(shell set -x; date)
aa bb:
@:$(info Making $@ at $(at))
$ make
+ date
+ date
Making aa at Tue Jun 9 11:50:08 EDT 2020
Making bb at Tue Jun 9 11:50:13 EDT 2020
Note, aa's at is 5 seconds earlier then bb's.
> But in a target-specific context should the variable be considered "defined"
> at the time it's parsed or at the time it's needed?
There could be multiple places where it is needed.
regards, Dmitry