$OpenBSD: patch-uquake_Makefile_in,v 1.2 2008/01/11 16:48:44 ajacoutot Exp $
--- uquake/Makefile.in.orig	Fri Jan 11 17:46:13 2008
+++ uquake/Makefile.in	Fri Jan 11 17:46:15 2008
@@ -16,9 +16,10 @@ mandir      = @mandir@
 COMMON_DIR=$(PROJECT_DIR)/common
 BUILD_DIR =../targets/uquake
 
-LDFLAGS = @LDFLAGS@ @SND_LIBS@ -lm -L/usr/local/v6/lib -linet6
+LDFLAGS = @LDFLAGS@ @SND_LIBS@ -lm
 LIBS = @LIBS@
 CC = @CC@
+CC_GL = @CC@ -pthread
 INTEL_ARCH = @INTEL_ARCH@
 
 ifneq ($(SRC_DIR),.)
@@ -76,7 +77,7 @@ RELEASE = @RELEASE@
 ifeq ($(RELEASE),yes)
 OPTFLAGS = @RELEASE_CFLAGS@
 else
-OPTFLAGS = -g
+OPTFLAGS =
 endif
 
 targets       = $(GGIQUAKE) $(SVGAQUAKE) $(GLQUAKE) $(TDFXQUAKE) $(X11QUAKE) $(SDLQUAKE)
@@ -124,6 +125,9 @@ endif
 ifeq ($(SND_STYLE),OSS)
 SND_SRC = snd_dma.c snd_oss.c
 endif
+ifeq ($(SND_STYLE),OpenBSD)
+SND_SRC = snd_dma.c snd_openbsd.c
+endif
 ifeq ($(SND_STYLE),Solaris)
 SND_SRC = snd_dma.c snd_sun.c
 endif
@@ -195,7 +199,7 @@ CL_COMMON_SRC = $(MISC_SRC) $(CL_GUI_SRC) $(CL_SRC) \
 # Directory specific stuff
 #
 DEFS         = @DEFS@
-CFLAGS       = @CFLAGS@ $(OPTFLAGS) $(DEFS) -I. $(SRC_DIR_INC) \
+CFLAGS       += @CFLAGS@ -g $(OPTFLAGS) $(DEFS) -I. $(SRC_DIR_INC) \
 -I$(COMMON_DIR) -I$(SRC_DIR)/include
 ALL_X11_SRC  = $(GENERAL_SRC) $(SW_REND_SRC) $(X11_VID_SRC) model.c
 ALL_GL_SRC   = $(GENERAL_SRC) $(GL_REND_SRC) $(GL_VID_SRC)
@@ -236,7 +240,7 @@ $(BUILD_DIR)/x11/%.o: $(SRC_DIR)/%.c
 
 $(BUILD_DIR)/x11/%.o: $(SRC_DIR)/%.s
 	$(MAKE_SURE_x11_DIR)
-	$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+	$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
 
 $(BUILD_DIR)/x11/%.o: $(COMMON_DIR)/%.c
 	$(MAKE_SURE_x11_DIR)
@@ -244,7 +248,7 @@ $(BUILD_DIR)/x11/%.o: $(COMMON_DIR)/%.c
 
 $(BUILD_DIR)/x11/%.o: $(COMMON_DIR)/%.s
 	$(MAKE_SURE_x11_DIR)
-	$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+	$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
 
 $(X11QUAKE): $(BUILD_DIR)/../$(X11QUAKE)
 
@@ -283,7 +287,7 @@ $(BUILD_DIR)/svga/%.o: $(SRC_DIR)/%.c
 
 $(BUILD_DIR)/svga/%.o: $(SRC_DIR)/%.s
 	$(MAKE_SURE_svga_DIR)
-	$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+	$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
 
 $(BUILD_DIR)/svga/%.o: $(COMMON_DIR)/%.c
 	$(MAKE_SURE_svga_DIR)
@@ -291,7 +295,7 @@ $(BUILD_DIR)/svga/%.o: $(COMMON_DIR)/%.c
 
 $(BUILD_DIR)/svga/%.o: $(COMMON_DIR)/%.s
 	$(MAKE_SURE_svga_DIR)
-	$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+	$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
 
 $(SVGAQUAKE): $(BUILD_DIR)/../$(SVGAQUAKE)
 
