FreeBSD support
[divverent/darkplaces.git] / makefile
1 #####  DP_MAKE_TARGET autodetection and arch specific variables ##### 
2
3 ifndef DP_MAKE_TARGET
4
5 # Win32
6 ifdef windir
7         DP_MAKE_TARGET=mingw
8 else
9
10 # UNIXes
11 DP_ARCH:=$(shell uname)
12 ifneq ($(filter %BSD,$(DP_ARCH)),)
13         DP_MAKE_TARGET=bsd
14 else
15         DP_MAKE_TARGET=linux
16 endif
17
18 endif
19
20 endif
21
22 # If we're not on compiling for Win32, we need additional information
23 ifneq ($(DP_MAKE_TARGET), mingw)
24         DP_ARCH:=$(shell uname)
25         DP_MACHINE:=$(shell uname -m)
26 endif
27
28
29 # Command used to delete files
30 ifdef windir
31         CMD_RM=del
32 else
33         CMD_RM=$(CMD_UNIXRM)
34 endif
35
36 # 64bits AMD CPUs use another lib directory
37 ifeq ($(DP_MACHINE),x86_64)
38         UNIX_X11LIBPATH:=-L/usr/X11R6/lib64
39 else
40         UNIX_X11LIBPATH:=-L/usr/X11R6/lib
41 endif
42
43
44 # Linux configuration
45 ifeq ($(DP_MAKE_TARGET), linux)
46         OBJ_SOUND=$(OBJ_LINUXSOUND)
47         LIB_SOUND=$(LIB_LINUXSOUND)
48         OBJ_CD=$(OBJ_LINUXCD)
49
50         OBJ_CL=$(OBJ_GLX)
51
52         LDFLAGS_CL=$(LDFLAGS_LINUXCL)
53         LDFLAGS_SV=$(LDFLAGS_LINUXSV)
54         LDFLAGS_SDL=$(LDFLAGS_LINUXSDL)
55
56         EXE_CL=$(EXE_UNIXCL)
57         EXE_SV=$(EXE_UNIXSV)
58         EXE_SDL=$(EXE_UNIXSDL)
59 endif
60
61 # BSD configuration
62 ifeq ($(DP_MAKE_TARGET), bsd)
63 ifeq ($(DP_ARCH),FreeBSD)
64         OBJ_SOUND=$(OBJ_OSSSOUND)
65         LIB_SOUND=$(LIB_OSSSOUND)
66 else
67         OBJ_SOUND=$(OBJ_BSDSOUND)
68         LIB_SOUND=$(LIB_BSDSOUND)
69 endif
70         OBJ_CD=$(OBJ_BSDCD)
71
72         OBJ_CL=$(OBJ_GLX)
73
74         LDFLAGS_CL=$(LDFLAGS_BSDCL)
75         LDFLAGS_SV=$(LDFLAGS_BSDSV)
76         LDFLAGS_SDL=$(LDFLAGS_BSDSDL)
77
78         EXE_CL=$(EXE_UNIXCL)
79         EXE_SV=$(EXE_UNIXSV)
80         EXE_SDL=$(EXE_UNIXSDL)
81 endif
82
83 # Win32 configuration
84 ifeq ($(DP_MAKE_TARGET), mingw)
85         OBJ_SOUND=$(OBJ_WINSOUND)
86         LIB_SOUND=$(LIB_WINSOUND)
87         OBJ_CD=$(OBJ_WINCD)
88
89         OBJ_CL=$(OBJ_WGL)
90
91         LDFLAGS_CL=$(LDFLAGS_WINCL)
92         LDFLAGS_SV=$(LDFLAGS_WINSV)
93         LDFLAGS_SDL=$(LDFLAGS_WINSDL)
94
95         EXE_CL=$(EXE_WINCL)
96         EXE_SV=$(EXE_WINSV)
97         EXE_SDL=$(EXE_WINSDL)
98 endif
99
100
101 ##### GNU Make specific definitions #####
102
103 DO_LD=$(CC) -o $@ $^ $(LDFLAGS)
104
105
106 ##### Definitions shared by all makefiles #####
107 include makefile.inc
108
109
110 ##### Dependency files #####
111
112 -include *.d