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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
--- ./Makefile.orig Mon Apr 10 04:38:03 2006
+++ ./Makefile Thu Jun 8 15:41:00 2006
@@ -20,12 +20,12 @@
#OPTIONS
######################################
-BUILD_DATADIR=NO # Use DATADIR to read (data, renderers, etc.) and ~/.quake2 to write.
-BUILD_GAME=YES # game$(ARCH).so
-BUILD_KMQUAKE2=YES # kmquake executable (uses OSS for cdrom and sound)
-BUILD_KMQUAKE2_DEDICATED=YES # build a dedicated kmquake2 server
-BUILD_KMQUAKE2_SDL=YES # kmquake2-sdl executable (uses SDL for cdrom and sound)
-BUILD_LIBDIR=NO # Use LIBDIR to read data and renderers (independent from DATADIR).
+BUILD_DATADIR=YES # Use DATADIR to read (data, renderers, etc.) and ~/.quake2 to write.
+#BUILD_GAME=YES # game$(ARCH).so
+#BUILD_KMQUAKE2=YES # kmquake executable (uses OSS for cdrom and sound)
+#BUILD_KMQUAKE2_DEDICATED=YES # build a dedicated kmquake2 server
+#BUILD_KMQUAKE2_SDL=YES # kmquake2-sdl executable (uses SDL for cdrom and sound)
+BUILD_LIBDIR=YES # Use LIBDIR to read data and renderers (independent from DATADIR).
######################################
@@ -38,13 +38,17 @@
BINDIR=quake2
CC?=gcc
-BASE_CFLAGS=
+BASE_CFLAGS=$(CFLAGS)
DEBUG_CFLAGS=$(BASE_CFLAGS) -g -ggdb -Wall -pipe
-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations
+RELEASE_CFLAGS=$(BASE_CFLAGS)
+
+ifdef OPTIMIZED_CFLAGS
+RELEASE_CFLAGS+=-O2 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations
ifeq ($(ARCH),i386)
RELEASE_CFLAGS+=-falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing
endif
+endif
CLIENT_DIR=$(MOUNT_DIR)/client
SERVER_DIR=$(MOUNT_DIR)/server
@@ -62,7 +66,7 @@
endif
#Ogg Vorbis support
-LDFLAGS += \
+CLIENT_LDFLAGS = \
-lvorbisfile \
-lvorbis \
-logg
@@ -72,7 +76,7 @@
X11BASE?=/usr/X11R6
PREFIX?=$(LOCALBASE)
-DATADIR?=$(LOCALBASE)/share/quake2
+Q2DIR?=$(LOCALBASE)/share/quake2
LIBDIR?=$(LOCALBASE)/lib/kmquake2
XCFLAGS=-I$(LOCALBASE)/include
@@ -91,7 +95,7 @@
endif
ifeq ($(strip $(BUILD_DATADIR)),YES)
- BASE_CFLAGS+=-DDATADIR='\"$(DATADIR)\"'
+ BASE_CFLAGS+=-DDATADIR='\"$(Q2DIR)\"'
endif
ifeq ($(strip $(BUILD_KMQUAKE2_SDL)),YES)
@@ -109,7 +113,7 @@
DO_CC=$(CC) $(CFLAGS) -I$(LOCALBASE)/include -o $@ -c $<
DO_DED_CC=$(CC) $(CFLAGS) -DDEDICATED_ONLY -o $@ -c $<
-DO_DED_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) -DDEDICATED_ONLY -o $@ -c $<
+DO_DED_DEBUG_CC=$(CC) $(CFLAGS) -DDEDICATED_ONLY -o $@ -c $<
DO_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
DO_GL_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) $(GLCFLAGS) -o $@ -c $<
DO_AS=$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
@@ -128,7 +132,7 @@
endif
ifeq ($(strip $(BUILD_KMQUAKE2_DEDICATED)),YES)
- TARGETS += $(BINDIR)/kmquake2_netserver
+ TARGETS += $(BINDIR)/kmquake2-ded
endif
ifeq ($(strip $(BUILD_KMQUAKE2_SDL)),YES)
@@ -136,7 +140,11 @@
endif
ifeq ($(strip $(BUILD_GAME)),YES)
- TARGETS+=$(BINDIR)/baseq2/kmq2game$(ARCH).$(SHLIBEXT)
+ TARGETS+=$(BINDIR)/baseq2/kmq2game.$(SHLIBEXT)
+endif
+
+ifdef KMQ2_ADDONS
+ TARGETS += addons
endif
all:
@@ -164,7 +172,7 @@
$(BUILD_DEBUG_DIR)/ref_gl \
$(BUILD_DEBUG_DIR)/game
- $(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS+="$(DEBUG_CFLAGS) -DKMQUAKE2_VERSION='\"$(VERSION) Debug\"'"
+ $(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS="$(DEBUG_CFLAGS) -DKMQUAKE2_VERSION='\"$(VERSION) Debug\"'"
release:
@-mkdir -p $(BUILD_RELEASE_DIR) \
@@ -174,7 +182,7 @@
$(BUILD_RELEASE_DIR)/ref_gl \
$(BUILD_RELEASE_DIR)/game
- $(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS+="$(RELEASE_CFLAGS) -DKMQUAKE2_VERSION='\"$(VERSION)\"'"
+ $(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS="$(RELEASE_CFLAGS) -DKMQUAKE2_VERSION='\"$(VERSION)\"'"
targets: $(TARGETS)
@@ -285,13 +293,16 @@
@echo
@echo "==================== Linking $@ ===================="
@echo
- $(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(QUAKE2_AS_OBJS) $(QUAKE2_LNX_OBJS) $(GLXLDFLAGS) $(LDFLAGS)
+ $(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(QUAKE2_AS_OBJS) $(QUAKE2_LNX_OBJS) $(GLXLDFLAGS) $(LDFLAGS) $(CLIENT_LDFLAGS)
$(BINDIR)/kmquake2-sdl : $(QUAKE2_OBJS) $(QUAKE2_AS_OBJS) $(QUAKE2_SDL_OBJS)
@echo
@echo "==================== Linking $@ ===================="
@echo
- $(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(QUAKE2_AS_OBJS) $(QUAKE2_SDL_OBJS) $(GLXLDFLAGS) $(LDFLAGS) $(SDLLDFLAGS)
+ $(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(QUAKE2_AS_OBJS) $(QUAKE2_SDL_OBJS) $(GLXLDFLAGS) $(LDFLAGS) $(SDLLDFLAGS) $(CLIENT_LDFLAGS)
+
+addons:
+ $(MAKE) -C ../$(KMQ2_ADDONS) release
$(BUILDDIR)/client/cl_cin.o : $(CLIENT_DIR)/cl_cin.c
$(DO_CC)
@@ -586,7 +597,7 @@
$(BUILDDIR)/ded/cl_null.o \
$(BUILDDIR)/ded/cd_null.o
-$(BINDIR)/kmquake2_netserver : $(Q2DED_OBJS)
+$(BINDIR)/kmquake2-ded : $(Q2DED_OBJS)
$(CC) $(CFLAGS) -o $@ $(Q2DED_OBJS) $(LDFLAGS)
$(BUILDDIR)/ded/cmd.o : $(COMMON_DIR)/cmd.c
@@ -753,8 +764,8 @@
$(BUILDDIR)/game/p_weapon.o \
$(BUILDDIR)/game/q_shared.o
-$(BINDIR)/baseq2/kmq2game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS)
- $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS) -lGL
+$(BINDIR)/baseq2/kmq2game.$(SHLIBEXT) : $(GAME_OBJS)
+ $(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS) -L$(LOCALBASE)/lib -lGL
$(BUILDDIR)/game/acebot_ai.o : $(GAME_DIR)/acesrc/acebot_ai.c
$(DO_SHLIB_CC)
|