$NetBSD: patch-source_src_Makefile,v 1.3 2024/05/06 14:04:25 nia Exp $

- Do not force a compiler or CXXFLAGS.
- Do not hardcore -lX11 -lGL -lopenal since we want this to work on
  Darwin too.
- Attempt to fix missing symbols in the master server.
- Use LDFLAGS when linking.

--- source/src/Makefile.orig	2022-03-23 08:29:06.000000000 +0000
+++ source/src/Makefile
@@ -2,12 +2,6 @@
 # creating a seperate 'Makefile_local' file (this way, your changes aren't
 # accidentally commited to the AssaultCube repository).
 
-# AssaultCube now uses clang++ as a compiler, as there have been random crashes
-# found to have been caused by the g++ compiler in the past. This seems to have
-# been fixed now by relaxing the optimization that g++ does, so although we'll
-# continue using clang++ (just in case), you can use g++ if you prefer.
-CXX=clang++
-
 # call like 'DEBUGBUILD=1 make' to compile a debug version of AssaultCube.
 ifdef DEBUGBUILD
     ACDEBUG=yes
@@ -28,30 +22,11 @@ endif
 -include Makefile_local
 
 
-ifeq ($(ACDEBUG),yes)
-	CXXFLAGS= -O0
-	override CXXFLAGS+= -g -D_DEBUG
-endif
-
-ifneq (,$(findstring clang,$(CXX)))
-	CXXFLAGS= -O3 -fomit-frame-pointer
-	override CXXFLAGS+= -Wall -fsigned-char
-else
-	CXXFLAGS= -O3 -fomit-frame-pointer
-	override CXXFLAGS+= -Wall -fsigned-char -ffast-math -rdynamic -Wno-format-zero-length
-	ifeq "$(shell expr 'gcc -dumpversion' \>= 8)" "1"
-		override CXXFLAGS+= -Wno-stringop-truncation
-	endif
-endif
+CXXFLAGS+= -Wall -fsigned-char
 
 INCLUDES= -I. -Ibot -I../enet/include
 
 STRIP=
-ifeq (,$(findstring -g,$(CXXFLAGS)))
-ifeq (,$(findstring -pg,$(CXXFLAGS)))
-  STRIP=strip
-endif
-endif
 
 MV=mv
 ifneq (,$(findstring MINGW,$(PLATFORM)))
@@ -61,7 +36,7 @@ CLIENT_LIBS= -mwindows -L../lib -lSDL2 -
 else
 USRLIB=$(shell if [ -e /usr/lib64 ]; then echo "/usr/lib64"; else echo "/usr/lib"; fi)
 CLIENT_INCLUDES= $(INCLUDES) -I/usr/include `sdl2-config --cflags` -idirafter ../include
-CLIENT_LIBS= -L../enet/.libs -lenet -L$(USRLIB) -lX11 `sdl2-config --libs` -lSDL2_image -lz -lGL -lopenal -lvorbisfile
+CLIENT_LIBS= -L../enet/.libs -lenet -L$(USRLIB) `sdl2-config --libs` -lSDL2_image -lz -lvorbisfile
 endif
 
 CLIENT_OBJS= \
@@ -142,6 +117,8 @@ SERVER_OBJS= \
 	tools-standalone.o \
 	wizard-standalone.o
 MASTER_OBJS= \
+	tools-standalone.o \
+	protocol-standalone.o \
 	stream-standalone.o \
 	command-standalone.o \
 	master-standalone.o
@@ -202,12 +179,12 @@ server_install: server
 
 else
 client: libenet $(CLIENT_OBJS)
-	$(CXX) $(CXXFLAGS) -o ac_client $(CLIENT_OBJS) $(CLIENT_LIBS)
+	$(CXX) $(LDFLAGS) -o ac_client $(CLIENT_OBJS) $(CLIENT_LIBS)
 
 server: libenet $(SERVER_OBJS)
-	$(CXX) $(CXXFLAGS) -o ac_server $(SERVER_OBJS) $(SERVER_LIBS)
+	$(CXX) $(LDFLAGS) -o ac_server $(SERVER_OBJS) $(SERVER_LIBS)
 master: libenet $(MASTER_OBJS)
-	$(CXX) $(CXXFLAGS) -o ac_master $(MASTER_OBJS) $(SERVER_LIBS)
+	$(CXX) $(LDFLAGS) -o ac_master $(MASTER_OBJS) $(SERVER_LIBS)
 
 client_install: client
 	install -d ../../bin_unix/
