title: Marking secondary targets and checking for edits
body: <p>I'm using Make to extract and generate figures for a scientific report. It being declarative is very nice for writing down where data is and how to convert it into a figure. My makefile looks somewhat like this (with <code>plots</code> being the main target):</p>
  
  <pre><code>plots: some_specific_figure.png some_other_figure.png yet_another_figure.png
  
  %.png: %.fig.py
      $(GENFIG) $&lt;
  
  %.fig.py: %.raw.fig.py
      cp $&lt; $@
  
  some_specific_figure.raw.fig.py:
      $(GETDATA) some/super/specific/simulation/results/directory/ $@
  
  some_other_figure.raw.fig.py:
      $(GETDATA) some/different/arbitrary/simulation/directory/ $@
  
  yet_another_figure.raw.fig.py:
      # etcetera
  </code></pre>
  
  <p>Now, in the end, I want to <strong>manually edit</strong> these <code>*.fig.py</code> files ( <code>some_specific_figure.fig.py</code>, <code>some_other_figure.fig.py</code>, etc), because the raw extracted data doesn't contain the right plot/axis/line title, axis range, etc. </p>
  
  <p>What I would like Make to do, is</p>
  
  <ul>
  <li>Extract <code>%.fig.raw.py</code> from the data directory if it doesn't exist. Copy it to <code>%.fig.py</code> to allow editing later.</li>
  <li>Keep the <code>%.fig.py</code> file after building. </li>
  <li>Just build <code>%.png</code> from an existing <code>%.fig.py</code> without overwriting it with the <code>%.raw.fig.py</code> file. If <code>%.fig.py</code> exists or has been edited, Make should just use that.</li>
  </ul>
  
  <p>What is an easy/concise way to do this? Marking <code>.SECONDARY: %.fig.py</code> didn't do the trick, when I do that, Make still deletes <code>%.fig.py</code> at the end!</p>