Skip to content

Commit 1eab069

Browse files
committed
Fix missing nproc on macOS.
396979a breaks building on macOS: `nproc` is a Linux thing, use a cross-platform alternative.
1 parent c5d8c12 commit 1eab069

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

ports/atmel-samd/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ endif
197197

198198

199199
LDFLAGS = $(CFLAGS) -nostartfiles -Wl,-nostdlib -Wl,-T,$(GENERATED_LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
200-
LDFLAGS += -flto=$(shell nproc)
200+
LDFLAGS += -flto=$(shell $(NPROC))
201201
LIBS := -lgcc -lc
202202

203203
# Use toolchain libm if we're not using our own.

py/mkenv.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ PYTHON3 ?= python3
5555
RM = rm
5656
RSYNC = rsync
5757
SED = sed
58+
# Linux has 'nproc', macOS has 'sysctl -n hw.logicalcpu', this is cross-platform
59+
NPROC = $(PYTHON) -c 'import multiprocessing as mp; print(mp.cpu_count())'
5860

5961
AS = $(CROSS_COMPILE)as
6062
CC = $(CROSS_COMPILE)gcc

0 commit comments

Comments
 (0)