Fix build on M1 Macs

This commit is contained in:
flatmapthatshit 2022-12-19 22:23:58 +00:00
parent 03f0199c8f
commit 9a480c3a42
No known key found for this signature in database
GPG Key ID: 3261334233D5E016
1 changed files with 17 additions and 18 deletions

View File

@ -112,26 +112,25 @@ endif
# macOS overrides
ifeq ($(HOST_OS),Darwin)
OSX_BUILD := 1
# Using Homebrew?
ifeq ($(shell which brew >/dev/null 2>&1 && echo y),y)
PLATFORM := $(shell uname -m)
OSX_GCC_VER = $(shell find `brew --prefix`/bin/gcc* | grep -oE '[[:digit:]]+' | sort -n | uniq | tail -1)
CC := gcc-$(OSX_GCC_VER)
CXX := g++-$(OSX_GCC_VER)
CPP := cpp-$(OSX_GCC_VER) -P
PLATFORM_CFLAGS := -I $(shell brew --prefix)/include
PLATFORM_LDFLAGS := -L $(shell brew --prefix)/lib
# Using MacPorts?
ifeq ($(shell test -d /opt/local/lib && echo y),y)
OSX_GCC_VER = $(shell find /opt/local/bin/gcc* | grep -oE '[[:digit:]]+' | sort -n | uniq | tail -1)
CC := gcc-mp-$(OSX_GCC_VER)
CXX := g++-mp-$(OSX_GCC_VER)
CPP := cpp-mp-$(OSX_GCC_VER) -P
PLATFORM_CFLAGS := -I /opt/local/include
PLATFORM_LDFLAGS := -L /opt/local/lib
else ifeq ($(shell test -d /opt/local/lib && echo y),y)
OSX_GCC_VER = $(shell find /opt/local/bin/gcc* | grep -oE '[[:digit:]]+' | sort -n | uniq | tail -1)
CC := gcc-mp-$(OSX_GCC_VER)
CXX := g++-mp-$(OSX_GCC_VER)
CPP := cpp-mp-$(OSX_GCC_VER) -P
PLATFORM_CFLAGS := -I /opt/local/include
PLATFORM_LDFLAGS := -L /opt/local/lib
else
# Using Homebrew?
ifeq ($(shell which brew >/dev/null 2>&1 && echo y),y)
OSX_GCC_VER = $(shell find `brew --prefix`/bin/gcc* | grep -oE '[[:digit:]]+' | sort -n | uniq | tail -1)
CC := gcc-$(OSX_GCC_VER)
CXX := g++-$(OSX_GCC_VER)
CPP := cpp-$(OSX_GCC_VER) -P
PLATFORM_CFLAGS := -I /usr/local/include
PLATFORM_LDFLAGS := -L /usr/local/lib
else
$(error No suitable macOS toolchain found, have you installed Homebrew?)
endif
$(error No suitable macOS toolchain found, have you installed Homebrew?)
endif
endif