Skip to content

make: preserve tool *_EXE env vars across UNSET_AND_MAKE#4159

Open
oharboe wants to merge 2 commits intoThe-OpenROAD-Project:masterfrom
oharboe:fix-openroad-exe
Open

make: preserve tool *_EXE env vars across UNSET_AND_MAKE#4159
oharboe wants to merge 2 commits intoThe-OpenROAD-Project:masterfrom
oharboe:fix-openroad-exe

Conversation

@oharboe
Copy link
Copy Markdown
Collaborator

@oharboe oharboe commented Apr 17, 2026

Commit df79ba1 ("make: immediately expand deferred vars") changed the tool-path setup from

export OPENROAD_EXE ?= $(abspath ...)

to

OPENROAD_EXE ?= $(abspath ...)
export OPENROAD_EXE := $(OPENROAD_EXE)

The := reassign gives the variable origin "file" even when the value was supplied through the environment. UNSET_VARIABLES_NAMES collects every file-origin variable and $(UNSET_AND_MAKE) unsets them in the bash wrapper before invoking the submake. That strips a caller- supplied OPENROAD_EXE / OPENSTA_EXE / YOSYS_EXE from the submake's environment, and variables.mk re-derives them via the $(FLOW_HOME)/../tools/install/... fallback — a path that does not exist in hermetic builds (e.g. bazel-orfs).

Extend the unset exclusion list to cover OPENROAD%, OPENSTA%, YOSYS%, mirroring the KLAYOUT% entry already there for the same reason.

This restores the pre-df79ba1d9 behavior for callers that pass tool paths through the environment, without reverting the immediate- expansion fix.

Commit df79ba1 ("make: immediately expand deferred vars") changed
the tool-path setup from

    export OPENROAD_EXE ?= $(abspath ...)

to

    OPENROAD_EXE ?= $(abspath ...)
    export OPENROAD_EXE := $(OPENROAD_EXE)

The := reassign gives the variable origin "file" even when the value
was supplied through the environment. UNSET_VARIABLES_NAMES collects
every file-origin variable and $(UNSET_AND_MAKE) unsets them in the
bash wrapper before invoking the submake. That strips a caller-
supplied OPENROAD_EXE / OPENSTA_EXE / YOSYS_EXE from the submake's
environment, and variables.mk re-derives them via the
$(FLOW_HOME)/../tools/install/... fallback — a path that does not
exist in hermetic builds (e.g. bazel-orfs).

Extend the unset exclusion list to cover OPENROAD%, OPENSTA%, YOSYS%,
mirroring the KLAYOUT% entry already there for the same reason.

This restores the pre-df79ba1d9 behavior for callers that pass tool
paths through the environment, without reverting the immediate-
expansion fix.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe oharboe requested a review from maliberty April 17, 2026 16:10
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the variable exclusion list in flow/scripts/variables.mk to include OPENROAD%, OPENSTA%, and YOSYS%, which prevents these tool-related variables from being unset during sub-make calls. A review comment suggests also adding PYTHON% to this list to ensure that user-provided PYTHON_EXE overrides are preserved when the variable is re-assigned within the Makefile.

Comment thread flow/scripts/variables.mk Outdated
PYTHON_EXE follows the same `?=` then `export := $(PYTHON_EXE)` pattern
as OPENROAD_EXE / OPENSTA_EXE / YOSYS_EXE, so a caller-supplied value is
similarly stripped by UNSET_AND_MAKE because the re-export gives it
origin "file". Add PYTHON% to the exclusion list alongside the other
tool prefixes.

Addresses gemini-code-assist review feedback on PR The-OpenROAD-Project#4159.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
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