From d76082f1f5c26e7ab98094e3b76e5a5304d97c86 Mon Sep 17 00:00:00 2001 From: rilysh Date: Tue, 4 Jun 2024 12:05:07 +0530 Subject: [PATCH] Makefile: add support to build ioq3 client on NetBSD --- Makefile | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f90c785c..663502e3 100644 --- a/Makefile +++ b/Makefile @@ -940,20 +940,77 @@ else # ifeq openbsd ############################################################################# ifeq ($(PLATFORM),netbsd) + BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \ + -pipe -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON + CLIENT_CFLAGS += $(SDL_CFLAGS) + + ALTIVEC_CFLAGS = + OPTIMIZEVM = -O3 + OPTIMIZE = $(OPTIMIZEVM) -ffast-math + + ifeq ($(ARCH),x86_64) + HAVE_VM_COMPILED = true + else + ifeq ($(ARCH),x86) + OPTIMIZE += -march=i586 + HAVE_VM_COMPILED=true + else + ifeq ($(ARCH),ppc) + ALTIVEC_CFLAGS = -maltivec + HAVE_VM_COMPILED=true + endif + ifeq ($(ARCH),ppc64) + ALTIVEC_CFLAGS = -maltivec + HAVE_VM_COMPILED=true + endif + ifeq ($(ARCH),sparc64) + OPTIMIZE += -mtune=ultrasparc3 -mv8plus + OPTIMIZEVM += -mtune=ultrasparc3 -mv8plus + HAVE_VM_COMPILED=true + endif + ifeq ($(ARCH),alpha) + # According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=410555 + # -ffast-math will cause the client to die with SIGFPE on Alpha + OPTIMIZE = $(OPTIMIZEVM) + endif + endif + endif + + BASE_CFLAGS += $(OPTIMIZE) $(ALTIVEC_CFLAGS) + + ifeq ($(USE_CURL),1) + CLIENT_CFLAGS += $(CURL_CFLAGS) + USE_CURL_DLOPEN=0 + endif + + # We can't pass it to the CLIENT_LIBS but after the all + # other arguments. Tested with GCC 10.5 on NetBSD 10. + USE_MUMBLE=0 - LIBS=-lm SHLIBEXT=so SHLIBCFLAGS=-fPIC SHLIBLDFLAGS=-shared $(LDFLAGS) + THREAD_LIBS=-lpthread + # Needs to link after the all other arguments + LIBS=-lm -lrt - BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes + CLIENT_LIBS = - ifeq ($(ARCH),x86) - HAVE_VM_COMPILED=true + CLIENT_LIBS += $(SDL_LIBS) + RENDERER_LIBS = $(SDL_LIBS) + + ifeq ($(USE_OPENAL),1) + ifneq ($(USE_OPENAL_DLOPEN),1) + CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS) + endif endif - BUILD_CLIENT = 0 + ifeq ($(USE_CURL),1) + ifneq ($(USE_CURL_DLOPEN),1) + CLIENT_LIBS += $(CURL_LIBS) + endif + endif else # ifeq netbsd #############################################################################