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