Skip to content

Commit 5581e62

Browse files
committed
makefile: check openocd and set scripts root
set scripts root based on the openocd root seperate openocd and arc gnu Signed-off-by: Jingru Wang <jingru@synopsys.com>
1 parent 2d5ad2e commit 5581e62

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

options/scripts.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ ifeq "$(HOST_OS)" "Windows"
6060
ECHO=$(DOS_CMD) echo
6161
CP=copy /Y
6262
MKD = $(DOS_CMD) mkdir
63+
WHICH=where
6364

6465
IFEXISTDIR=$(DOS_CMD) if exist$(space)
6566
ENDIFEXISTDIR=$(space)
@@ -87,6 +88,7 @@ ifeq "$(HOST_OS)" "Cygwin"
8788
ECHO=echo
8889
CP=cp -rf
8990
MKD = mkdir -p
91+
WHICH=where
9092

9193
IFEXISTDIR=[ ! -d$(space)
9294
ENDIFEXISTDIR=$(space)] ||
@@ -114,6 +116,7 @@ ifeq "$(HOST_OS)" "GNU/Linux"
114116
ECHO=echo
115117
CP=cp
116118
MKD = mkdir -p
119+
WHICH=which
117120

118121
IFEXISTDIR=[ ! -d$(space)
119122
ENDIFEXISTDIR=$(space)] ||

options/toolchain/toolchain_gnu.mk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,12 @@ endif
148148
TCFGEN = tcfgen
149149
TCFTOOL = tcftool
150150

151-
OPENOCD_SCRIPT_ROOT = $(dir $(shell $(CC) --print-prog-name=ld))../../share/openocd/scripts
151+
OPENOCD_EXECUTABLE_ROOT = $(dir $(shell $(WHICH) openocd))
152+
ifeq ($(OPENOCD_EXECUTABLE_ROOT), )
153+
$(error "Tool openocd - openocd doesn't exist, please install it!")
154+
else
155+
OPENOCD_SCRIPT_ROOT = $(OPENOCD_EXECUTABLE_ROOT)/share/openocd/scripts
156+
endif
152157

153158
## Don't change this line
154159
override OPENOCD_SCRIPT_ROOT := $(subst \,/, $(strip $(OPENOCD_SCRIPT_ROOT)))

0 commit comments

Comments
 (0)