Spec M36 — multi-target builds (owner, 2026-09-03; last in the queue)
Goal: one mc build produces every configured output — macOS, Linux, Windows, wasm32, wasm64 — from
one source tree and one mc.toml. Depends on the target registry (M17), the foreign targets
(M16, M17, M19, M20, M33) and sysroot resolution (M25).
mc.toml #
[project]
name = "app"
entry = "main.mc"
[[targets]] # each entry is a complete target; keys not given fall back to the
name = "mac" # single-target sections ([target], [linker], [sysroot], [libs], [externs])
os = "macos" arch = "aarch64" kind = "exe" out = "build/app-macos-arm64"
[[targets]]
name = "linux"
os = "linux" arch = "aarch64" out = "build/app-linux-arm64"
linker.cmd = "ld.lld" # dotted keys override the shared [linker] for this target only
[[targets]]
name = "web"
os = "browser" arch = "wasm32" out = "build/app.wasm"
mc buildwith[[targets]]present builds all of them, in file order, stopping at the first failure (exit 1) unless--keep-going;mc build --target=NAMEbuilds one;mc build --list-targetsprints the table (name, os, arch, kind, out, resolved sysroot).- Outputs never collide:
outis required per target (or defaults tobuild/<name>-<os>-<arch>[.ext]), and the driver refuses two targets with the sameout. - The taught compiler (
[compiler]) is built once and reused for every target; per-target[limits]and[run]are allowed. mc limitsandmc build --limitsreport per target;[run]entries letmc build --runexecute each output through its runner (native, Docker, node, wine) when configured.- Determinism: building the same target alone or as part of
--allyields byte-identical outputs (tested bycmp).
Acceptance #
examples/minimal and examples/wasm gain [[targets]] covering every available target on the
machine; mc build produces all outputs; --list-targets is deterministic; CI runs the macOS and
wasm entries and the Linux entry through the two-stage job; docs/guide/50-cross-compile.md documents
the section.