]> git.earman.xyz Git - sensor-watch.git/commitdiff
Perform OS detection in makefile
authorGeorge Hahn <george.hahn.vhs@gmail.com>
Tue, 10 May 2022 06:37:02 +0000 (00:37 -0600)
committerGeorge Hahn <george.hahn.vhs@gmail.com>
Tue, 10 May 2022 06:37:02 +0000 (00:37 -0600)
make.mk

diff --git a/make.mk b/make.mk
index ac5be7752b3cc5696da8fb22595fba232e1d4d90..d7fecd20e0fa943ba9f61953f72eb95fad692323 100644 (file)
--- a/make.mk
+++ b/make.mk
@@ -9,7 +9,21 @@ endif
 ##############################################################################
 .PHONY: all directory clean size
 
-ifeq ($(OS), Windows_NT)
+# 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)))
+
   MKDIR = gmkdir
 else
   MKDIR = mkdir