Fix a crash on Doombringer duel5.bsp where one of the lights has more than 32768...
[xonotic/darkplaces.git] / BSDmakefile
1 #####  DP_MAKE_TARGET autodetection and arch specific variables #####
2
3 .ifndef DP_MAKE_TARGET
4
5 DP_MAKE_TARGET=bsd
6
7 .endif
8 DP_ARCH != uname
9
10 # Makefile name
11 MAKEFILE=BSDmakefile
12
13 # Commands
14 CMD_RM=$(CMD_UNIXRM)
15 CMD_CP=$(CMD_UNIXCP)
16 CMD_MKDIR=$(CMD_UNIXMKDIR)
17
18 # default targets
19 TARGETS_DEBUG=sv-debug cl-debug sdl-debug
20 TARGETS_PROFILE=sv-profile cl-profile sdl-profile
21 TARGETS_RELEASE=sv-release cl-release sdl-release
22 TARGETS_RELEASE_PROFILE=sv-release-profile cl-release-profile sdl-release-profile
23 TARGETS_NEXUIZ=sv-nexuiz cl-nexuiz sdl-nexuiz
24
25 # Link options
26 DP_LINK_ZLIB?=shared
27 DP_LINK_JPEG?=shared
28 DP_LINK_ODE?=dlopen
29 DP_LINK_CRYPTO?=dlopen
30 DP_LINK_CRYPTO_RIJNDAEL?=dlopen
31
32 ###### Optional features #####
33 DP_CDDA?=enabled
34 .if $(DP_CDDA) == "enabled"
35   OBJ_SDLCD=$(OBJ_CD_COMMON) cd_sdl.o
36   OBJ_BSDCD=$(OBJ_CD_COMMON) cd_bsd.o
37 .else
38   OBJ_SDLCD=$(OBJ_CD_COMMON) $(OBJ_NOCD)
39   OBJ_BSDCD=$(OBJ_CD_COMMON) $(OBJ_NOCD)
40 .endif
41
42 DP_VIDEO_CAPTURE?=enabled
43 .if $(DP_VIDEO_CAPTURE) == "enabled"
44   CFLAGS_VIDEO_CAPTURE=-DCONFIG_VIDEO_CAPTURE
45   OBJ_VIDEO_CAPTURE = cap_avi.o cap_ogg.o
46 .else
47   CFLAGS_VIDEO_CAPTURE=
48   OBJ_VIDEO_CAPTURE =
49 .endif
50
51 # X11 libs
52 UNIX_X11LIBPATH=/usr/X11R6/lib
53
54 # BSD configuration
55 .if $(DP_MAKE_TARGET) == "bsd"
56
57 # FreeBSD uses OSS
58 .if $(DP_ARCH) == "FreeBSD"
59 DEFAULT_SNDAPI=OSS
60 .else
61 DEFAULT_SNDAPI=BSD
62 .endif
63 OBJ_CD=$(OBJ_BSDCD)
64
65 OBJ_CL=$(OBJ_GLX)
66 OBJ_ICON=
67 OBJ_ICON_NEXUIZ=
68
69 LDFLAGS_CL=$(LDFLAGS_BSDCL)
70 LDFLAGS_SV=$(LDFLAGS_BSDSV)
71 LDFLAGS_SDL=$(LDFLAGS_BSDSDL)
72
73 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS) $(SDLCONFIG_UNIXCFLAGS_X11)
74 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS) $(SDLCONFIG_UNIXLIBS_X11)
75 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS) $(SDLCONFIG_UNIXSTATICLIBS_X11)
76
77 EXE_CL=$(EXE_UNIXCL)
78 EXE_SV=$(EXE_UNIXSV)
79 EXE_SDL=$(EXE_UNIXSDL)
80 EXE_CLNEXUIZ=$(EXE_UNIXCLNEXUIZ)
81 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
82 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
83
84 # set these to "" if you want to use dynamic loading instead
85 # zlib
86 .if $(DP_LINK_ZLIB) == "shared"
87 CFLAGS_LIBZ=-DLINK_TO_ZLIB
88 LIB_Z=-lz
89 .else
90 CFLAGS_LIBZ=
91 LIB_Z=
92 .endif
93
94 # jpeg
95 .if $(DP_LINK_JPEG) == "shared"
96 CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
97 LIB_JPEG=-ljpeg
98 .else
99 CFLAGS_LIBJPEG=
100 LIB_JPEG=
101 .endif
102
103 # ode
104 .if $(DP_LINK_ODE) == "shared"
105 ODE_CONFIG?=ode-config
106 LIB_ODE=`$(ODE_CONFIG) --libs`
107 CFLAGS_ODE=`$(ODE_CONFIG) --cflags` -DUSEODE -DLINK_TO_LIBODE
108 .else
109 LIB_ODE=
110 CFLAGS_ODE=-DUSEODE
111 .endif
112
113 # d0_blind_id
114 .if $(DP_LINK_CRYPTO) == "shared"
115 LIB_CRYPTO=-ld0_blind_id
116 CFLAGS_CRYPTO=-DLINK_TO_CRYPTO
117 .else
118 LIB_CRYPTO=
119 CFLAGS_CRYPTO=
120 .endif
121 .if $(DP_LINK_CRYPTO_RIJNDAEL) == "shared"
122 LIB_CRYPTO_RIJNDAEL=-ld0_rijndael
123 CFLAGS_CRYPTO_RIJNDAEL=-DLINK_TO_CRYPTO_RIJNDAEL
124 .else
125 LIB_CRYPTO_RIJNDAEL=
126 CFLAGS_CRYPTO_RIJNDAEL=
127 .endif
128
129 .endif
130
131
132 ##### Sound configuration #####
133
134 .ifndef DP_SOUND_API
135 DP_SOUND_API=$(DEFAULT_SNDAPI)
136 .endif
137
138 # NULL: no sound
139 .if $(DP_SOUND_API) == "NULL"
140 OBJ_SOUND=$(OBJ_SND_NULL)
141 LIB_SOUND=$(LIB_SND_NULL)
142 .endif
143
144 # OSS: Open Sound System
145 .if $(DP_SOUND_API) == "OSS"
146 OBJ_SOUND=$(OBJ_SND_OSS)
147 LIB_SOUND=$(LIB_SND_OSS)
148 .endif
149
150 # BSD: BSD / Sun audio API
151 .if $(DP_SOUND_API) == "BSD"
152 OBJ_SOUND=$(OBJ_SND_BSD)
153 LIB_SOUND=$(LIB_SND_BSD)
154 .endif
155
156
157 ##### Extra CFLAGS #####
158
159 CFLAGS_MAKEDEP=-MD
160 .ifdef DP_FS_BASEDIR
161 CFLAGS_FS=-DDP_FS_BASEDIR='\"$(DP_FS_BASEDIR)\"'
162 .else
163 CFLAGS_FS=
164 .endif
165
166 CFLAGS_PRELOAD=
167 .ifdef DP_PRELOAD_DEPENDENCIES
168 LDFLAGS_CL+=$(LDFLAGS_UNIXCL_PRELOAD)
169 LDFLAGS_SV+=$(LDFLAGS_UNIXSV_PRELOAD)
170 LDFLAGS_SDL+=$(LDFLAGS_UNIXSDL_PRELOAD)
171 CFLAGS_PRELOAD=$(CFLAGS_UNIX_PRELOAD)
172 .endif
173
174 CFLAGS_NET=
175 # Systems without IPv6 support should uncomment this:
176 #CFLAGS_NET+=-DNOSUPPORTIPV6
177
178 ##### BSD Make specific definitions #####
179
180 MAKE:=$(MAKE) -f BSDmakefile
181
182 DO_LD=$(CC) -o ../../../$@ $> $(LDFLAGS)
183
184
185 ##### Definitions shared by all makefiles #####
186 .include "makefile.inc"