mirror of
https://github.com/sm64pc/sm64ex.git
synced 2025-01-22 15:43:04 -05:00
Fix compilation on Apple silicon (#512)
* Fix build on M1 Macs * Fix race conditions on parallel builds
This commit is contained in:
parent
03f0199c8f
commit
afc7e8da69
1 changed files with 18 additions and 19 deletions
23
Makefile
23
Makefile
|
@ -112,28 +112,27 @@ 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)
|
||||
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
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(TARGET_BITS),0)
|
||||
BITS := -m$(TARGET_BITS)
|
||||
|
@ -266,7 +265,7 @@ endif
|
|||
endif
|
||||
|
||||
# Make tools if out of date
|
||||
DUMMY != CC=$(CC) CXX=$(CXX) $(MAKE) -C tools >&2 || echo FAIL
|
||||
DUMMY != CC=$(CC) CXX=$(CXX) $(MAKE) -C tools -j1 >&2 || echo FAIL
|
||||
ifeq ($(DUMMY),FAIL)
|
||||
$(error Failed to build tools)
|
||||
endif
|
||||
|
|
Loading…
Reference in a new issue