title: Makefile: Expand relative PREFIX path
body: <p>In my Makefile, there is a <code>PREFIX</code> variable for specifying where the finished files should be placed. However, internally, I need to use the absolute path of <code>PREFIX</code> because the working directory changes.</p>
  
  <p>I tried something like</p>
  
  <pre><code>PREFIX=../out
  REALPREFIX=`readlink -f $(PREFIX)`
  </code></pre>
  
  <p>which didn't work, and neither did</p>
  
  <pre><code>default: fixprefix $(addprefix $(REALPREFIX)/,$(OBJS))
  
  fixprefix:
          REALPREFIX=`readlink -f $(PREFIX)`
  </code></pre>
  
  <p>All I need is for the absolute path to be prefixed onto <code>OBJS</code> when the prerequisites list is calculated.</p>