From f5b940541d3e3520cedfbdfba3b1ece7a854f908 Mon Sep 17 00:00:00 2001
From: dmitry <dmitry.puzyrkov@demlabs.net>
Date: Mon, 28 Aug 2023 16:05:34 +0700
Subject: [PATCH] ...

---
 build.sh | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/build.sh b/build.sh
index cf3f3f2..48d0c40 100755
--- a/build.sh
+++ b/build.sh
@@ -21,16 +21,18 @@ MHERE="$DIR"
 
 export SOURCES=${MHERE}/../
 
-case "${UNAME_OUT}" in
+NAME_OUT="$(uname -s)"
+case "${NAME_OUT}" in
     Linux*)     MACHINE=Linux;;
     Darwin*)    MACHINE=Mac;;
     CYGWIN*)    MACHINE=Cygwin;;
     MINGW*)     MACHINE=MinGw;;
     MSYS_NT*)   MACHINE=Git;;
-    *)          MACHINE="UNKNOWN:${UNAME_OUT}"
+    *)          MACHINE="UNKNOWN:${NAME_OUT}"
 esac
 
 
+
 #validate input params
 . ${MHERE}/validate.sh
 
@@ -68,7 +70,25 @@ set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
 BUILD_TYPE="${1:-release}"
 BUILD_OPTIONS="${@:2}"
 
-BUILD_TARGET="${TARGET:-linux}"
+
+DEFAULT_TARGET="linux"
+if [ "$MACHINE" == "Mac" ]
+then
+  DEFAULT_TARGET="osx"
+fi
+
+if [ "$MACHINE" == "Linux" ]
+then
+  DEFAULT_TARGET="linux"
+fi
+
+if [ "$MACHINE" == "Git" ]
+then
+  DEFAULT_TARGET="windows"
+fi
+
+echo "Host machin is $MACHINE"
+BUILD_TARGET="${TARGET:-$DEFAULT_TARGET}"
 
 BUILD_DIR=${PWD}/build_${BUILD_TARGET}_${BUILD_TYPE}
 
-- 
GitLab