title: Strip prefix of dependency in makefile rule target
body: <p>I have a makefile which is designed to get some datasets from the web and unzip them into folders (given by the archive names). Unfortunately, the archives on the website are grouped within a folder structure. For example, if I want <code>dataset.tar.gz</code>, which is part of set <code>DIR1</code>, I call wget with: <code>www.example.com/DIR1/dataset.tar.gz</code>. </p>
  
  <p>This is then downloaded to <code>dataset.tar.gz</code>, which I can then extract with <code>tar -xzf</code>. My makefile for this is currently:</p>
  
  <pre><code>URL = www.example.com
  FILES = DIR1/something.url DIR2/another.url
  FOLDERS = $(notdir $(patsubst %.url, %, $(FILES)) )
  
  %.url: # do nothing
  
  %.tar.gz : %.url
      wget -q $(URL)/$&lt;
  
  % : %.tar.gz
      tar -xzf $&lt;
  
  all: $(FOLDERS)
  </code></pre>
  
  <p>Unfortunately, the target for the rule <code>%.tar.gz : %.url</code> does not resolve to (e.g.) <code>something.tar.gz</code>, but to <code>DIR1/something.tar.gz</code>, even though it produces the expected file. </p>
  
  <p>This causes problems when I rerun the makefile, as it does not detect <code>something.tar.gz</code> (as it is looking for <code>DIR1/something.tar.gz</code>), and redownloads the dataset, wasting time and bandwidth.</p>
  
  <p>Is there any way of stripping prefixes/directories from makefile targets, i.e. removing <code>DIR1</code> from the rule <code>%.tar.gz : %.url</code>, in order that the makefile correctly checks to see if it is satisfied?</p>