Update Makefile

This commit is contained in:
AndratVA 2023-03-10 01:54:20 -05:00
parent 8d4c2d2eb5
commit 648b85dbb6

View File

@ -113,6 +113,35 @@ ifneq ($(TARGET_BITS),0)
BITS := -m$(TARGET_BITS) BITS := -m$(TARGET_BITS)
endif 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?
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
$(error No suitable macOS toolchain found, have you installed Homebrew?)
endif
endif
ifneq ($(TARGET_BITS),0)
BITS := -m$(TARGET_BITS)
endif
# Release (version) flag defs # Release (version) flag defs
ifeq ($(VERSION),jp) ifeq ($(VERSION),jp)