aboutsummaryrefslogtreecommitdiff
path: root/games/sdlquake2/files/patch-Makefile
blob: 5b764d45680811f106e7c06ab1b685fdab190f3c (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
--- Makefile.orig	Thu May 19 17:56:13 2005
+++ Makefile	Sat Jul 22 16:05:33 2006
@@ -1,9 +1,34 @@
-CC:=gcc
-CFLAGS:=-O3 -ffast-math -march=athlon-xp -g -Wall $(shell sdl-config --cflags)
+CC?=gcc
+SDL_CONFIG?=sdl-config
+LOCALBASE?=/usr/local
+X11BASE?=/usr/X11R6
+CFLAGS+=-O3 -ffast-math -DDATADIR='"$(Q2DIR)"' -DLIBDIR='"$(LIBDIR)"' $(shell $(SDL_CONFIG) --cflags) -I$(X11BASE)/include
+
+LIBS=-lm -lz
+
+ifeq ($(shell uname),Linux)
+LIBS+=-ldl
+endif
+
+ifeq ($(shell uname),FreeBSD)
+LIBS+=-L$(LOCALBASE)/lib -lexecinfo
+endif
 
 GAMES:=baseq2
 
-TARGETS:=quake2 q2ded ref_sdlgl.so $(foreach game, $(GAMES), $(game)/game.so)
+TARGETS:=
+
+ifeq ($(strip $(BUILD_CLIENT)),YES)
+TARGETS+=quake2 ref_sdlgl.so
+endif
+
+ifeq ($(strip $(BUILD_DEDICATED)),YES)
+TARGETS+=q2ded
+endif
+
+ifeq ($(strip $(BUILD_GAME)),YES)
+TARGETS+=$(foreach game, $(GAMES), $(game)/game.so)
+endif
 
 .PHONY: default all clean distclean
 
@@ -43,15 +68,14 @@
 	@sed "s@^\(.*\)\.o:@$(dir $*)\1.o:@" < .depends/$*.d > .depends/$*.d.new
 	@mv .depends/$*.d.new .depends/$*.d
 
-
 quake2: $(quake2_OBJ)
-	$(CC) -g -o $@ $(shell sdl-config --libs) -lz -ldl $^
+	$(CC) -g -o $@ $(shell $(SDL_CONFIG) --libs) $(LIBS) $^
 
 q2ded: $(q2ded_OBJ)
-	$(CC) -g -o $@ $^ -lz -ldl
+	$(CC) -g -o $@ $^ $(LIBS)
 
 ref_sdlgl.so: $(sdlgl_OBJ)
-	$(CC) -shared -g -o $@ $(shell sdl-config --libs) -lGL -ljpeg -lpng12 $^
+	$(CC) -shared -g -o $@ $(shell $(SDL_CONFIG) --libs) -L$(X11BASE)/lib -lGL -ljpeg -lpng $^
 
 ALLOBJ:=$(quake2_OBJ) $(sdlgl_OBJ)