@@ -313,7 +317,7 @@ ALL_GGI_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(GGI_VID_
 OBJSquake-ggi = $(patsubst %,$(BUILD_DIR)/ggi/%,$(addsuffix .@OBJEXT@, $(basename $(ALL_GGI_SRC) .c .s)))
 
 GGI_CFLAGS  = -DGGI @GGI_CFLAGS@
-GGI_LDFLAGS = @GGI_LIBS@
+GGI_LDFLAGS = -pthread @GGI_LIBS@
 GGI_VID_SRC = vid_ggi.c
 
 # This can be thought of as a macro that makes sure that the ggi
@@ -327,7 +331,7 @@ $(BUILD_DIR)/ggi/%.o: $(SRC_DIR)/%.c
 
 $(BUILD_DIR)/ggi/%.o: $(SRC_DIR)/%.s
 	$(MAKE_SURE_ggi_DIR)
-	$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+	$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
 
 $(BUILD_DIR)/ggi/%.o: $(COMMON_DIR)/%.c
 	$(MAKE_SURE_ggi_DIR)
@@ -335,7 +339,7 @@ $(BUILD_DIR)/ggi/%.o: $(COMMON_DIR)/%.c
 
 $(BUILD_DIR)/ggi/%.o: $(COMMON_DIR)/%.s
 	$(MAKE_SURE_ggi_DIR)
-	$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+	$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
 
 $(GGIQUAKE): $(BUILD_DIR)/../$(GGIQUAKE)
 
@@ -365,24 +369,24 @@ MAKE_SURE_gl_DIR = @DIR=gl; $(MAKE_SURE_DIR)
 
 $(BUILD_DIR)/gl/%.o: $(SRC_DIR)/%.c
 	$(MAKE_SURE_gl_DIR)
-	$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
+	$(CC_GL) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
 
 $(BUILD_DIR)/gl/%.o: $(SRC_DIR)/%.s
 	$(MAKE_SURE_gl_DIR)
-	$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+	$(CC_GL) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
 
 $(BUILD_DIR)/gl/%.o: $(COMMON_DIR)/%.c
 	$(MAKE_SURE_gl_DIR)
-	$(CC) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
+	$(CC_GL) $(CFLAGS) $(GL_CFLAGS) -o $@ -c $<
 
 $(BUILD_DIR)/gl/%.o: $(COMMON_DIR)/%.s
 	$(MAKE_SURE_gl_DIR)
-	$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+	$(CC_GL) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
 
 $(GLQUAKE): $(BUILD_DIR)/../$(GLQUAKE)
 
 $(BUILD_DIR)/../$(GLQUAKE): $(OBJSquake-gl)
-	$(CC) $(CFLAGS) $(OBJSquake-gl) $(GL_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(GLQUAKE)
+	$(CC_GL) $(CFLAGS) $(OBJSquake-gl) $(GL_LDFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/../$(GLQUAKE)
 
 # XXX - Can this be automated?
 clean-$(GLQUAKE):
@@ -411,7 +415,7 @@ $(BUILD_DIR)/3dfx/%.o: $(SRC_DIR)/%.c
 
 $(BUILD_DIR)/3dfx/%.o: $(SRC_DIR)/%.s
 	$(MAKE_SURE_3dfx_DIR)
-	$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+	$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
 
 $(BUILD_DIR)/3dfx/%.o: $(COMMON_DIR)/%.c
 	$(MAKE_SURE_3dfx_DIR)
@@ -419,7 +423,7 @@ $(BUILD_DIR)/3dfx/%.o: $(COMMON_DIR)/%.c
 
 $(BUILD_DIR)/3dfx/%.o: $(COMMON_DIR)/%.s
 	$(MAKE_SURE_gl_DIR)
-	$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+	$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
 
 $(TDFXQUAKE): $(BUILD_DIR)/../$(TDFXQUAKE)
 
@@ -455,7 +459,7 @@ $(BUILD_DIR)/sdl/%.o: $(SRC_DIR)/%.c
 
 $(BUILD_DIR)/sdl/%.o: $(SRC_DIR)/%.s
 	$(MAKE_SURE_sdl_DIR)
-	$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+	$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
 
 $(BUILD_DIR)/sdl/%.o: $(COMMON_DIR)/%.c
 	$(MAKE_SURE_sdl_DIR)
@@ -463,7 +467,7 @@ $(BUILD_DIR)/sdl/%.o: $(COMMON_DIR)/%.c
 
 $(BUILD_DIR)/sdl/%.o: $(COMMON_DIR)/%.s
 	$(MAKE_SURE_sdl_DIR)
-	$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+	$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
 
 $(SDLQUAKE): $(BUILD_DIR)/../$(SDLQUAKE)
 
@@ -489,7 +493,7 @@ clean: $(CLEAN_TARGETS)
 install: $(targets)
 	$(PROJECT_DIR)/mkinstalldirs $(DESTDIR)$(prefix)$(bindir)
 	for i in $(targets); do \
-	   $(PROJECT_DIR)/install-sh -m 755 $(BUILD_DIR)/../$$i \
+	   $(PROJECT_DIR)/install-sh -s -m 755 $(BUILD_DIR)/../$$i \
 	     $(DESTDIR)$(prefix)$(bindir)/$$i; \
 	done
 
