Skip to content

Commit 16dc694

Browse files
author
Ruohan Yan
committed
dont fail if cargo not found
1 parent 180c5e7 commit 16dc694

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

chipyard.mk

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,28 @@ CYCLOTRON_RS_SRCS = $(shell find $(CYCLOTRON_SRC_DIR)/src -name "*.rs")
1414
CYCLOTRON_CARGO_FILES = $(CYCLOTRON_SRC_DIR)/Cargo.toml \
1515
$(wildcard $(CYCLOTRON_SRC_DIR)/Cargo.lock)
1616

17+
# detect cargo at parse time
18+
HAVE_CARGO := $(shell command -v cargo >/dev/null 2>&1 && echo 1 || echo 0)
19+
1720
.PHONY: cyclotron
21+
ifeq ($(HAVE_CARGO),1)
22+
1823
cyclotron: $(CYCLOTRON_LIB)
1924

2025
$(CYCLOTRON_LIB): $(CYCLOTRON_RS_SRCS) $(CYCLOTRON_CARGO_FILES)
2126
cd $(CYCLOTRON_SRC_DIR) && cargo build # --release
2227

23-
EXTRA_SIM_REQS += | $(CYCLOTRON_LIB)
28+
EXTRA_SIM_REQS += | $(CYCLOTRON_LIB)
2429
EXTRA_SIM_LDFLAGS += -L$(CYCLOTRON_BUILD_DIR) -Wl,-rpath,$(CYCLOTRON_BUILD_DIR) -lcyclotron
2530

31+
else
32+
33+
# no cargo: don't try to build or link it
34+
cyclotron:
35+
@echo "cargo not found; skipping cyclotron build/link"
36+
37+
endif
38+
2639
EXT_INCDIRS += \
2740
$(base_dir)/generators/radiance/src/main/resources/vsrc/cvfpu/src/common_cells/include \
2841

0 commit comments

Comments
 (0)