$NetBSD: patch-Makefile,v 1.2 2023/01/15 05:36:38 mrg Exp $ - Add support for NetBSD-style uname. - Build client on NetBSD. - Pass ARCH_STRING on *BSD so multi-arch support works. https://github.com/ioquake/ioq3/pull/466 - Add -lrt on NetBSD that binutils 2.39 wants. --- Makefile.orig 2019-12-07 05:16:15.000000000 -0800 +++ Makefile 2023-01-14 18:34:38.285233929 -0800 @@ -6,8 +6,8 @@ COMPILE_PLATFORM=$(shell uname | sed -e 's/_.*//' | tr '[:upper:]' '[:lower:]' | sed -e 's/\//_/g') COMPILE_ARCH=$(shell uname -m | sed -e 's/i.86/x86/' | sed -e 's/^arm.*/arm/') -ifeq ($(COMPILE_PLATFORM),sunos) - # Solaris uname and GNU uname differ +ifneq (,$(findstring "$(COMPILE_PLATFORM)", "sunos" "netbsd")) + # Solaris/NetBSD uname and GNU uname differ COMPILE_ARCH=$(shell uname -p | sed -e 's/i.86/x86/') endif @@ -65,6 +65,10 @@ MINGW=1 endif +ifeq ($(COMPILE_ARCH),i386) + COMPILE_ARCH=x86 +endif + ifeq ($(COMPILE_ARCH),i86pc) COMPILE_ARCH=x86 endif @@ -338,7 +342,7 @@ EXTRA_FILES= CLIENT_EXTRA_FILES= -ifneq (,$(findstring "$(COMPILE_PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu")) +ifneq (,$(findstring "$(COMPILE_PLATFORM)", "linux" "freebsd" "netbsd" "openbsd" "dragonfly" "gnu_kfreebsd" "kfreebsd-gnu" "gnu")) TOOLS_CFLAGS += -DARCH_STRING=\"$(COMPILE_ARCH)\" endif @@ -712,7 +716,7 @@ # flags BASE_CFLAGS = \ -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ - -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON + -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON -DARCH_STRING=\\\"$(ARCH)\\\" CLIENT_CFLAGS += $(SDL_CFLAGS) HAVE_VM_COMPILED = true @@ -766,7 +770,7 @@ ifeq ($(PLATFORM),openbsd) BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ - -pipe -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON + -pipe -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON -DARCH_STRING=\\\"$(ARCH)\\\" CLIENT_CFLAGS += $(SDL_CFLAGS) OPTIMIZEVM = -O3 @@ -846,15 +850,34 @@ SHLIBEXT=so SHLIBCFLAGS=-fPIC SHLIBLDFLAGS=-shared $(LDFLAGS) - THREAD_LIBS=-lpthread + THREAD_LIBS=-lpthread -lrt + + BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ + -pipe -DUSE_ICON -DARCH_STRING=\\\"$(ARCH)\\\" - BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes + CLIENT_LIBS += $(SDL_LIBS) + RENDERER_LIBS = $(SDL_LIBS) + + # optional features/libraries + ifeq ($(USE_OPENAL),1) + ifeq ($(USE_OPENAL_DLOPEN),1) + CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS) + endif + endif + + ifeq ($(USE_CURL),1) + CLIENT_CFLAGS += $(CURL_CFLAGS) + ifeq ($(USE_CURL_DLOPEN),1) + CLIENT_LIBS += $(CURL_LIBS) + endif + endif ifeq ($(ARCH),x86) HAVE_VM_COMPILED=true endif - - BUILD_CLIENT = 0 + ifeq ($(ARCH),x86_64) + HAVE_VM_COMPILED=true + endif else # ifeq netbsd #############################################################################