aboutsummaryrefslogtreecommitdiff
path: root/games/nehquake/files/patch-Makefile
blob: 1d40a6b42932d08427fd6f57fccf8af59601828a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
--- Makefile.orig	Sat May 27 13:47:34 2006
+++ Makefile	Sat May 27 14:04:12 2006
@@ -9,9 +9,9 @@
 #
 
 BASEVERSION=1.09
-VERSION=$(BASEVERSION)$(GLIBC)
+VERSION=$(BASEVERSION)
 
-BUILD_SDL=YES	# quake sdl glx executable (uses SDL for cdrom and sound)
+#BUILD_SDL=YES	# quake sdl glx executable (uses SDL for cdrom and sound)
 
 ifneq (,$(findstring libc6,$(shell if [ -e /lib/libc.so.6 ];then echo libc6;fi)))
 GLIBC=-glibc
@@ -28,32 +28,45 @@
 
 MOUNT_DIR=./src
 
-BUILD_DEBUG_DIR=debug$(ARCH)$(GLIBC)
-BUILD_RELEASE_DIR=release$(ARCH)$(GLIBC)
+BUILD_DEBUG_DIR=debug
+BUILD_RELEASE_DIR=release
 
-CC=gcc
+CC?=gcc
+ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/alpha/axp/)
+USE_OPTIMIZED_CFLAGS?=YES
 
-BASE_CFLAGS=-Dstricmp=strcasecmp #-Wall
+ifeq ($(ARCH),i386)
+USE_X86_ASM?=YES
+else
+USE_X86_ASM=NO
+endif
 
-RELEASE_CFLAGS=$(BASE_CFLAGS) -march=i686 -O2 -ffast-math -funroll-loops \
+BASE_CFLAGS=$(CFLAGS) -Dstricmp=strcasecmp #-Wall
+
+ifeq ($(strip $(USE_X86_ASM)),YES)
+BASE_CFLAGS+=-Did386
+endif
+
+RELEASE_CFLAGS=$(BASE_CFLAGS)
+
+ifeq ($(strip $(USE_OPTIMIZED_CFLAGS)),YES)
+RELEASE_CFLAGS+=-O2 -ffast-math -funroll-loops \
 	-fomit-frame-pointer -fexpensive-optimizations -fno-strict-aliasing
-DEBUG_CFLAGS=$(BASE_CFLAGS) -g
+endif
 
-LDFLAGS=-lm
+DEBUG_CFLAGS=$(BASE_CFLAGS) -g
 
-LDFLAGS += -lz -L./src/fmod -Wl,-rpath,. -lfmod
+LDFLAGS+=-lm -lz
 
 ifeq ($(strip $(BUILD_SDL)),YES)
- SDLCFLAGS=$(shell sdl-config --cflags)
- SDLLDFLAGS=$(shell sdl-config --libs)
- LDFLAGS += \
- 	-lSDL
+ SDLCFLAGS=$(shell $(SDL_CONFIG) --cflags)
+ SDLLDFLAGS=$(shell $(SDL_CONFIG) --libs)
  BASE_CFLAGS += \
     -D_SDL_BIN
 endif
 
-GLLDFLAGS=-L/usr/X11R6/lib -L/usr/local/lib -lGL -lX11 -lXext -ldl -lXxf86dga -lXxf86vm
-GLCFLAGS=-DGLQUAKE -I/usr/include -I/usr/X11R6/include
+GLLDFLAGS=-L$(X11BASE)/lib -lGL -lX11 -lXext -lXxf86dga -lXxf86vm
+GLCFLAGS=-DGLQUAKE -I$(X11BASE)/include
 
 DO_CC=$(CC) $(CFLAGS) -o $@ -c $<
 DO_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) -o $@ -c $<
@@ -70,10 +83,10 @@
 #############################################################################
 
 
-	TARGETS=$(BUILDDIR)/nehahra.glx
+	TARGETS=$(BUILDDIR)/nehahra
 	
 ifeq ($(strip $(BUILD_SDL)),YES)
-	TARGETS +=$(BUILDDIR)/nehahra-sdl.glx
+	TARGETS +=$(BUILDDIR)/nehahra-sdl
 endif
 
 all:
@@ -165,12 +178,15 @@
 	$(BUILDDIR)/glquake/sys_linux.o \
 	$(BUILDDIR)/glquake/snd_dma.o \
 	$(BUILDDIR)/glquake/snd_mem.o \
-	$(BUILDDIR)/glquake/snd_mix.o \
-	\
+	$(BUILDDIR)/glquake/snd_mix.o
+
+ifeq ($(strip $(USE_X86_ASM)),YES)
+GLQUAKE_OBJS+= \
 	$(BUILDDIR)/glquake/math.o \
 	$(BUILDDIR)/glquake/worlda.o \
 	$(BUILDDIR)/glquake/snd_mixa.o \
 	$(BUILDDIR)/glquake/sys_dosa.o
+endif
 
 GLQUAKE_LNX_OBJS = \
    $(BUILDDIR)/glquake/cd_linux.o \
@@ -182,10 +198,10 @@
 	
 GLX_OBJS=$(BUILDDIR)/glquake/gl_vidlinuxglx.o
 
-$(BUILDDIR)/nehahra.glx : $(GLQUAKE_OBJS) $(GLQUAKE_LNX_OBJS)  $(GLX_OBJS)
+$(BUILDDIR)/nehahra : $(GLQUAKE_OBJS) $(GLQUAKE_LNX_OBJS)  $(GLX_OBJS)
 	$(CC) $(CFLAGS) -o $@ $(GLQUAKE_OBJS) $(GLX_OBJS) $(GLQUAKE_LNX_OBJS)  $(GLLDFLAGS) $(LDFLAGS)
 	
-$(BUILDDIR)/nehahra-sdl.glx : $(GLQUAKE_OBJS) $(GLQUAKE_SDL_OBJS)  $(GLX_OBJS)
+$(BUILDDIR)/nehahra-sdl : $(GLQUAKE_OBJS) $(GLQUAKE_SDL_OBJS)  $(GLX_OBJS)
 	$(CC) $(CFLAGS) -o $@ $(GLQUAKE_OBJS) $(GLX_OBJS) $(GLQUAKE_SDL_OBJS)  $(GLLDFLAGS) $(LDFLAGS) $(SDLLDFLAGS)
 
 $(BUILDDIR)/glquake/cl_demo.o :      $(MOUNT_DIR)/cl_demo.c