I'm trying to implement prerequisite feedback via environment backpropagation.
Here's "test.1":
{ http://pastebin.com/ZiEJpEhr }
--- [ test.1 ] ---
T=a b c d e
.PHONY: $(T)
$(T):
$(if $($(@)_BRINGBACK),$(eval $($(@)_BRINGBACK)))
$(if $($(@)_BRINGBACK),@echo '>' $@':' $(@)_BRINGBACK = $($(@)_BRINGBACK))
$(if $(LDFLAGS),@echo '>' $@':' LDFLAGS = $(LDFLAGS))
@echo '>' $@':'$(if $+, $+)$(if $|, '|' $|)
.DEFAULT: a
a: b | c
b: d
c: e
e_BRINGBACK = LDFLAGS += -lz
--- [ test.1 ] ---
--- [ test.1 output ] ---
--- [ test.1 output ] ---
Append global environment variable to "test.1" and name it "test.2":
{ http://pastebin.com/JqUN36ZP }
--- [ test.2 ] ---
LDFLAGS = -lm
--- [ test.2 ] ---
--- [ test.2 output ] ---
--- [ test.2 output ] ---
Works well.
Append target environment variable to "test.1" and name it "test.3":
{ http://pastebin.com/z9L17eaJ }
--- [ test.3 ] ---
a: LDFLAGS = -lm
--- [ test.3 ] ---
--- [ test.3 output ] ---
--- [ test.3 output ] ---
Not so good, as you may see.
And finally, append slightly different target environment variable to
"test.1" and name it "test.4":
{ http://pastebin.com/jGaz8H8t }
--- [ test.4 ] ---
a: LDFLAGS += -lm
--- [ test.4 ] ---
--- [ test.4 output ] ---
--- [ test.4 output ] ---
This completely breaks my mind.
Questions:
1. why LDFLAGS is not modified in #3?
2. why LDFLAGS is messed up in #4?
Thank you.