Revert "Revert "Build in subdirs"", as the issues seem to be ironed out now.
[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 ###### Optional features #####
26 DP_CDDA?=enabled
27 .if $(DP_CDDA) == "enabled"
28         OBJ_SDLCD=$(OBJ_CD_COMMON) cd_sdl.o
29         OBJ_BSDCD=$(OBJ_CD_COMMON) cd_bsd.o
30 .else
31         OBJ_SDLCD=$(OBJ_CD_COMMON) $(OBJ_NOCD)
32         OBJ_BSDCD=$(OBJ_CD_COMMON) $(OBJ_NOCD)
33 .endif
34
35 DP_VIDEO_CAPTURE?=enabled
36 .if $(DP_VIDEO_CAPTURE == "enabled"
37         CFLAGS_VIDEO_CAPTURE=-DCONFIG_VIDEO_CAPTURE
38         OBJ_VIDEO_CAPTURE= cap_avi.o cap_ogg.o
39 .else
40         CFLAGS_VIDEO_CAPTURE=
41         OBJ_VIDEO_CAPTURE=
42 .endif
43
44 # X11 libs
45 UNIX_X11LIBPATH=/usr/X11R6/lib
46
47 # BSD configuration
48 .if $(DP_MAKE_TARGET) == "bsd"
49
50 # FreeBSD uses OSS
51 .if $(DP_ARCH) == "FreeBSD"
52 DEFAULT_SNDAPI=OSS
53 .else
54 DEFAULT_SNDAPI=BSD
55 .endif
56 OBJ_CD=$(OBJ_BSDCD)
57
58 OBJ_CL=$(OBJ_GLX)
59 OBJ_ICON=
60 OBJ_ICON_NEXUIZ=
61
62 LDFLAGS_CL=$(LDFLAGS_BSDCL)
63 LDFLAGS_SV=$(LDFLAGS_BSDSV)
64 LDFLAGS_SDL=$(LDFLAGS_BSDSDL)
65
66 SDLCONFIG_CFLAGS=$(SDLCONFIG_UNIXCFLAGS) $(SDLCONFIG_UNIXCFLAGS_X11)
67 SDLCONFIG_LIBS=$(SDLCONFIG_UNIXLIBS) $(SDLCONFIG_UNIXLIBS_X11)
68 SDLCONFIG_STATICLIBS=$(SDLCONFIG_UNIXSTATICLIBS) $(SDLCONFIG_UNIXSTATICLIBS_X11)
69
70 EXE_CL=$(EXE_UNIXCL)
71 EXE_SV=$(EXE_UNIXSV)
72 EXE_SDL=$(EXE_UNIXSDL)
73 EXE_CLNEXUIZ=$(EXE_UNIXCLNEXUIZ)
74 EXE_SVNEXUIZ=$(EXE_UNIXSVNEXUIZ)
75 EXE_SDLNEXUIZ=$(EXE_UNIXSDLNEXUIZ)
76
77 # set these to "" if you want to use dynamic loading instead
78 # zlib
79 CFLAGS_LIBZ=-DLINK_TO_ZLIB
80 LIB_Z=-lz
81
82 # jpeg
83 CFLAGS_LIBJPEG=-DLINK_TO_LIBJPEG
84 LIB_JPEG=-ljpeg
85
86 # ode
87 ODE_CONFIG?=ode-config
88 LIB_ODE=`$(ODE_CONFIG) --libs`
89 CFLAGS_ODE=`$(ODE_CONFIG) --cflags` -DUSEODE -DLINK_TO_LIBODE
90
91 # d0_blind_id
92 # most distros do not have d0_blind_id package, dlopen will used by default
93 # LIB_CRYPTO=-ld0_blind_id
94 # CFLAGS_CRYPTO=-DLINK_TO_CRYPTO
95 # LIB_CRYPTO_RIJNDAEL=-ld0_rijndael
96 # CFLAGS_CRYPTO_RIJNDAEL=-DLINK_TO_CRYPTO_RIJNDAEL
97 LIB_CRYPTO=
98 CFLAGS_CRYPTO=
99 LIB_CRYPTO_RIJNDAEL=
100 CFLAGS_CRYPTO_RIJNDAEL=
101
102 .endif
103
104
105 ##### Sound configuration #####
106
107 .ifndef DP_SOUND_API
108 DP_SOUND_API=$(DEFAULT_SNDAPI)
109 .endif
110
111 # NULL: no sound
112 .if $(DP_SOUND_API) == "NULL"
113 OBJ_SOUND=$(OBJ_SND_NULL)
114 LIB_SOUND=$(LIB_SND_NULL)
115 .endif
116
117 # OSS: Open Sound System
118 .if $(DP_SOUND_API) == "OSS"
119 OBJ_SOUND=$(OBJ_SND_OSS)
120 LIB_SOUND=$(LIB_SND_OSS)
121 .endif
122
123 # BSD: BSD / Sun audio API
124 .if $(DP_SOUND_API) == "BSD"
125 OBJ_SOUND=$(OBJ_SND_BSD)
126 LIB_SOUND=$(LIB_SND_BSD)
127 .endif
128
129
130 ##### Extra CFLAGS #####
131
132 CFLAGS_MAKEDEP=-MD
133 .ifdef DP_FS_BASEDIR
134 CFLAGS_FS=-DDP_FS_BASEDIR='\"$(DP_FS_BASEDIR)\"'
135 .else
136 CFLAGS_FS=
137 .endif
138
139 CFLAGS_PRELOAD=
140 .ifdef DP_PRELOAD_DEPENDENCIES
141 LDFLAGS_CL+=$(LDFLAGS_UNIXCL_PRELOAD)
142 LDFLAGS_SV+=$(LDFLAGS_UNIXSV_PRELOAD)
143 LDFLAGS_SDL+=$(LDFLAGS_UNIXSDL_PRELOAD)
144 CFLAGS_PRELOAD=$(CFLAGS_UNIX_PRELOAD)
145 .endif
146
147
148 ##### BSD Make specific definitions #####
149
150 MAKE:=$(MAKE) -f BSDmakefile
151
152 DO_LD=$(CC) -o ../../../$@ $> $(LDFLAGS)
153
154
155 ##### Definitions shared by all makefiles #####
156 .include "makefile.inc"