From 5e73cbed20db799d0b0dffe8f8920b784f13e83c Mon Sep 17 00:00:00 2001 From: Andrew Malchuk Date: Wed, 16 Oct 2024 23:54:59 +0400 Subject: [PATCH] Update Makefile to build on Apple Silicon --- Makefile | 21 ++++++++++++++++++++- README.md | 8 ++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b01831b..94ae8df 100644 --- a/Makefile +++ b/Makefile @@ -285,6 +285,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 # ---------- @@ -300,6 +302,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. @@ -409,7 +413,17 @@ ref_gl4: release/ref_gl4.dll : GLAD_INCLUDE = -Isrc/client/refresh/gl4/glad/include release/ref_gl4.dll : LDFLAGS += -shared -else # not Windows or Darwin - macOS doesn't support OpenGL 4.6 +else ifeq ($(YQ2_OSTYPE), Darwin) + +ref_gl4: + @echo "===> Building ref_gl4.dylib" + ${Q}mkdir -p release + $(MAKE) release/ref_gl4.dylib + +release/ref_gl4.dylib : GLAD_INCLUDE = -Isrc/client/refresh/gl4/glad/include +release/ref_gl4.dylib : LDFLAGS += -shared + +else # not Windows or Darwin ref_gl4: @echo "===> Building ref_gl4.so" @@ -485,6 +499,11 @@ release/ref_gl4.dll : $(REFGL4_OBJS) ${Q}$(CC) $(LDFLAGS) $(REFGL4_OBJS) $(LDLIBS) $(DLL_SDLLDFLAGS) -o $@ $(Q)strip $@ +else ifeq ($(YQ2_OSTYPE), Darwin) +release/ref_gl4.dylib : $(REFGL4_OBJS) + @echo "===> LD $@" + ${Q}$(CC) $(LDFLAGS) $(REFGL4_OBJS) $(LDLIBS) $(SDLLDFLAGS) -o $@ + else release/ref_gl4.so : $(REFGL4_OBJS) @echo "===> LD $@" diff --git a/README.md b/README.md index d1ea7d8..708ce89 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,14 @@ Type `make` to compile the library. If the compilation is successfull, the library can be found under *release/ref_gl4.dll* (Windows) or *release/ref_gl4.so* (unixoid systems). +## Supported platforms + +* FreeBSD +* Linux +* NetBSD +* OpenBSD +* Windows + ## Usage Copy the library next to your Yamagi Quake II executable. You can select