Skip to content

Commit 941fc18

Browse files
committed
Add nproc equivalent for macOS
Add hw.logicalcpu for NUM_PROCS functional parrarel run to Makefile. hw.logicalcpu is equivalent of nproc on macOS
1 parent d4373be commit 941fc18

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,13 @@ golangci-lint:
188188
$(LOCALBIN)/golangci-lint run --fix
189189

190190
MAX_PROCS := 5
191+
UNAME_S := $(shell uname -s)
192+
ifeq ($(UNAME_S),Linux)
191193
NUM_PROCS := $(shell expr $(shell nproc --ignore 2) / 2)
194+
endif
195+
ifeq ($(UNAME_S),Darwin)
196+
NUM_PROCS := $(shell expr $(shell sysctl -n hw.logicalcpu) / 2)
197+
endif
192198
PROCS ?= $(shell if [ $(NUM_PROCS) -gt $(MAX_PROCS) ]; then echo $(MAX_PROCS); else echo $(NUM_PROCS); fi)
193199
PROC_CMD = --procs $(PROCS)
194200

0 commit comments

Comments
 (0)