summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Walther <cwalther@gmx.ch>2020-10-20 16:37:24 +0200
committerChristian Walther <cwalther@gmx.ch>2020-10-20 16:39:32 +0200
commit1eab0692b50f05f6b8194897386cda7720634fe6 (patch)
tree28dac069ab2540f64bf59fd78351378b9f8dcadc
parentc5d8c12e342f8fd904bfdbfb1175860bc03f6416 (diff)
Fix missing `nproc` on macOS.
396979a breaks building on macOS: `nproc` is a Linux thing, use a cross-platform alternative.
-rw-r--r--ports/atmel-samd/Makefile2
-rw-r--r--py/mkenv.mk2
2 files changed, 3 insertions, 1 deletions
diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile
index 2593377eb..111f12b4e 100644
--- a/ports/atmel-samd/Makefile
+++ b/ports/atmel-samd/Makefile
@@ -197,7 +197,7 @@ endif
LDFLAGS = $(CFLAGS) -nostartfiles -Wl,-nostdlib -Wl,-T,$(GENERATED_LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs
-LDFLAGS += -flto=$(shell nproc)
+LDFLAGS += -flto=$(shell $(NPROC))
LIBS := -lgcc -lc
# Use toolchain libm if we're not using our own.
diff --git a/py/mkenv.mk b/py/mkenv.mk
index b76dd60f8..cb678e8e7 100644
--- a/py/mkenv.mk
+++ b/py/mkenv.mk
@@ -55,6 +55,8 @@ PYTHON3 ?= python3
RM = rm
RSYNC = rsync
SED = sed
+# Linux has 'nproc', macOS has 'sysctl -n hw.logicalcpu', this is cross-platform
+NPROC = $(PYTHON) -c 'import multiprocessing as mp; print(mp.cpu_count())'
AS = $(CROSS_COMPILE)as
CC = $(CROSS_COMPILE)gcc