Make build target using secondexpansion

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Make build target using secondexpansion

Ram Yalamanchili
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
_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make