Repository navigation
docs: Makefile contract, the rules a Makefile change is reviewed against - #4689
Conversation
flow/Makefile keeps to a handful of conventions that were never written down: a do- target runs one step and builds nothing, dependencies live on the file targets, the graph does not depend on a variable, a step writes only files of its own, a design's variables are assigned with ?=, and so on. docs/contrib/MakefileContract.md states them as hard-stop rules, each with what breaks when it is broken, for automated review of AI changes to flow/Makefile, flow/scripts/*.mk, the stage scripts and variables.yaml. AGENTS.md (and CLAUDE.md, a link to it) points agents at it, and the Developer's Guide links it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a new 'Makefile Contract' developer guide (docs/contrib/MakefileContract.md) that establishes clear rules and conventions for modifying the OpenROAD Flow (ORFS) Makefile, stage scripts, and variables. It also updates AGENTS.md, DeveloperGuide.md, and the table of contents to link to this new document. The review feedback suggests a helpful clarification to specify that the rule against overwriting set variables applies specifically to configuration or environment variables, rather than local script variables.
🔍 QoR checkMetrics reflect the PR merge build — i.e. what will land on the target branch. Commit 62 design(s) checked — 0 with regression(s), 0 without a comparable baseline. |
dsengupta0628
left a comment
There was a problem hiding this comment.
Thanks for writing these down. Very helpful.
Small requests: Three places where the page doesn't match today's code:
- "The graph never depends on a variable." LEC_CHECK/SEC_CHECK (Makefile:450, 465, 567, 573, 681, 687), SYNTH_USE_SYN (Makefile:441) and AUTO_MEMORIES (Makefile:268) all change the graph, including the check-kepler-formal prerequisite the page gives as an allowed example.
Please add a short "Known debt" list to MakefileContract.md that names these. The PR description's examples (exit 1 in floorplan.tcl/util.tcl, memories.json) can go there too. - "A variable is never missing from variables.yaml." WORK_HOME and the four tree directories are not in it, and Makefile-only helpers (DO_STEP_DEPS_*, UNSET_AND_MAKE) would fail the rule too.
In MakefileContract.md, please limit the rule to variables a design, platform or user sets, or a stage script reads. Add WORK_HOME to the known-debt list. - Scope. The config.mk platform-default rule covers flow/platforms/*/config.mk and flow/designs/**/config.mk, but those paths are missing from the scope list, so they never get checked against it.
Please add those two paths to the intro of MakefileContract.md and to the line in AGENTS.md.
- State that any place where the code disagrees with a rule is technical debt, from an expedient solution or older code, instead of listing cases that would go out of date. - Limit the variables.yaml rule to variables a design, platform or user sets, or a stage script reads; Makefile-internal helpers are not listed. - Add flow/platforms/*/config.mk and flow/designs/**/config.mk to the scope in MakefileContract.md and AGENTS.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
Thanks! Addressed 2 and 3. For 1, rather than a list that goes stale as items are fixed or added, the page now says any place where the code disagrees with a rule is technical debt, from an expedient solution or older code. LEC_CHECK/SEC_CHECK, SYNTH_USE_SYN, AUTO_MEMORIES and |
…bles.yaml WORK_HOME and other variables only the Makefile reads may be documented elsewhere; variables.yaml covers what a design or platform sets or a stage script reads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
My intention is not perfection of this documentation of first try, but to have enough of a baseline that contributors get more autonomy by having improved AI authoring and review. |
|
All good. Thanks- I approved. But system doesn't let me merge your code or enable auto merge. I think you need someone with write permission in this repo. @eder-matheus ? |
flow/Makefilekeeps to a handful of conventions that have grown up over time and were never written down. This writes them down indocs/contrib/MakefileContract.mdas hard-stop rules, so that automated review of AI changes toflow/Makefile,flow/scripts/*.mk, the stage.tclscripts andvariables.yamlhas something to check against. Each rule says what breaks when it is broken.do-target never builds anything; dependencies live only on the file targets and stage aliases;open_*,gui_*,web_*andrunnever build anything; the graph never depends on a variable.exiton failure;PRE_<STEP>_TCLhooks run afterload_design.=for a variable a design sets; neverexport VAR := $(VAR)for one the environment supplies; only the Makefile setsRESULTS_DIRand the other tree directories; every variable is invariables.yaml, and one with a default is read as$::env(VAR); positive names, no duplicates, no default-off toggles, no$(shell awk/sed ...).The rules come from review threads on this repository, among them #4672, #4682, #4685, #4586 and #4573. Existing code that breaks a rule is called out as debt, not precedent: for example,
exit 1infloorplan.tclandutil.tcl, andAUTO_MEMORIES's generatedmemories.jsonas ado-yosysprerequisite.AGENTS.md(andCLAUDE.md, which links to it) gets one line pointing agents at the page, and the Developer's Guide anddocs/toc.ymllist it.Documentation only.
🤖 Generated with Claude Code