Skip to content

Commit 807e96b

Browse files
committed
makefile: reduce number of shell invocations
While debugging a problem, I discovered that I can list all the shell commands run in make using the command below. Modified Makefile so that klayout version is resolved once instead of many times. make ".SHELLFLAGS=--verbose -o pipefail -c" open_synth Signed-off-by: Øyvind Harboe <[email protected]>
1 parent a40a953 commit 807e96b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

flow/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,9 @@ KLAYOUT_BIN_FROM_DIR = $(KLAYOUT_DIR)/klayout
312312
ifeq ($(wildcard $(KLAYOUT_BIN_FROM_DIR)), $(KLAYOUT_BIN_FROM_DIR))
313313
KLAYOUT_CMD ?= sh -c 'LD_LIBRARY_PATH=$(dir $(KLAYOUT_BIN_FROM_DIR)) $$0 "$$@"' $(KLAYOUT_BIN_FROM_DIR)
314314
else
315-
KLAYOUT_CMD ?= $(shell command -v klayout)
315+
ifeq ($(KLAYOUT_CMD),)
316+
KLAYOUT_CMD := $(shell command -v klayout)
317+
endif
316318
endif
317319
KLAYOUT_FOUND = $(if $(KLAYOUT_CMD),,$(error KLayout not found in PATH))
318320

@@ -404,7 +406,7 @@ do-klayout_tech:
404406
cp $(TECH_LEF) $(OBJECTS_DIR)/klayout_tech.lef
405407

406408
KLAYOUT_ENV_VAR_IN_PATH_VERSION = 0.28.11
407-
KLAYOUT_VERSION = $(shell $(KLAYOUT_CMD) -v 2>/dev/null | grep 'KLayout' | cut -d ' ' -f2)
409+
KLAYOUT_VERSION := $(shell $(KLAYOUT_CMD) -v 2>/dev/null | grep 'KLayout' | cut -d ' ' -f2)
408410

409411
KLAYOUT_ENV_VAR_IN_PATH = $(shell \
410412
if [ -z "$(KLAYOUT_VERSION)" ]; then \

0 commit comments

Comments
 (0)