title: In a makefile, how to get the relative path from one absolute path to another?
body: <p>An example to illustrate my question:</p>
  
  <p>Top level makefile</p>
  
  <pre><code>rootdir = $(realpath .)
  export includedir = $(rootdir)/include
  default:
      @$(MAKE) --directory=$(rootdir)/src/libs/libfoo
  </code></pre>
  
  <p>Makefile for src/libfoo</p>
  
  <pre><code>currentdir = $(realpath .)
  includedir = $(function or magic to make a relative path
                 from $(currentdir) to $(includedir),
                 which in this example would be ../../../include)
  </code></pre>
  
  <p>Another example:</p>
  
  <pre><code>current dir = /home/username/projects/app/trunk/src/libs/libfoo/ 
  destination = /home/username/projects/app/build/libfoo/ 
  relative    = ../../../../build/libfoo
  </code></pre>
  
  <p>How can this be done, while trying to be as portable as possible?</p>