From 0269681ac323bf09f130132454258d279c92f89f Mon Sep 17 00:00:00 2001 From: George Hahn Date: Tue, 10 May 2022 00:37:02 -0600 Subject: [PATCH] Perform OS detection in makefile --- make.mk | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/make.mk b/make.mk index ac5be77..d7fecd2 100644 --- 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