forked from jonof/jfbuild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.shared
177 lines (162 loc) · 3.88 KB
/
Makefile.shared
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# Shared make information between Build engine and games
ENGINELIB=src/libengine.a
EDITORLIB=src/libbuild.a
# These are used when DYNAMIC_OPENGL is false
GLLIBWIN=-lopengl32
GLLIBBSD=-lopengl32
GLLIBLIN=-lGL
SDLCONFIG=sdl-config
#SDLCONFIG=/usr/local/bin/sdl11-config
# Path to the included libsquish
LIBSQUISH=libsquish
# overridden for OSes that don't have the cutdown stdc++ that is supc++
STDCPPLIB=-lsupc++
BUILDCFLAGS=-I$(LIBSQUISH)
# Detect the platform if it wasn't explicitly given to us from
# the outside world. This allows cross-compilation by overriding
# CC and giving us PLATFORM specifically.
ifndef PLATFORM
uname=$(strip $(shell uname -s))
PLATFORM=UNKNOWN
ifeq ($(findstring Linux,$(uname)),Linux)
PLATFORM=LINUX
endif
ifeq ($(findstring BSD,$(uname)),BSD)
PLATFORM=BSD
endif
ifeq ($(findstring MINGW,$(uname)),MINGW)
PLATFORM=WINDOWS
endif
ifeq ($(findstring Darwin,$(uname)),Darwin)
PLATFORM=DARWIN
endif
ifeq ($(findstring BeOS,$(uname)),BeOS)
PLATFORM=BEOS
endif
ifeq ($(findstring skyos,$(uname)),skyos)
PLATFORM=SKYOS
endif
ifeq ($(findstring QNX,$(uname)),QNX)
PLATFORM=QNX
endif
ifeq ($(findstring SunOS,$(uname)),SunOS)
PLATFORM=SUNOS
endif
ifeq ($(findstring syllable,$(uname)),syllable)
PLATFORM=SYLLABLE
endif
endif
ifeq ($(PLATFORM),LINUX)
RENDERTYPE=SDL
ifneq ($(DYNAMIC_OPENGL),1)
LIBS+= $(GLLIBLIN)
endif
ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
# on my 64bit Gentoo these are the 32bit emulation libs
LIBS+= -m32 -L/emul/linux/x86/usr/lib
BUILDCFLAGS+= -m32
#override WITHOUT_GTK=0
GTKCOMPAT32=1
else
GTKCOMPAT32=0
endif
endif
ifeq ($(PLATFORM),WINDOWS)
RENDERTYPE ?= WIN
EXESUFFIX=.exe
LIBS+= -lmingwex -lwinmm -L$(DXROOT)/lib -lwsock32 -lcomctl32 #-lshfolder
ifneq ($(DYNAMIC_OPENGL),1)
LIBS+= $(GLLIBWIN)
endif
endif
ifeq ($(PLATFORM),BSD)
RENDERTYPE=SDL
ifneq ($(DYNAMIC_OPENGL),1)
LIBS+= $(GLLIBBSD)
endif
endif
ifeq ($(PLATFORM),BEOS)
RENDERTYPE=SDL
STDCPPLIB=-lstdc++
endif
ifeq ($(PLATFORM),SKYOS)
RENDERTYPE=SDL
EXESUFFIX=.app
override NOASM=1
BUILDCFLAGS+= -DUNDERSCORES
SDLCONFIG=
SDLCONFIG_CFLAGS=-I/boot/programs/sdk/include/sdl
LIBS+= -lSDL -lnet
endif
ifeq ($(PLATFORM),QNX)
RENDERTYPE=SDL
override USE_OPENGL=0
override NOASM=1
STDCPPLIB=-lstdc++
LIBS+= -lsocket
endif
ifeq ($(PLATFORM),SUNOS)
RENDERTYPE=SDL
override USE_OPENGL=0
override NOASM=1
STDCPPLIB=-lstdc++
LIBS+= -lsocket -lnsl
endif
ifeq ($(PLATFORM),SYLLABLE)
RENDERTYPE=SDL
override USE_OPENGL=0
override NOASM=1
endif
ifeq ($(RENDERTYPE),SDL)
ifneq ($(SDLCONFIG),)
SDLCONFIG_CFLAGS+=$(shell $(SDLCONFIG) --cflags)
ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
SDLCONFIG_LIBS=$(subst lib,lib32,$(shell $(SDLCONFIG) --libs))
else
SDLCONFIG_LIBS=$(shell $(SDLCONFIG) --libs)
endif
LIBS+= $(SDLCONFIG_LIBS)
endif
ifeq (1,$(WITHOUT_GTK))
HAVE_GTK2=0
else
ifneq (No,$(shell pkg-config --exists gtk+-2.0 || echo No))
HAVE_GTK2=1
# on my 64bit Gentoo box I have Cairo enabled which means the libs list includes
# -lpangocairo-1.0 and -lcairo, however the 32bit compatibility libraries don't
# include cairo, so we need to filter out those -l switches in order to link
ifneq ($(LINKED_GTK),0)
ifeq ($(GTKCOMPAT32),1)
LIBS+= $(shell pkg-config --libs gtk+-2.0 | sed 's/\s-l\(pango\)\{0,1\}cairo\S*\s/ /g')
else
LIBS+= $(shell pkg-config --libs gtk+-2.0)
endif
endif
else
HAVE_GTK2=0
endif
endif
else
ifeq ($(RENDERTYPE),WIN)
LIBS+= -mwindows -ldxguid
endif
endif
BUILDCFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1
ifneq (0,$(SUPERBUILD))
BUILDCFLAGS+= -DSUPERBUILD
endif
ifneq (0,$(POLYMOST))
BUILDCFLAGS+= -DPOLYMOST
endif
ifneq (0,$(USE_OPENGL))
BUILDCFLAGS+= -DUSE_OPENGL
ifneq (0,$(DYNAMIC_OPENGL))
BUILDCFLAGS+= -DDYNAMIC_OPENGL
endif
endif
ifneq (0,$(NOASM))
BUILDCFLAGS+= -DNOASM
endif
ifneq (0,$(LINKED_GTK))
BUILDCFLAGS+= -DLINKED_GTK
endif