Skip to content

Commit df79ba1

Browse files
committed
make: immediately expand deferred vars
Signed-off-by: Kimplul <[email protected]>
1 parent 0533e1f commit df79ba1

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

flow/scripts/variables.mk

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,16 @@ export NUM_CORES
7070

7171
#-------------------------------------------------------------------------------
7272
# setup all commands used within this flow
73-
export PYTHON_EXE ?= $(shell command -v python3)
73+
PYTHON_EXE ?= $(shell command -v python3)
74+
export PYTHON_EXE := $(PYTHON_EXE)
7475

7576
export TIME_BIN ?= env time
7677
TIME_CMD = $(TIME_BIN) -f 'Elapsed time: %E[h:]min:sec. CPU time: user %U sys %S (%P). Peak memory: %MKB.'
7778
TIME_TEST = $(shell $(TIME_CMD) echo foo 2>/dev/null)
7879
ifeq (,$(strip $(TIME_TEST)))
7980
TIME_CMD = $(TIME_BIN)
8081
endif
81-
export TIME_CMD
82+
export TIME_CMD := $(TIME_CMD)
8283

8384
# The following determine the executable location for each tool used by this flow.
8485
# Priority is given to
@@ -87,16 +88,19 @@ export TIME_CMD
8788
# 2.1 if in Nix shell: openroad, yosys from the environment
8889
# 2.2 ORFS compiled tools: openroad, yosys
8990
ifneq (${IN_NIX_SHELL},)
90-
export OPENROAD_EXE ?= $(shell command -v openroad)
91+
OPENROAD_EXE ?= $(shell command -v openroad)
9192
else
92-
export OPENROAD_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/openroad)
93+
OPENROAD_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/openroad)
9394
endif
9495
ifneq (${IN_NIX_SHELL},)
95-
export OPENSTA_EXE ?= $(shell command -v sta)
96+
OPENSTA_EXE ?= $(shell command -v sta)
9697
else
97-
export OPENSTA_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/sta)
98+
OPENSTA_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/sta)
9899
endif
99100

101+
export OPENROAD_EXE := $(OPENROAD_EXE)
102+
export OPENSTA_EXE := $(OPENSTA_EXE)
103+
100104
OPENROAD_IS_VALID := $(if $(OPENROAD_EXE),$(shell test -x $(OPENROAD_EXE) && echo "true"),)
101105

102106
export OPENROAD_ARGS = -no_init -threads $(NUM_CORES) $(OR_ARGS)
@@ -109,7 +113,8 @@ ifneq (${IN_NIX_SHELL},)
109113
else
110114
YOSYS_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/yosys/bin/yosys)
111115
endif
112-
export YOSYS_EXE
116+
117+
export YOSYS_EXE := $(YOSYS_EXE)
113118

114119
YOSYS_IS_VALID := $(if $(YOSYS_EXE),$(shell test -x $(YOSYS_EXE) && echo "true"),)
115120

@@ -118,13 +123,15 @@ KLAYOUT_DIR = $(abspath $(FLOW_HOME)/../tools/install/klayout/)
118123
KLAYOUT_BIN_FROM_DIR = $(KLAYOUT_DIR)/klayout
119124

120125
ifeq ($(wildcard $(KLAYOUT_BIN_FROM_DIR)), $(KLAYOUT_BIN_FROM_DIR))
121-
export KLAYOUT_CMD ?= sh -c 'LD_LIBRARY_PATH=$(dir $(KLAYOUT_BIN_FROM_DIR)) $$0 "$$@"' $(KLAYOUT_BIN_FROM_DIR)
126+
KLAYOUT_CMD ?= sh -c 'LD_LIBRARY_PATH=$(dir $(KLAYOUT_BIN_FROM_DIR)) $$0 "$$@"' $(KLAYOUT_BIN_FROM_DIR)
122127
else
123128
ifeq ($(KLAYOUT_CMD),)
124-
export KLAYOUT_CMD := $(shell command -v klayout)
129+
KLAYOUT_CMD ?= $(shell command -v klayout)
125130
endif
126131
endif
127132

133+
export KLAYOUT_CMD := $(KLAYOUT_CMD)
134+
128135
ifneq ($(shell command -v stdbuf),)
129136
STDBUF_CMD ?= stdbuf -o L
130137
endif

0 commit comments

Comments
 (0)