Skip to content

Commit a0e3cf7

Browse files
An ZhongAn Zhong
authored andcommitted
Bound Verilator build parallelism
1 parent e788fd6 commit a0e3cf7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/init/verilator.inc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
.PHONY: build-verilator clean-verilator patch-verilator
55

6+
# Bound Verilator parallelism so hosted CI runners do not get swamped by an
7+
# unlimited "make -j" build. Allow callers to override when needed.
8+
VERILATOR_BUILD_JOBS ?= $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)
9+
610
# Patch target for verilator
711
patch-verilator: 3rd-party/verilator/.patch-applied
812

@@ -27,10 +31,11 @@ build-verilator: 3rd-party/verilator/.verilator-built
2731
else \
2832
echo "Building Verilator..."; \
2933
echo "Installing Verilator by building it from source..."; \
34+
echo "Using $(VERILATOR_BUILD_JOBS) parallel job(s) for Verilator build..."; \
3035
cd 3rd-party/verilator && \
3136
autoconf && \
3237
./configure && \
33-
make -j; \
38+
$(MAKE) -j$(VERILATOR_BUILD_JOBS); \
3439
echo "Verilator build completed successfully."; \
3540
touch $(CURDIR)/$@; \
3641
fi

0 commit comments

Comments
 (0)