diff options
author | Joey Castillo <joeycastillo@utexas.edu> | 2022-08-02 08:17:26 -0600 |
---|---|---|
committer | Joey Castillo <joeycastillo@utexas.edu> | 2022-08-02 08:17:26 -0600 |
commit | bcd3b666848214a735f37a5a4f08b157ba7bb3a1 (patch) | |
tree | 149bd53bbd46ebddd31957cc827a7c40ccf6f1a0 /make.mk | |
parent | ed526355f69a931d51a6ebff1b45c70988e7b255 (diff) | |
parent | 6d87f5a6268a9a516d8c577dfd71b39a5bfc384a (diff) | |
download | Sensor-Watch-bcd3b666848214a735f37a5a4f08b157ba7bb3a1.tar.gz Sensor-Watch-bcd3b666848214a735f37a5a4f08b157ba7bb3a1.tar.bz2 Sensor-Watch-bcd3b666848214a735f37a5a4f08b157ba7bb3a1.zip |
Merge branch 'main' of github.com:joeycastillo/Sensor-Watch into 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 |