deps.nim's generateBackendBuildFile now emits the per-module pipeline instead
of one whole-program nifc rule: per-module cg -> merge -> per-module emit ->
link. The single nim_nifc command template carries the per-rule stage/module
switches in nifmake's (args) slot; backendCFile reconstructs each module's .c
path exactly as cgen.getCFile does (mangleModuleName of the source path for
main, the NIF suffix for deps) so the rules can declare outputs without loading
any backend module. The main module's cg depends on every other .c.nif (it
reads their init metas for NimMain), so it runs last; merge depends on all
.c.nif; each emit on merge; link on all .c.
Supporting changes:
- new `link` stage (nifbackend.generateLinkStage): registers every emitted .c
and runs extccomp.callCCompiler once (parallel cc + link). Skips modules with
no .c (extra members of system's closure whose code was emit-everywhere'd).
- loadBackendModules also loads system's transitive closure so every module in
the dep graph is a resolvable cg/emit target (was: project closure + system
only, leaving system-closure modules unfindable).
- cg always writes a .c.nif (even for code-less leaf modules) so every cg rule
has its declared nifmake output.
- export getSomeNameForModule; deps.nim imports modulepaths/extccomp/cnif.
`nim ic` now builds via the per-module backend end to end. Validated: the int
diamond and a generic+exception program build and run byte-correct vs the
whole-program backend; koch ic thallo/tconverter/timp/tmiscs/tparseutils all
green (and a thallo binary's output matches the whole-program build).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>