title: mutually-exclusive job scheduling in GNU make?
body: <p>Using GNU make, is it possible to create a set of targets that will never be scheduled at the same time when using the "--jobs" option?</p>
  
  <h3>Background:</h3>
  
  <p>To make this a little more concrete, consider a makefile of the form</p>
  
  <pre><code>p1: ...deps... # no parallelization conflicts (can run at the same time as p*, e*)
          ...rules...
  
  p2: ...deps... # no parallelization conflicts (can run at the same time as p*, e*)
          ...rules...
  
  p3: ...deps... # no parallelization conflicts (can run at the same time as p*, e*)
          ...rules...
  
  e1: ...deps... # cannot run at same time as any other e*
          ...rules...
  
  e2: ...deps... # cannot run at same time as any other e*
          ...rules...
  
  e3: ...deps... # cannot run at same time as any other e*
          ...rules...
  </code></pre>
  
  <p>The main thing I need to do is make sure that e1, e2, and e3 never are being processed at the same time because they do some work on an embedded device with limited resources.  They crash if multiple ones of them are executing at the same time.  p1, p2, and p3 can be executed in parallel with anything, including any e* job.</p>
  
  <p>Note that the actual makefile has a few thousand targets with a dependency tree that's about 10 levels deep, so I'm hoping there's a way to do this that (a) doesn't require running make serially and (b) preserves the benefits of encoding the dependency tree in a makefile.</p>