title: rebuild a target base on target specific variable
body: <p>Assume that I have a target called install, which builds binaries from the whole code base.</p>
  
  <p>And within the makefile I have another target called foo.src, which generates a source file "foo.src" with environmental variables, and it is needed for install.</p>
  
  <p>A third target called test, which will run a bunch of tests.</p>
  
  <p>So apparently test depends on install, install depends on foo.src.</p>
  
  <p>I am trying to avoid regenerating file foo.src every time I build test, as foo.src is prerequisite of a lot of targets, but I still want to make sure it gets regenerated if I am directly building install.</p>
  
  <p>what I've got so far:</p>
  
  <pre><code>BUILD_INSTALL =
  install: BUILD_INSTALL = dummy
  install: foo.src
      @echo "INSTALL!!!"
      @echo BUILD_INSTALL=$(BUILD_INSTALL)
      touch install
  
  foo.src: $(BUILD_INSTALL)
      @echo "foo.src!!"
      @echo BUILD_INSTALL=$(BUILD_INSTALL)
      touch foo.src
  
  test: install
      @echo "TEST!!!"
  
  .PHONY: test dummy
  dummy:
  </code></pre>
  
  <p>From what I can see, repeating building install does not regenerate foo.src. $(BUILD_INSTALL) does not expand to dummy as a prerequisite of foo.src when I am building install a second time.</p>