From 0ab63691f20eafe5544787b7c7d867925bae4eb8 Mon Sep 17 00:00:00 2001 From: George Hahn Date: Tue, 10 May 2022 00:37:37 -0600 Subject: Move parallel flag into makefile with crossplatform support --- make.mk | 11 +++++++++++ movement/make/make_alternate_fw.sh | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/make.mk b/make.mk index d7fecd20..3424f9c9 100644 --- a/make.mk +++ b/make.mk @@ -29,6 +29,17 @@ else MKDIR = mkdir endif +ifeq ($(DETECTED_OS), LINUX) + MAKEFLAGS += -j `nproc` +endif +ifeq ($(DETECTED_OS), OSX) + NPROCS = $(shell sysctl hw.ncpu | grep -o '[0-9]\+') + MAKEFLAGS += -j $(NPROCS) +endif +ifeq ($(DETECTED_OS), WINDOWS) + MAKEFLAGS += -j $(NUMBER_OF_PROCESSORS) +endif + ifndef EMSCRIPTEN CC = arm-none-eabi-gcc OBJCOPY = arm-none-eabi-objcopy diff --git a/movement/make/make_alternate_fw.sh b/movement/make/make_alternate_fw.sh index bd8154ef..575c9e52 100755 --- a/movement/make/make_alternate_fw.sh +++ b/movement/make/make_alternate_fw.sh @@ -22,11 +22,11 @@ do do COLOR=$(echo "$color" | tr '[:lower:]' '[:upper:]') make clean - make LED=$COLOR FIRMWARE=$VARIANT -j `nproc` + make LED=$COLOR FIRMWARE=$VARIANT mv "build/watch.uf2" "$fw_dir/$variant-$color.uf2" done make clean - emmake make FIRMWARE=$VARIANT -j `nproc` + emmake make FIRMWARE=$VARIANT mkdir "$sim_dir/$variant/" mv "build/watch.wasm" "$sim_dir/$variant/" mv "build/watch.js" "$sim_dir/$variant/" -- cgit v1.2.3