$OpenBSD: patch-makefile,v 1.16 2021/03/01 10:29:50 fcambus Exp $

- Disable hardcoded -O3 optimizations
- Fix GCC_VERSION and CLANG_VERSION detection

Index: makefile
--- makefile.orig
+++ makefile
@@ -211,7 +211,7 @@ GENIEOS := freebsd
 endif
 ifeq ($(firstword $(filter OpenBSD,$(UNAME))),OpenBSD)
 OS := openbsd
-GENIEOS := freebsd
+GENIEOS := bsd
 endif
 ifeq ($(firstword $(filter Darwin,$(UNAME))),Darwin)
 OS := macosx
@@ -617,11 +617,6 @@ PROFILER =
 SYMBOLS = 1
 endif
 
-# specify a default optimization level if none explicitly stated
-ifndef OPTIMIZE
-OPTIMIZE = 3
-endif
-
 # set the symbols level
 ifdef SYMBOLS
 PARAMS += --SYMBOLS='$(SYMBOLS)'
@@ -986,8 +981,8 @@ endif
 
 ifeq ($(OS),windows)
 ifeq (posix,$(SHELLTYPE))
-GCC_VERSION      := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> /dev/null)
-CLANG_VERSION    := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$$/\1/" | head -n 1)
+GCC_VERSION      := $(shell cc -dumpversion 2> /dev/null)
+CLANG_VERSION    := $(shell cc --version 2> /dev/null | head -n 1 | grep -e 'version [0-9]\.[0-9]\.[0-9]' -o | sed -e 's,version ,,' | tail -n 1)
 PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo python)
 GIT_AVAILABLE    := $(shell git --version > /dev/null 2>&1 && echo git)
 else
