From 473b2ca078af7c6d5e88a9b28b49d79c6f00bd9d Mon Sep 17 00:00:00 2001 From: Henk Date: Fri, 14 Jun 2024 17:10:51 +0200 Subject: [PATCH] Update Makefile to build on Apple Silicon --- Makefile | 9 +++++++-- stuff/cmake/modules/FindSDL2.cmake | 7 ++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 7a7598f7..58407ceb 100644 --- a/Makefile +++ b/Makefile @@ -299,6 +299,8 @@ else ifeq ($(YQ2_OSTYPE),OpenBSD) INCLUDE ?= -I/usr/local/include else ifeq ($(YQ2_OSTYPE),Windows) INCLUDE ?= -I/usr/include +else ifeq ($(YQ2_OSTYPE),Darwin) +INCLUDE ?= -I/usr/local/include -I/opt/homebrew/include endif # ---------- @@ -314,6 +316,8 @@ else ifeq ($(YQ2_OSTYPE),OpenBSD) LDFLAGS ?= -L/usr/local/lib else ifeq ($(YQ2_OSTYPE),Windows) LDFLAGS ?= -L/usr/lib +else ifeq ($(YQ2_OSTYPE),Darwin) +LDFLAGS ?= -L/usr/local/lib -L/opt/homebrew/lib endif # Link address sanitizer if requested. @@ -492,8 +496,9 @@ ifeq ($(WITH_OPENAL),yes) ifeq ($(YQ2_OSTYPE), OpenBSD) release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so"' else ifeq ($(YQ2_OSTYPE), Darwin) -release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.dylib"' -I/usr/local/opt/openal-soft/include -release/quake2 : LDFLAGS += -L/usr/local/opt/openal-soft/lib -rpath /usr/local/opt/openal-soft/lib +OPENAL_PATH ?= $(shell brew --prefix openal-soft) +release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.dylib"' -I$(OPENAL_PATH)/include +release/quake2 : LDFLAGS += -L$(OPENAL_PATH)/lib -rpath $(OPENAL_PATH)/lib else release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so.1"' endif diff --git a/stuff/cmake/modules/FindSDL2.cmake b/stuff/cmake/modules/FindSDL2.cmake index a6536e1c..99a02d90 100644 --- a/stuff/cmake/modules/FindSDL2.cmake +++ b/stuff/cmake/modules/FindSDL2.cmake @@ -73,6 +73,7 @@ SET(SDL2_SEARCH_PATHS /usr/local /usr /sw # Fink + /opt/homebrew # Homebrew /opt/local # DarwinPorts /opt/csw # Blastwave /opt @@ -87,11 +88,11 @@ FIND_PATH(SDL2_INCLUDE_DIR SDL.h PATHS ${SDL2_SEARCH_PATHS} ) -if(CMAKE_SIZEOF_VOID_P EQUAL 8) +if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(PATH_SUFFIXES lib64 lib/x64 lib) -else() +else() set(PATH_SUFFIXES lib/x86 lib) -endif() +endif() FIND_LIBRARY(SDL2_LIBRARY_TEMP NAMES SDL2