8000 The make layer is now aware of the build mode by aivazis · Pull Request #45 · aivazis/mm · GitHub
[go: up one dir, main page]

Skip to content

The make layer is now aware of the build mode - #45

Merged
aivazis merged 7 commits into
mainfrom
mode
Jun 24, 2026
Merged

aivazis merged 7 commits into
mainfrom
mode

Conversation

@aivazis
@aivazis aivazis commented Jun 23, 2026 •
Copy link
Copy Markdown
Owner

Goal

Make mode a first-class build axis that drives behavior, not just build/install paths — so the make layer can do different things in dev vs deployment builds (release, conda, macports, ubuntu).

mode already existed in the driver as the deployment-intent axis (orthogonal to target, which governs compiler flags). This branch adds a local release mode, plumbs the mode through to make, builds a small framework for mode-dependent recipes, and lands the first consumers.

Driver

  • New release build mode: validator + both bldroot/prefix dispatch tables, with dev left byte-for-byte unchanged. release mirrors dev but injects a release/ discriminator above suite/tag so its artifacts never mix with dev. The construction-time firewall keeps the user-facing mode choices in sync with what's implemented.
  • project.mode is exported to the make subsystem (alongside project.home, project.prefix, …), riding the make command line so $(project.mode) is live from startup.
  • Path-assembly refactor: _devBldroot/_devPrefix and the new _releaseBldroot/_releasePrefix share _localBldroot/_localPrefix helpers.

make/modes/ framework

  • One file per implemented mode plus a default whose settings every mode inherits. modes/init.mm hard-includes default.mm then $(project.mode).mm — selecting a mode with no file is a fatal error (the make-layer echo of the driver firewall). Unset knobs default to the baseline (deliberate, distinct from silently failing).
  • Recipes read named mode knobs grouped by consumer (e.g. mode.npm.locked), never the mode name.
  • Non-dev is the baseline: dev is the one special mode (resolves fresh), and every deployment mode inherits the reproducible defaults — so new modes are usually near-empty and forgetting a knob fails safe.
  • mode.info / mode.help pages, with mode.info advertised in the usage index.

First consumers: webpack + vite

The npm dependency-install policy keyed on mode.npm.locked:

  • dev → stage package.json, resolve fresh (npm i); the committed package lock file is ignored.
  • deployment modes → stage package.json and the committed package-lock.json, install exactly (npm ci).
  • <pack>.lock.seed — seed a clean npm ci from the committed lock regardless of mode; this is a recovery mechanism during npm instability and fails if the package lock lock file doesn't exist.
  • <pack>.lock.harvest — harvest the package lock file as resolved by a successful build back to the source tree for committing, serving as a last-known-good resolution of the package dependencies.

The install prerequisite now is the node_modules/ directory, not the staged configuration file, so a failed npm run always triggers a new attempt.

Verified against real assets (qed.ux for webpack; examples/vite-relay, examples/vite-houdini for vite) via the rule database and real builds: correct prerequisites and npm i vs npm ci per mode, the node_modules keying, and the seed/harvest targets all work; no undefined-variable warnings.

@aivazis
aivazis merged commit 54f3ce6 into main Jun 24, 2026
@aivazis aivazis changed the title add build-mode-dependent behavior in the make layer The make layer is now aware of the build mode Jun 24, 2026
@aivazis
aivazis deleted the mode branch June 24, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0