mpark / wg21

Framework for Writing C++ Committee Papers
Boost Software License 1.0
125 stars 45 forks source link

Order-only dependency on output. #63

Closed brevzin closed 4 years ago

brevzin commented 4 years ago

If the OUTDIR is a normal dependency and I'm building multiple papers into the same directory, then touching anything means rebuilding everything. The OUTDIR just needs to be created by this step, it doesn't need to trigger rebuilds.

mpark commented 4 years ago

Oh oops. Okay. What is this | thing??

brevzin commented 4 years ago

It's called an order-only dependency. Basically, there are two things that dependencies drive when you have something like x : y:

  1. Whenever you run the rule for x, run the rule for y first
  2. Whenever y changes, re-run the rule for x

An order-only dependency (x : | z) does (1) but not (2). Building the output directory is like the canonical use of order-only dependency (with a normal dependency, anytime you build anything, you would have to then rebuild everything).