451ab91e |
1 | #/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
2 | # * Mupen64plus - Makefile * |
3 | # * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * |
4 | # * Copyright (C) 2008-2009 Richard Goedeken * |
5 | # * Copyright (C) 2007-2008 DarkJeztr Tillin9 * |
6 | # * * |
7 | # * This program is free software; you can redistribute it and/or modify * |
8 | # * it under the terms of the GNU General Public License as published by * |
9 | # * the Free Software Foundation; either version 2 of the License, or * |
10 | # * (at your option) any later version. * |
11 | # * * |
12 | # * This program is distributed in the hope that it will be useful, * |
13 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
14 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
15 | # * GNU General Public License for more details. * |
16 | # * * |
17 | # * You should have received a copy of the GNU General Public License * |
18 | # * along with this program; if not, write to the * |
19 | # * Free Software Foundation, Inc., * |
20 | # * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * |
21 | # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
22 | # Makefile for Mupen64Plus Core |
23 | |
24 | # detect operating system |
25 | UNAME ?= $(shell uname -s) |
26 | OS := NONE |
27 | ifeq ("$(UNAME)","Linux") |
28 | OS = LINUX |
29 | endif |
30 | ifeq ("$(UNAME)","linux") |
31 | OS = LINUX |
32 | endif |
33 | ifneq ("$(filter GNU hurd,$(UNAME))","") |
34 | OS = LINUX |
35 | endif |
36 | ifeq ("$(UNAME)","Darwin") |
37 | OS = OSX |
38 | endif |
39 | ifeq ("$(UNAME)","FreeBSD") |
40 | OS = FREEBSD |
41 | endif |
42 | ifeq ("$(UNAME)","OpenBSD") |
43 | OS = FREEBSD |
44 | CFLAGS += -DIOAPI_NO_64 |
45 | $(warning OS type "$(UNAME)" not officially supported.') |
46 | endif |
47 | ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","") |
48 | OS = LINUX |
49 | endif |
50 | ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW") |
51 | OS = MINGW |
52 | PIC = 0 |
53 | endif |
54 | ifeq ("$(OS)","NONE") |
55 | $(error OS type "$(UNAME)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues') |
56 | endif |
57 | |
58 | # detect system architecture |
59 | HOST_CPU ?= $(shell uname -m) |
60 | CPU := NONE |
61 | ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","") |
62 | CPU := X86 |
63 | ifeq ("$(BITS)", "32") |
64 | ARCH_DETECTED := 64BITS_32 |
65 | PIC ?= 0 |
66 | else |
67 | ARCH_DETECTED := 64BITS |
68 | PIC ?= 1 |
69 | endif |
70 | endif |
71 | ifneq ("$(filter pentium i%86,$(HOST_CPU))","") |
72 | CPU := X86 |
73 | ARCH_DETECTED := 32BITS |
74 | PIC ?= 0 |
75 | endif |
76 | ifneq ("$(filter ppc macppc socppc powerpc,$(HOST_CPU))","") |
77 | CPU := PPC |
78 | ARCH_DETECTED := 32BITS |
79 | BIG_ENDIAN := 1 |
80 | PIC ?= 1 |
81 | NO_ASM := 1 |
82 | $(warning Architecture "$(HOST_CPU)" not officially supported.') |
83 | endif |
84 | ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","") |
85 | CPU := PPC |
86 | ARCH_DETECTED := 64BITS |
87 | BIG_ENDIAN := 1 |
88 | PIC ?= 1 |
89 | NO_ASM := 1 |
90 | $(warning Architecture "$(HOST_CPU)" not officially supported.') |
91 | endif |
92 | ifneq ("$(filter arm%,$(HOST_CPU))","") |
93 | ifeq ("$(filter arm%b,$(HOST_CPU))","") |
94 | CPU := ARM |
95 | ARCH_DETECTED := 32BITS |
96 | PIC ?= 1 |
a40a7e6a |
97 | OSD ?= 0 |
451ab91e |
98 | NEW_DYNAREC := 1 |
99 | CFLAGS += -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mtune=cortex-a8 -fsigned-char |
100 | $(warning Architecture "$(HOST_CPU)" not officially supported.') |
101 | endif |
102 | endif |
103 | ifeq ("$(CPU)","NONE") |
104 | $(error CPU type "$(HOST_CPU)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues') |
105 | endif |
106 | |
107 | # base CFLAGS, LDLIBS, and LDFLAGS |
108 | OPTFLAGS ?= -O3 |
109 | #-flto -fuse-linker-plugin |
110 | WARNFLAGS ?= -Wall |
111 | CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src -DM64P_PARALLEL |
112 | CXXFLAGS += -fvisibility-inlines-hidden |
113 | LDLIBS += -lm |
114 | |
115 | # Since we are building a shared library, we must compile with -fPIC on some architectures |
116 | # On 32-bit x86 systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch |
117 | ifeq ($(PIC), 1) |
118 | CFLAGS += -fPIC |
119 | else |
120 | CFLAGS += -fno-PIC |
121 | endif |
122 | |
123 | ifeq ($(BIG_ENDIAN), 1) |
124 | CFLAGS += -DM64P_BIG_ENDIAN |
125 | endif |
126 | |
127 | # tweak flags for 32-bit build on 64-bit system |
128 | ifeq ($(ARCH_DETECTED), 64BITS_32) |
129 | ifeq ($(OS), FREEBSD) |
130 | $(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386) |
131 | endif |
132 | CFLAGS += -m32 |
133 | LDFLAGS += -Wl,-m,elf_i386 |
134 | endif |
135 | |
136 | # set special flags per-system |
137 | ifeq ($(OS), FREEBSD) |
138 | TARGET = libmupen64plus$(POSTFIX).so.2.0.0 |
139 | SONAME = libmupen64plus$(POSTFIX).so.2 |
140 | LDFLAGS += -Wl,-Bsymbolic -shared -Wl,-export-dynamic -Wl,-soname,$(SONAME) |
141 | LDLIBS += -L${LOCALBASE}/lib -lc |
142 | endif |
143 | ifeq ($(OS), LINUX) |
144 | TARGET = libmupen64plus$(POSTFIX).so.2.0.0 |
145 | SONAME = libmupen64plus$(POSTFIX).so.2 |
146 | LDFLAGS += -Wl,-Bsymbolic -shared -Wl,-export-dynamic -Wl,-soname,$(SONAME) |
147 | LDLIBS += -ldl |
148 | # only export api symbols |
149 | LDFLAGS += -Wl,-version-script,$(SRCDIR)/api/api_export.ver |
150 | endif |
151 | ifeq ($(OS), OSX) |
152 | # Select the proper SDK |
153 | # Also, SDKs are stored in a different location since XCode 4.3 |
154 | OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .) |
155 | OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .) |
156 | OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .) |
157 | OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`") |
158 | ifeq ($(OSX_XCODEGE43), 11) |
159 | OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs |
160 | else |
161 | OSX_SYSROOT := /Developer/SDKs |
162 | endif |
163 | |
164 | TARGET = libmupen64plus$(POSTFIX).dylib |
165 | LDFLAGS += -bundle -read_only_relocs suppress |
166 | LDLIBS += -ldl |
167 | ifeq ($(CPU), X86) |
168 | ifeq ($(ARCH_DETECTED), 64BITS) |
169 | CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk |
170 | else |
171 | CFLAGS += -pipe -mmmx -msse -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk |
172 | ifneq ($(PROFILE), 1) |
173 | CFLAGS += -fomit-frame-pointer |
174 | endif |
175 | endif |
176 | endif |
177 | endif |
178 | ifeq ($(OS), MINGW) |
179 | TARGET = mupen64plus$(POSTFIX).dll |
180 | LDFLAGS += -Wl,-Bsymbolic -shared -Wl,-export-all-symbols |
181 | # only export api symbols |
182 | LDFLAGS += -Wl,-version-script,$(SRCDIR)/api/api_export.ver |
183 | LDLIBS += -lpthread |
184 | endif |
185 | |
186 | ifeq ($(CPU_ENDIANNESS), BIG) |
187 | CFLAGS += -DM64P_BIG_ENDIAN |
188 | endif |
189 | |
190 | # disable verbose output |
191 | ifneq ($(findstring $(MAKEFLAGS),s),s) |
192 | ifndef V |
193 | Q_CC = @echo ' CC '$@; |
194 | Q_CXX = @echo ' CXX '$@; |
195 | Q_LD = @echo ' LD '$@; |
196 | endif |
197 | endif |
198 | |
199 | # test for essential build dependencies |
200 | ifeq ($(origin PKG_CONFIG), undefined) |
201 | PKG_CONFIG = $(CROSS_COMPILE)pkg-config |
202 | ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),) |
203 | $(error $(PKG_CONFIG) not found) |
204 | endif |
205 | endif |
206 | |
207 | ifeq ($(OS), OSX) # use system zlib on OSX |
208 | ZLIB_LDLIBS += -lz |
209 | endif |
210 | |
211 | ifeq ($(origin ZLIB_CFLAGS) $(origin ZLIB_LDLIBS), undefined undefined) |
212 | ifeq ($(shell $(PKG_CONFIG) --modversion zlib 2>/dev/null),) |
213 | $(error No zlib development libraries found!) |
214 | endif |
215 | ZLIB_CFLAGS += $(shell $(PKG_CONFIG) --cflags zlib) |
216 | ZLIB_LDLIBS += $(shell $(PKG_CONFIG) --libs zlib) |
217 | endif |
218 | CFLAGS += $(ZLIB_CFLAGS) |
219 | LDLIBS += $(ZLIB_LDLIBS) |
220 | |
221 | ifeq ($(origin LIBPNG_CFLAGS) $(origin LIBPNG_LDLIBS), undefined undefined) |
222 | ifeq ($(shell $(PKG_CONFIG) --modversion libpng 2>/dev/null),) |
223 | $(error No libpng development libraries found!) |
224 | endif |
225 | LIBPNG_CFLAGS += $(shell $(PKG_CONFIG) --cflags libpng) |
226 | LIBPNG_LDLIBS += $(shell $(PKG_CONFIG) --libs libpng) |
227 | endif |
228 | CFLAGS += $(LIBPNG_CFLAGS) |
229 | LDLIBS += $(LIBPNG_LDLIBS) |
230 | |
231 | # test for presence of SDL |
232 | ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined) |
233 | SDL_CONFIG = $(CROSS_COMPILE)sdl-config |
234 | ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),) |
235 | $(error No SDL development libraries found!) |
236 | endif |
237 | SDL_CFLAGS += $(shell $(SDL_CONFIG) --cflags) |
238 | SDL_LDLIBS += $(shell $(SDL_CONFIG) --libs) |
239 | endif |
240 | CFLAGS += $(SDL_CFLAGS) |
241 | LDLIBS += $(SDL_LDLIBS) -lEGL |
242 | |
243 | OSD ?= 1 |
244 | ifeq ($(OSD), 1) |
245 | CFLAGS += -DM64P_OSD |
246 | |
247 | ifeq ($(origin FREETYPE2_CFLAGS) $(origin FREETYPE2_LDLIBS), undefined undefined) |
248 | ifeq ($(shell $(PKG_CONFIG) --modversion freetype2 2>/dev/null),) |
249 | $(error No freetype2 development libraries found!) |
250 | endif |
251 | FREETYPE2_CFLAGS += $(shell $(PKG_CONFIG) --cflags freetype2) |
252 | FREETYPE2_LDLIBS += $(shell $(PKG_CONFIG) --libs freetype2) |
253 | endif |
254 | CFLAGS += $(FREETYPE2_CFLAGS) |
255 | LDLIBS += $(FREETYPE2_LDLIBS) |
256 | |
257 | # search for OpenGL libraries |
258 | ifeq ($(OS), OSX) |
259 | GL_LDLIBS = -framework OpenGL |
260 | GLU_LDLIBS = -framework OpenGL |
261 | endif |
262 | ifeq ($(OS), MINGW) |
263 | GL_LDLIBS = -lopengl32 |
264 | GLU_LDLIBS = -lglu32 |
265 | endif |
266 | |
267 | ifeq ($(origin GL_CFLAGS) $(origin GL_LDLIBS), undefined undefined) |
268 | ifeq ($(shell $(PKG_CONFIG) --modversion gl 2>/dev/null),) |
269 | $(error No OpenGL development libraries found!) |
270 | endif |
271 | GL_CFLAGS += $(shell $(PKG_CONFIG) --cflags glesv2) |
272 | GL_LDLIBS += $(shell $(PKG_CONFIG) --libs glesv2) |
273 | endif |
274 | CFLAGS += $(GL_CFLAGS) |
275 | LDLIBS += -lGL2 |
276 | # LDLIBS += $(GL_LDLIBS) |
277 | |
278 | ifeq ($(origin GLU_CFLAGS) $(origin GLU_LDLIBS), undefined undefined) |
279 | ifeq ($(shell $(PKG_CONFIG) --modversion glu 2>/dev/null),) |
280 | $(error No OpenGL utility development libraries found!) |
281 | endif |
282 | GLU_CFLAGS += $(shell $(PKG_CONFIG) --cflags glu) |
283 | GLU_LDLIBS += $(shell $(PKG_CONFIG) --libs glu) |
284 | endif |
285 | CFLAGS += $(GLU_CFLAGS) |
286 | LDLIBS += -lGLU |
287 | # LDLIBS += $(GLU_LDLIBS) |
288 | endif |
289 | |
290 | # set base program pointers and flags |
291 | CC = $(CROSS_COMPILE)gcc |
292 | CXX = $(CROSS_COMPILE)g++ |
293 | RM ?= rm -f |
294 | INSTALL ?= install |
295 | MKDIR ?= mkdir -p |
296 | COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c |
297 | COMPILE.cc = $(Q_CXX)$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c |
298 | LINK.o = $(Q_LD)$(CXX) $(CXXFLAGS) $(LDFLAGS) $(TARGET_ARCH) |
299 | |
300 | ifeq ($(OS),OSX) |
301 | LDCONFIG ?= true # no 'ldconfig' under OSX |
302 | else |
303 | ifeq ($(OS),LINUX) |
304 | LDCONFIG ?= PATH="$$PATH:/sbin" ldconfig -n |
305 | endif |
306 | ifeq ($(OS),FREEBSD) |
307 | LDCONFIG ?= PATH="$$PATH:/sbin" ldconfig -m |
308 | endif |
309 | endif |
310 | |
311 | # compiler/linker flags for various compile-time options. |
312 | # 1. macro for no assembly language |
313 | ifeq ($(NO_ASM), 1) |
314 | CFLAGS += -DNO_ASM |
315 | endif |
316 | # 2. variables for profiling and adding debugging symbols |
317 | ifeq ($(PROFILE), 1) |
318 | CFLAGS += -pg -g |
319 | INSTALL_STRIP_FLAG ?= |
320 | else |
321 | ifeq ($(DEBUG), 1) |
322 | CFLAGS += -g |
323 | INSTALL_STRIP_FLAG ?= |
324 | else |
325 | ifneq ($(OS),OSX) |
326 | INSTALL_STRIP_FLAG ?= -s |
327 | endif |
328 | endif |
329 | endif |
330 | # 3. other options given to the makefile on the command line |
331 | ifeq ($(LIRC), 1) |
332 | CFLAGS += -DWITH_LIRC |
333 | endif |
334 | ifeq ($(DEBUGGER), 1) |
335 | CFLAGS += -DDBG |
336 | endif |
337 | ifeq ($(DBG_COMPARE), 1) |
338 | CFLAGS += -DCOMPARE_CORE |
339 | endif |
340 | ifeq ($(DBG_CORE), 1) |
341 | CFLAGS += -DCORE_DBG |
342 | endif |
343 | ifeq ($(DBG_COUNT), 1) |
344 | CFLAGS += -DCOUNT_INSTR |
345 | endif |
346 | ifeq ($(DBG_TIMING), 1) |
347 | CFLAGS += -DPROFILE |
348 | LDFLAGS += -lrt |
349 | endif |
350 | ifeq ($(DBG_PROFILE), 1) |
351 | CFLAGS += -DPROFILE_R4300 |
352 | endif |
353 | # 4. compile-time directory paths for building into the library |
354 | ifneq ($(SHAREDIR),) |
355 | CFLAGS += -DSHAREDIR="$(SHAREDIR)" |
356 | endif |
357 | |
358 | # set installation options |
359 | ifeq ($(PREFIX),) |
360 | PREFIX := /usr/local |
361 | endif |
362 | ifeq ($(SHAREDIR),) |
363 | SHAREDIR := $(PREFIX)/share/mupen64plus |
364 | endif |
365 | ifeq ($(LIBDIR),) |
366 | LIBDIR := $(PREFIX)/lib |
367 | endif |
368 | ifeq ($(INCDIR),) |
369 | INCDIR := $(PREFIX)/include/mupen64plus |
370 | endif |
371 | |
372 | SRCDIR = ../../src |
373 | OBJDIR = _obj$(POSTFIX) |
374 | |
375 | # list of required source files for compilation |
376 | SOURCE = \ |
377 | $(SRCDIR)/api/callbacks.c \ |
378 | $(SRCDIR)/api/common.c \ |
379 | $(SRCDIR)/api/config.c \ |
380 | $(SRCDIR)/api/debugger.c \ |
381 | $(SRCDIR)/api/frontend.c \ |
382 | $(SRCDIR)/api/vidext.c \ |
383 | $(SRCDIR)/main/main.c \ |
384 | $(SRCDIR)/main/util.c \ |
385 | $(SRCDIR)/main/cheat.c \ |
386 | $(SRCDIR)/main/eventloop.c \ |
387 | $(SRCDIR)/main/md5.c \ |
388 | $(SRCDIR)/main/rom.c \ |
389 | $(SRCDIR)/main/savestates.c \ |
390 | $(SRCDIR)/main/workqueue.c \ |
391 | $(SRCDIR)/memory/dma.c \ |
392 | $(SRCDIR)/memory/flashram.c \ |
393 | $(SRCDIR)/memory/memory.c \ |
394 | $(SRCDIR)/memory/n64_cic_nus_6105.c \ |
395 | $(SRCDIR)/memory/pif.c \ |
396 | $(SRCDIR)/memory/tlb.c \ |
397 | $(SRCDIR)/plugin/plugin.c \ |
398 | $(SRCDIR)/plugin/dummy_video.c \ |
399 | $(SRCDIR)/plugin/dummy_audio.c \ |
400 | $(SRCDIR)/plugin/dummy_input.c \ |
401 | $(SRCDIR)/plugin/dummy_rsp.c \ |
402 | $(SRCDIR)/r4300/r4300.c \ |
403 | $(SRCDIR)/r4300/exception.c \ |
404 | $(SRCDIR)/r4300/interupt.c \ |
405 | $(SRCDIR)/r4300/profile.c \ |
406 | $(SRCDIR)/r4300/pure_interp.c \ |
407 | $(SRCDIR)/r4300/recomp.c \ |
408 | $(SRCDIR)/r4300/reset.c \ |
409 | $(SRCDIR)/osd/screenshot.cpp |
410 | ifeq ("$(OS)","MINGW") |
411 | SOURCE += \ |
412 | $(SRCDIR)/osal/dynamiclib_win32.c \ |
413 | $(SRCDIR)/osal/files_win32.c |
414 | else |
415 | SOURCE += \ |
416 | $(SRCDIR)/osal/dynamiclib_unix.c \ |
417 | $(SRCDIR)/osal/files_unix.c |
418 | endif |
419 | |
420 | ifeq ($(OSD), 1) |
421 | SOURCE += \ |
422 | $(SRCDIR)/osd/OGLFT.cpp \ |
423 | $(SRCDIR)/osd/osd.cpp |
424 | else |
425 | SOURCE += \ |
426 | $(SRCDIR)/api/eglport.cpp |
427 | endif |
428 | |
429 | # source files for optional features |
430 | ifneq ($(NO_ASM), 1) |
431 | ifeq ($(CPU), X86) |
432 | ifeq ($(ARCH_DETECTED), 64BITS) |
433 | DYNAREC = x86_64 |
434 | else |
435 | DYNAREC = x86 |
436 | endif |
437 | endif |
438 | ifeq ($(CPU), ARM) |
439 | ifeq ($(ARCH_DETECTED), 32BITS) |
440 | DYNAREC = arm |
441 | CFLAGS += -DPANDORA |
442 | endif |
443 | endif |
444 | endif |
445 | ifneq ($(DYNAREC), ) |
446 | CFLAGS += -DDYNAREC |
447 | |
448 | ifeq ($(NEW_DYNAREC), 1) |
449 | ifeq ($(DYNAREC), x86) |
450 | CFLAGS += -DNEW_DYNAREC=1 |
451 | else |
452 | ifeq ($(DYNAREC), arm) |
453 | CFLAGS += -DNEW_DYNAREC=3 |
454 | else |
455 | $(error NEW_DYNAREC is only supported on 32 bit x86 and 32 bit armel) |
456 | endif |
457 | endif |
458 | |
459 | SOURCE += \ |
460 | $(SRCDIR)/r4300/empty_dynarec.c \ |
461 | $(SRCDIR)/r4300/new_dynarec/linkage_$(DYNAREC).S \ |
462 | $(SRCDIR)/r4300/new_dynarec/new_dynarec.c |
463 | else |
464 | SOURCE += \ |
465 | $(SRCDIR)/r4300/$(DYNAREC)/assemble.c \ |
466 | $(SRCDIR)/r4300/$(DYNAREC)/gbc.c \ |
467 | $(SRCDIR)/r4300/$(DYNAREC)/gcop0.c \ |
468 | $(SRCDIR)/r4300/$(DYNAREC)/gcop1.c \ |
469 | $(SRCDIR)/r4300/$(DYNAREC)/gcop1_d.c \ |
470 | $(SRCDIR)/r4300/$(DYNAREC)/gcop1_l.c \ |
471 | $(SRCDIR)/r4300/$(DYNAREC)/gcop1_s.c \ |
472 | $(SRCDIR)/r4300/$(DYNAREC)/gcop1_w.c \ |
473 | $(SRCDIR)/r4300/$(DYNAREC)/gr4300.c \ |
474 | $(SRCDIR)/r4300/$(DYNAREC)/gregimm.c \ |
475 | $(SRCDIR)/r4300/$(DYNAREC)/gspecial.c \ |
476 | $(SRCDIR)/r4300/$(DYNAREC)/gtlb.c \ |
477 | $(SRCDIR)/r4300/$(DYNAREC)/regcache.c \ |
478 | $(SRCDIR)/r4300/$(DYNAREC)/rjump.c |
479 | endif |
480 | else |
481 | SOURCE += $(SRCDIR)/r4300/empty_dynarec.c |
482 | endif |
483 | |
484 | ifeq ($(LIRC), 1) |
485 | SOURCE += $(SRCDIR)/main/lirc.c |
486 | LDLIBS += -llirc_client |
487 | endif |
488 | |
489 | ifeq ($(shell $(PKG_CONFIG) --modversion minizip 2>/dev/null),) |
490 | SOURCE += \ |
491 | $(SRCDIR)/main/zip/ioapi.c \ |
492 | $(SRCDIR)/main/zip/zip.c \ |
493 | $(SRCDIR)/main/zip/unzip.c |
494 | |
495 | CFLAGS += -DNOCRYPT -DNOUNCRYPT |
496 | else |
497 | CFLAGS += $(shell $(PKG_CONFIG) --cflags minizip) -DLIBMINIZIP |
498 | LDLIBS += $(shell $(PKG_CONFIG) --libs minizip) |
499 | endif |
500 | |
501 | |
502 | ifeq ($(DEBUGGER), 1) |
503 | SOURCE += \ |
504 | $(SRCDIR)/debugger/debugger.c \ |
505 | $(SRCDIR)/debugger/dbg_decoder.c \ |
506 | $(SRCDIR)/debugger/dbg_memory.c \ |
507 | $(SRCDIR)/debugger/dbg_breakpoints.c |
508 | LDLIBS += -lopcodes -lbfd |
509 | endif |
510 | |
511 | # generate a list of object files to build, make a temporary directory for them |
512 | OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter %.c, $(SOURCE))) |
513 | OBJECTS += $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(filter %.cpp, $(SOURCE))) |
514 | OBJECTS += $(patsubst $(SRCDIR)/%.S, $(OBJDIR)/%.o, $(filter %.S, $(SOURCE))) |
515 | OBJDIRS = $(dir $(OBJECTS)) |
516 | $(shell $(MKDIR) $(OBJDIRS)) |
517 | |
518 | # build targets |
519 | targets: |
520 | @echo "Mupen64Plus-core makefile. " |
521 | @echo " Targets:" |
522 | @echo " all == Build Mupen64Plus core library" |
523 | @echo " clean == remove object files" |
524 | @echo " install == Install Mupen64Plus core library" |
525 | @echo " uninstall == Uninstall Mupen64Plus core library" |
526 | @echo " Build Options:" |
527 | @echo " BITS=32 == build 32-bit binaries on 64-bit machine" |
528 | @echo " LIRC=1 == enable LIRC support" |
529 | @echo " NO_ASM=1 == build without assembly (no dynamic recompiler or MMX/SSE code)" |
530 | @echo " SHAREDIR=path == extra path to search for shared data files" |
531 | @echo " OPTFLAGS=flag == compiler optimization (default: -O3 )" |
532 | @echo " WARNFLAGS=flag == compiler warning levels (default: -Wall)" |
533 | @echo " PIC=(1|0) == Force enable/disable of position independent code" |
534 | @echo " OSD=(1|0) == Enable/disable build of OpenGL On-screen display" |
535 | @echo " NEW_DYNAREC=1 == Replace dynamic recompiler with Ari64's experimental dynarec" |
536 | @echo " POSTFIX=name == String added to the name of the the build (default: '')" |
537 | @echo " Install Options:" |
538 | @echo " PREFIX=path == install/uninstall prefix (default: /usr/local/)" |
539 | @echo " SHAREDIR=path == path to install shared data files (default: PREFIX/share/mupen64plus)" |
540 | @echo " LIBDIR=path == path to install core library (default: PREFIX/lib)" |
541 | @echo " INCDIR=path == path to install core header files (default: PREFIX/include/mupen64plus)" |
542 | @echo " DESTDIR=path == path to prepend to all installation paths (only for packagers)" |
543 | @echo " Debugging Options:" |
544 | @echo " PROFILE=1 == build gprof instrumentation into binaries for profiling" |
545 | @echo " DEBUG=1 == add debugging symbols to binaries" |
546 | @echo " DEBUGGER=1 == build debugger API into core for front-ends. runs slower." |
547 | @echo " DBG_CORE=1 == print debugging info in r4300 core" |
548 | @echo " DBG_COUNT=1 == print R4300 instruction count totals (64-bit dynarec only)" |
549 | @echo " DBG_COMPARE=1 == enable core-synchronized r4300 debugging" |
550 | @echo " DBG_TIMING=1 == print timing data" |
551 | @echo " DBG_PROFILE=1 == dump profiling data for r4300 dynarec to data file" |
552 | @echo " V=1 == show verbose compiler output" |
553 | |
554 | all: $(TARGET) |
555 | |
556 | install: $(TARGET) |
557 | $(INSTALL) -d "$(DESTDIR)$(LIBDIR)" |
558 | $(INSTALL) -m 0644 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(LIBDIR)" |
559 | $(INSTALL) -d "$(DESTDIR)$(SHAREDIR)" |
560 | $(INSTALL) -m 0644 ../../data/* "$(DESTDIR)$(SHAREDIR)" |
561 | $(INSTALL) -d "$(DESTDIR)$(INCDIR)" |
562 | $(INSTALL) -m 0644 ../../src/api/m64p_*.h "$(DESTDIR)$(INCDIR)" |
563 | -$(LDCONFIG) "$(DESTDIR)$(LIBDIR)" |
564 | if [ ! -e "$(DESTDIR)$(LIBDIR)/$(SONAME)" ]; then ln -sf "$(TARGET)" "$(DESTDIR)$(LIBDIR)/$(SONAME)"; fi |
565 | |
566 | uninstall: |
567 | $(RM) "$(DESTDIR)$(LIBDIR)/$(TARGET)" |
568 | if [ "$(SONAME)" != "" ]; then $(RM) "$(DESTDIR)$(LIBDIR)/$(SONAME)"; fi |
569 | $(RM) $(DESTDIR)$(INCDIR)/m64p_*.h |
570 | $(RM) "$(DESTDIR)$(SHAREDIR)/mupen64plus.cht" |
571 | $(RM) "$(DESTDIR)$(SHAREDIR)/mupen64plus.ini" |
572 | $(RM) "$(DESTDIR)$(SHAREDIR)/font.ttf" |
573 | $(RM) "$(DESTDIR)$(SHAREDIR)/mupencheat.txt" |
574 | |
575 | clean: |
576 | $(RM) -r $(TARGET) $(SONAME) $(OBJDIR) |
577 | |
578 | # build dependency files |
579 | CFLAGS += -MD |
580 | -include $(OBJECTS:.o=.d) |
581 | |
582 | CXXFLAGS += $(CFLAGS) |
583 | |
584 | # standard build rules |
585 | $(OBJDIR)/%.o: $(SRCDIR)/%.S |
586 | $(COMPILE.c) -o $@ $< |
587 | |
588 | $(OBJDIR)/%.o: $(SRCDIR)/%.c |
589 | $(COMPILE.c) -o $@ $< |
590 | |
591 | $(OBJDIR)/%.o: $(SRCDIR)/%.cpp |
592 | $(COMPILE.cc) -o $@ $< |
593 | |
594 | $(TARGET): $(OBJECTS) |
595 | $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ |
596 | if [ "$(SONAME)" != "" ]; then ln -sf $@ $(SONAME); fi |
597 | |
598 | .PHONY: all clean install uninstall targets |