Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.

src/deps.x

Make dependency output for x2c translation units.

Functions

FunctionSummary
translation_depfile_parseParses prerequisite words after the first literal colon in text.
translation_depfile_writePublishes the Make depfile for one completed translation.

Functions

translation_depfile_parse

List translation_depfile_parse(String text)

Parses prerequisite words after the first literal colon in text. Backslash escapes and doubled dollars are decoded in that region. A backslash-newline continues the rule; an ordinary newline ends it before any phony rules. A word immediately before that newline is currently returned twice. This accepts internally generated rules with colon-free targets rather than general Make syntax. A NULL input or no parsed prerequisites returns NULL. Returned cells and path Strings follow the current canonical List and String pool lifetimes.

Source: src/deps.x:40

translation_depfile_write

int translation_depfile_write( CliRequest request, Compiler compiler, String input, String output_dir)

Publishes the Make depfile for one completed translation. compiler.deps must reflect the translated input, and the selected depfile’s parent directory must exist. Disabled dependency output and inspection requests return one without writing. Otherwise prerequisites are unique and sorted; the target is request.dep_target or the generated C and header pair, followed by optional phony rules. A process-specific sibling is written and closed before rename, so handled open, write, close, or rename failures preserve any existing depfile, report to stderr, and return zero. Cleanup attempts to unlink an opened sibling but does not report an unlink failure. Allocation failure transfers through ordinary runtime Error handling instead of returning zero.

Source: src/deps.x:176

Design notes

Translation collects the prerequisites. This module writes them in a stable Make spelling and publishes the file atomically.