diff options
author | Joey Castillo <joeycastillo@utexas.edu> | 2022-08-03 10:57:39 -0700 |
---|---|---|
committer | Joey Castillo <joeycastillo@utexas.edu> | 2022-08-03 10:57:39 -0700 |
commit | 0c8a81bb5df099210c531bb793479403fab319b9 (patch) | |
tree | 9364ed8102f6f25c4447fdbc1260717c27f23a65 /make.mk | |
parent | cc4275694be97f365096eefb9b7513b41bcfdcd4 (diff) | |
parent | e790a025787e0e1aa59b98b95e194cf4318d1578 (diff) | |
download | Sensor-Watch-totp-lfs.tar.gz Sensor-Watch-totp-lfs.tar.bz2 Sensor-Watch-totp-lfs.zip |
Merge branch 'main' of github.com:joeycastillo/Sensor-Watch into totp-lfstotp-lfs
Diffstat (limited to 'make.mk')
-rw-r--r-- | make.mk | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -9,17 +9,43 @@ endif ############################################################################## .PHONY: all directory clean size +# OS detection, adapted from https://gist.github.com/sighingnow/deee806603ec9274fd47 +DETECTED_OS := +ifeq ($(OS),Windows_NT) + DETECTED_OS = WINDOWS +else + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Linux) + DETECTED_OS = LINUX + endif + ifeq ($(UNAME_S),Darwin) + DETECTED_OS = OSX + endif +endif +$(if ${VERBOSE},$(info OS detected: $(DETECTED_OS))) + ifeq ($(OS), Windows_NT) MKDIR = gmkdir 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 SIZE = arm-none-eabi-size -UF2 = python $(TOP)/utils/uf2conv.py +UF2 = python3 $(TOP)/utils/uf2conv.py CFLAGS += -W -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations CFLAGS += --std=gnu99 -Os |