Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,13 @@ golangci-lint:
$(LOCALBIN)/golangci-lint run --fix

MAX_PROCS := 5
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
NUM_PROCS := $(shell expr $(shell nproc --ignore 2) / 2)
endif
ifeq ($(UNAME_S),Darwin)
NUM_PROCS := $(shell expr $(shell sysctl -n hw.logicalcpu) / 2)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was personally just installing coreutils from homebrew, which contains nproc:

❯ nproc --ignore 2
8
❯ uname -s
Darwin

Which comes from:
https://formulae.brew.sh/formula/coreutils
https://github.com/coreutils/coreutils/blob/037b93106155c5e11681837305b541808fbdb9b5/src/nproc.c

endif
PROCS ?= $(shell if [ $(NUM_PROCS) -gt $(MAX_PROCS) ]; then echo $(MAX_PROCS); else echo $(NUM_PROCS); fi)
PROC_CMD = --procs $(PROCS)

Expand Down