forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile.win
351 lines (293 loc) · 7.79 KB
/
Makefile.win
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
TARGET = retroarch.exe
JTARGET = tools/retroarch-joyconfig.exe
OBJDIR := obj-w32
OBJ = frontend/frontend.o \
frontend/frontend_context.o \
retroarch.o \
file.o \
file_path.o \
driver.o \
conf/config_file.o \
settings.o \
hash.o \
dynamic.o \
dynamic_dummy.o \
message_queue.o \
rewind.o \
movie.o \
gfx/gfx_common.o \
input/input_common.o \
input/keyboard_line.o \
input/autoconf/builtin_win.o \
core_options.o \
patch.o \
compat/compat.o \
screenshot.o \
cheats.o \
core_info.o \
audio/utils.o \
input/overlay.o \
fifo_buffer.o \
media/rarch.o \
gfx/context/win32_common.o \
gfx/scaler/scaler.o \
gfx/scaler/pixconv.o \
gfx/scaler/scaler_int.o \
gfx/scaler/filter.o \
gfx/state_tracker.o \
gfx/shader_parse.o \
gfx/fonts/fonts.o \
gfx/fonts/bitmapfont.o \
gfx/image.o \
audio/resampler.o \
audio/sinc.o \
performance.o
JOBJ := conf/config_file.o \
tools/retroarch-joyconfig.o \
compat/compat.o \
file_path.o \
tools/input_common_joyconfig.o \
input/dinput.o \
input/winxinput_joypad.o
HEADERS = $(wildcard */*/*.h) $(wildcard */*.h) $(wildcard *.h)
ifneq ($(HOST_PREFIX),)
CC = $(HOST_PREFIX)gcc
CXX = $(HOST_PREFIX)g++
WINDRES = $(HOST_PREFIX)windres
else
CC = gcc
CXX = g++
WINDRES = windres
endif
HAVE_DINPUT = 1
HAVE_XAUDIO = 1
HAVE_DSOUND = 1
HAVE_OPENGL = 1
HAVE_FBO = 1
HAVE_DYLIB = 1
HAVE_D3D9 = 1
HAVE_NETPLAY = 1
HAVE_STDIN_CMD = 1
HAVE_THREADS = 1
HAVE_RGUI = 1
DYNAMIC = 1
HAVE_WINXINPUT = 1
ifeq ($(SLIM),)
HAVE_SDL = 1
HAVE_SDL_IMAGE = 1
HAVE_LIBXML2 = 1
HAVE_FREETYPE = 1
HAVE_ZLIB = 1
HAVE_RSOUND = 1
HAVE_CG = 1
HAVE_PYTHON = 1
HAVE_FFMPEG = 1
endif
libretro ?= -lretro
LIBS = -lm
DEFINES = -I. -DHAVE_SCREENSHOTS -DHAVE_BSV_MOVIE -DHAVE_BUILTIN_AUTOCONFIG -DRARCH_INTERNAL
LDFLAGS = -L. -static-libgcc
ifeq ($(TDM_GCC),)
LDCXXFLAGS += -static-libstdc++
endif
ifeq ($(SCALER_NO_SIMD), 1)
DEFINES += -DSCALER_NO_SIMD
endif
ifeq ($(PERF_TEST), 1)
DEFINES += -DPERF_TEST
endif
JLIBS =
ifeq ($(HAVE_RGUI), 1)
DEFINES += -DHAVE_RGUI -DHAVE_MENU
OBJ += frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_context.o file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
endif
ifeq ($(HAVE_SDL), 1)
OBJ += gfx/sdl_gfx.o input/sdl_input.o input/sdl_joypad.o audio/sdl_audio.o
JOBJ += input/sdl_joypad.o
LIBS += -lSDL
JLIBS += -lSDL
DEFINES += -ISDL -DHAVE_SDL
endif
ifeq ($(HAVE_THREADS), 1)
OBJ += autosave.o thread.o gfx/video_thread_wrapper.o audio/thread_wrapper.o
DEFINES += -DHAVE_THREADS
endif
ifeq ($(HAVE_OPENGL), 1)
OBJ += gfx/gl.o gfx/math/matrix.o gfx/fonts/gl_font.o gfx/fonts/gl_raster_font.o gfx/gfx_context.o gfx/context/wgl_ctx.o gfx/shader_glsl.o gfx/glsym/rglgen.o gfx/glsym/glsym_gl.o
DEFINES += -DHAVE_OPENGL -DHAVE_OVERLAY -DHAVE_GLSL -DHAVE_GL_SYNC
LIBS += -lopengl32 -lgdi32 -lcomdlg32
endif
ifeq ($(HAVE_SDL_IMAGE), 1)
LIBS += -lSDL_image
DEFINES += -DHAVE_SDL_IMAGE
endif
ifeq ($(HAVE_CG), 1)
OBJ += gfx/shader_cg.o
LIBS += -lcg -lcgGL
DEFINES += -DHAVE_CG
else
HAVE_D3D9 = 0
endif
ifeq ($(HAVE_D3D9), 1)
OBJ += gfx/d3d9/d3d.o gfx/d3d9/d3d9_pc.o gfx/d3d9/render_chain.o gfx/fonts/d3d_font.o gfx/fonts/d3d_w32_font.o
DEFINES += -DHAVE_WIN32_D3D9
LIBS += -ld3d9 -lcg -lcgD3D9 -ld3dx9 -ldxguid
endif
ifeq ($(HAVE_XAUDIO), 1)
OBJ += audio/xaudio.o audio/xaudio-c/xaudio-c.o
DEFINES += -DHAVE_XAUDIO
LIBS += -lole32
endif
ifeq ($(HAVE_DSOUND), 1)
OBJ += audio/dsound.o
DEFINES += -DHAVE_DSOUND
LIBS += -ldxguid -ldsound
endif
ifeq ($(HAVE_RSOUND), 1)
OBJ += audio/rsound.o
DEFINES += -DHAVE_RSOUND
LIBS += -lrsound
endif
ifeq ($(HAVE_ZLIB), 1)
OBJ += gfx/rpng/rpng.o file_extract.o
DEFINES += -DHAVE_ZLIB
ifeq ($(WANT_MINIZ), 1)
OBJ += deps/miniz/miniz.o
DEFINES += -DWANT_MINIZ
else
LIBS += -lz
DEFINES += -DHAVE_ZLIB_DEFLATE
endif
endif
ifeq ($(HAVE_LIBXML2), 1)
DEFINES += -Ilibxml2 -DHAVE_LIBXML2 -DHAVE_GLSL
LIBS += -lxml2 -liconv
else
OBJ += compat/rxml/rxml.o
endif
ifeq ($(HAVE_DYLIB), 1)
DEFINES += -DHAVE_DYLIB
endif
ifeq ($(HAVE_STDIN_CMD), 1)
DEFINES += -DHAVE_COMMAND -DHAVE_STDIN_CMD
OBJ += command.o
endif
ifeq ($(HAVE_NETPLAY), 1)
DEFINES += -DHAVE_NETPLAY -DHAVE_NETWORK_CMD
OBJ += netplay.o
LIBS += -lws2_32
endif
ifeq ($(HAVE_FREETYPE), 1)
OBJ += gfx/fonts/freetype.o
DEFINES += -DHAVE_FREETYPE -Ifreetype2
LIBS += -lfreetype -lz
endif
ifeq ($(DYNAMIC), 1)
DEFINES += -DHAVE_DYNAMIC
else
LIBS += $(libretro)
endif
ifeq ($(HAVE_FBO), 1)
DEFINES += -DHAVE_FBO
endif
ifeq ($(HAVE_PYTHON), 1)
LIBS += -lpython32
DEFINES += -DHAVE_PYTHON -Ipython
OBJ += gfx/py_state/py_state.o
endif
ifeq ($(HAVE_WINXINPUT), 1)
DEFINES += -DHAVE_WINXINPUT
OBJ += input/winxinput_joypad.o
endif
ifeq ($(HAVE_DINPUT), 1)
LIBS += -ldinput8 -ldxguid -lole32
DEFINES += -DHAVE_DINPUT
OBJ += input/dinput.o
endif
ifeq ($(HAVE_FFMPEG), 1)
LIBS += -lavformat -lavcodec -lavutil -lswscale -lws2_32 -lz
DEFINES += -DHAVE_FFMPEG -Iffmpeg
OBJ += record/ffemu.o
endif
ifneq ($(V), 1)
Q := @
endif
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
CXXFLAGS += -O0 -g
else
CFLAGS += -O3 -ffast-math
CXXFLAGS += -O3 -ffast-math
LDCXXFLAGS += -s
endif
ifeq ($(GL_DEBUG), 1)
CFLAGS += -DGL_DEBUG
CXXFLAGS += -DGL_DEBUG
endif
CFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I.
CXXFLAGS += -Wall -Wno-unused-result -Wno-unused-variable -I. -std=c++0x -D__STDC_CONSTANT_MACROS
ifeq ($(CXX_BUILD), 1)
CFLAGS += -std=c++0x -xc++ -D__STDC_CONSTANT_MACROS
else
ifneq ($(GNU90_BUILD), 1)
CFLAGS += -std=gnu99
endif
endif
GIT_VERSION := $(shell git rev-parse --short HEAD 2>/dev/null)
ifneq ($(GIT_VERSION),)
DEFINES += -DHAVE_GIT_VERSION -DGIT_VERSION=\"$(GIT_VERSION)\"
OBJ += git_version.o
endif
RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ))
RARCH_JOBJ := $(addprefix $(OBJDIR)/,$(JOBJ))
all: $(TARGET) $(JTARGET)
$(TARGET): $(RARCH_OBJ)
@$(if $(Q), $(shell echo echo LD $@),)
$(Q)$(CXX) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LDCXXFLAGS)
$(OBJDIR)/%.o: %.c $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
.FORCE:
$(OBJDIR)/git_version.o: git_version.c .FORCE
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
$(OBJDIR)/tools/input_common_joyconfig.o: input/input_common.c $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_JOYCONFIG -c -o $@ $<
$(OBJDIR)/%.o: %.cpp $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CXX $<),)
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) -c -o $@ $<
$(OBJDIR)/%.o: %.rc $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo WINDRES $<),)
$(Q)$(WINDRES) -o $@ $<
$(JTARGET): $(RARCH_JOBJ)
@$(if $(Q), $(shell echo echo LD $@),)
ifeq ($(CXX_BUILD), 1)
$(Q)$(CXX) -o $@ $(RARCH_JOBJ) -ldxguid -ldinput8 -lole32 $(LDFLAGS) $(JLIBS)
else
$(Q)$(CC) -o $@ $(RARCH_JOBJ) -ldxguid -ldinput8 -lole32 $(LDFLAGS) $(JLIBS)
endif
clean:
rm -rf $(OBJDIR)
rm -f $(TARGET)
rm -f tools/retroarch-joyconfig.exe
dist_x86: all
zip -r retroarch-win32-1.0.zip $(TARGET) $(JTARGET) retroarch.cfg
dist_x86_64: all
zip -r retroarch-win64-1.0.zip $(TARGET) $(JTARGET) retroarch.cfg
libs_x86:
wget http://themaister.net/retroarch-dl/RetroArch-win32-libs.zip
unzip RetroArch-win32-libs.zip
wget http://themaister.net/retroarch-dl/RetroArch-win32-headers.zip
unzip RetroArch-win32-headers.zip
libs_x86_64:
wget http://themaister.net/retroarch-dl/RetroArch-win64-libs.zip
unzip RetroArch-win64-libs.zip
wget http://themaister.net/retroarch-dl/RetroArch-win64-headers.zip
unzip RetroArch-win64-headers.zip
.PHONY: all install uninstall clean dist_x86 dist_x86_64 libs_x86 libs_x86_64