Ordering Build Steps by Their Dependencies

Dependencies determine which steps must finish before others can start. Independent steps can run in either allowable order.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a small build
  2. Diagnose an absent edge
  3. Work out what must finish before packaging begins
  4. Verify ordering through actual dependencies

Trace a small build

Generate a header, compile two files using it, then package both compiled outputs. Packaging must wait for both. The two compilations can run in either order after generation. Topological ordering gives a way to respect those restrictions.

Diagnose an absent edge

A sequential build can appear correct because generation happens first by chance. A parallel build may expose the missing relationship. Make each step's inputs and outputs explicit where its rule is defined.[1]

Work out what must finish before packaging begins

An HTML package requires a generated index and copied assets. The index generator needs source records. Copying assets can run alongside the index generator when their inputs are independent. Packaging waits for both. See graph scheduling.

Entry records → index
Asset source → copied assets
Index and copied assets → package
A valid parallel schedule starts both independent steps first

Verify ordering through actual dependencies

A serial build may succeed due to command order even with an undeclared dependency. A clean parallel build exposes that omission more readily. Check the artifact after deliberately changing one upstream input.

References

  1. Free Software Foundation, GNU Make Manual ↩