Skip to content

Commit b75b8b9

Browse files
committed
makefile: move more stuff into scripts/config.sh
Signed-off-by: Øyvind Harboe <[email protected]>
1 parent 27c3c0b commit b75b8b9

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

flow/Makefile

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -159,23 +159,8 @@ ifneq ($(BLOCKS),)
159159
endif
160160
endif
161161

162-
# Use locally installed and built klayout if it exists, otherwise use klayout in path
163-
KLAYOUT_DIR = $(abspath $(FLOW_HOME)/../tools/install/klayout/)
164-
KLAYOUT_BIN_FROM_DIR = $(KLAYOUT_DIR)/klayout
165-
166-
ifeq ($(wildcard $(KLAYOUT_BIN_FROM_DIR)), $(KLAYOUT_BIN_FROM_DIR))
167-
KLAYOUT_CMD ?= sh -c 'LD_LIBRARY_PATH=$(dir $(KLAYOUT_BIN_FROM_DIR)) $$0 "$$@"' $(KLAYOUT_BIN_FROM_DIR)
168-
else
169-
ifeq ($(KLAYOUT_CMD),)
170-
KLAYOUT_CMD := $(shell command -v klayout)
171-
endif
172-
endif
173162
KLAYOUT_FOUND = $(if $(KLAYOUT_CMD),,$(error KLayout not found in PATH))
174163

175-
ifneq ($(shell command -v stdbuf),)
176-
STDBUF_CMD ?= stdbuf -o L
177-
endif
178-
179164
#-------------------------------------------------------------------------------
180165
WRAPPED_LEFS = $(foreach lef,$(notdir $(WRAP_LEFS)),$(OBJECTS_DIR)/lef/$(lef:.lef=_mod.lef))
181166
WRAPPED_LIBS = $(foreach lib,$(notdir $(WRAP_LIBS)),$(OBJECTS_DIR)/$(lib:.lib=_mod.lib))

flow/scripts/config.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,21 @@ export OPENROAD_ARGS="-no_init -threads ${NUM_CORES} ${OR_ARGS}"
9292
export OPENROAD_CMD="${OPENROAD_EXE} -exit ${OPENROAD_ARGS}"
9393
export OPENROAD_NO_EXIT_CMD="${OPENROAD_EXE} ${OPENROAD_ARGS}"
9494
export OPENROAD_GUI_CMD="${OPENROAD_EXE} -gui ${OR_ARGS}"
95+
96+
# Use locally installed and built klayout if it exists, otherwise use klayout in path
97+
KLAYOUT_DIR="$(realpath "${FLOW_HOME}/../tools/install/klayout/")"
98+
KLAYOUT_BIN_FROM_DIR="${KLAYOUT_DIR}/klayout"
99+
100+
if [[ -x "${KLAYOUT_BIN_FROM_DIR}" ]]; then
101+
export KLAYOUT_CMD="sh -c 'LD_LIBRARY_PATH=$(dirname "${KLAYOUT_BIN_FROM_DIR}") \$0 \"\$@\"' ${KLAYOUT_BIN_FROM_DIR}"
102+
else
103+
if [[ -z "${KLAYOUT_CMD:-}" ]]; then
104+
KLAYOUT_CMD="$(command -v klayout || true)"
105+
fi
106+
fi
107+
export KLAYOUT_CMD
108+
109+
# Check if `stdbuf` is available and set STDBUF_CMD
110+
if command -v stdbuf &>/dev/null; then
111+
export STDBUF_CMD="stdbuf -o L"
112+
fi

0 commit comments

Comments
 (0)