help-make
[Top][All Lists]
Advanced

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

Make build target using secondexpansion


From: Ram Yalamanchili
Subject: Make build target using secondexpansion
Date: Tue, 24 Jul 2018 11:43:32 -0700

Hi, I’m trying to construction build targets dynamically without success. 
Here’s an example Makefile to mimic the situation (on GNU Make 3.81 built for 
i386-apple-darwin11.3.0.):

---
VERSION = old

.SECONDEXPANSION:

release: VERSION = new
release: helm-$$(VERSION)
@echo Release: $(VERSION)

end-%:
@echo $@

docker-%: end-$$(VERSION)
@echo $@

push-%: docker-$$(VERSION)
@echo $@

helm-%: | push-$$(VERSION)
@echo $@
—

I’d have expected all targets to end with “new” when I run `make release`. 
However, this is the output I see:

---
end: old
docker-old
push-new
helm-new
Release: new
—

It looks like docker-$$(VERSION) is using the older instance of VERSION instead 
of the reassigned target specific variable. However this logic works fine for 
helm- and push targets. Any thoughts on why this is happening?

Thanks.
Ram


reply via email to

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