86bdf04e7a73190da8eb1f3c2bedff1910933e88
[mupen64plus-pandora.git] / source / mupen64plus-core / projects / unix / Makefile
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
97         OSD ?= 0
98     NEW_DYNAREC := 1
99     #CFLAGS += -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mtune=cortex-a8
100     CFLAGS += -mcpu=native -mtune=native -marm -mfpu=neon
101     CFLAGS += -fsigned-char -ffast-math -Wno-maybe-uninitialized -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-comment 
102     # $(warning Architecture "$(HOST_CPU)" not officially supported.')
103   endif
104 endif
105 ifeq ("$(CPU)","NONE")
106   $(error CPU type "$(HOST_CPU)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
107 endif
108
109 # base CFLAGS, LDLIBS, and LDFLAGS
110 OPTFLAGS ?= -O3
111 WARNFLAGS ?= -Wall
112 CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src -DM64P_PARALLEL
113 CXXFLAGS += -fvisibility-inlines-hidden
114 LDLIBS +=  -lm
115
116 # Since we are building a shared library, we must compile with -fPIC on some architectures
117 # 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
118 ifeq ($(PIC), 1)
119   CFLAGS += -fPIC
120 else
121   CFLAGS += -fno-PIC
122 endif
123
124 ifeq ($(BIG_ENDIAN), 1)
125   CFLAGS += -DM64P_BIG_ENDIAN
126 endif
127
128 # tweak flags for 32-bit build on 64-bit system
129 ifeq ($(ARCH_DETECTED), 64BITS_32)
130   ifeq ($(OS), FREEBSD)
131     $(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
132   endif
133   CFLAGS += -m32
134   LDFLAGS += -Wl,-m,elf_i386
135 endif
136
137 # set special flags per-system
138 ifeq ($(OS), FREEBSD)
139   TARGET = libmupen64plus$(POSTFIX).so.2.0.0
140   SONAME = libmupen64plus$(POSTFIX).so.2
141   LDFLAGS += -Wl,-Bsymbolic -shared -Wl,-export-dynamic -Wl,-soname,$(SONAME)
142   LDLIBS += -L${LOCALBASE}/lib -lc
143 endif
144 ifeq ($(OS), LINUX)
145   TARGET = libmupen64plus$(POSTFIX).so.2.0.0
146   SONAME = libmupen64plus$(POSTFIX).so.2
147   LDFLAGS += -Wl,-Bsymbolic -shared -Wl,-export-dynamic -Wl,-soname,$(SONAME)
148   LDLIBS += -ldl
149   # only export api symbols
150   LDFLAGS += -Wl,-version-script,$(SRCDIR)/api/api_export.ver
151 endif
152 ifeq ($(OS), OSX)
153   #xcode-select has been around since XCode 3.0, i.e. OS X 10.5
154   OSX_SDK_ROOT = $(shell xcode-select -print-path)/Platforms/MacOSX.platform/Developer/SDKs
155   OSX_SDK_PATH = $(OSX_SDK_ROOT)/$(shell ls $(OSX_SDK_ROOT) | tail -1)
156
157   TARGET = libmupen64plus$(POSTFIX).dylib
158   LDFLAGS += -bundle -read_only_relocs suppress
159   LDLIBS += -ldl
160   ifeq ($(CPU), X86)
161     ifeq ($(ARCH_DETECTED), 64BITS)
162       CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot $(OSX_SDK_PATH)
163     else
164       CFLAGS += -pipe -mmmx -msse -arch i686 -mmacosx-version-min=10.5 -isysroot $(OSX_SDK_PATH)
165       ifneq ($(PROFILE), 1)
166         CFLAGS += -fomit-frame-pointer
167       endif
168     endif
169   endif
170 endif
171 ifeq ($(OS), MINGW)
172   TARGET = mupen64plus$(POSTFIX).dll
173   LDFLAGS += -Wl,-Bsymbolic -shared -Wl,-export-all-symbols
174   # only export api symbols
175   LDFLAGS += -Wl,-version-script,$(SRCDIR)/api/api_export.ver
176   LDLIBS += -lpthread
177 endif
178
179 ifeq ($(CPU_ENDIANNESS), BIG)
180   CFLAGS += -DM64P_BIG_ENDIAN
181 endif
182
183 # disable verbose output
184 ifneq ($(findstring $(MAKEFLAGS),s),s)
185 ifndef V
186         Q_CC  = @echo '    CC  '$@;
187         Q_CXX = @echo '    CXX '$@;
188         Q_LD  = @echo '    LD  '$@;
189 endif
190 endif
191
192 # test for essential build dependencies
193 ifeq ($(origin PKG_CONFIG), undefined)
194   PKG_CONFIG = $(CROSS_COMPILE)pkg-config
195   ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),)
196     $(error $(PKG_CONFIG) not found)
197   endif
198 endif
199
200 ifeq ($(OS), OSX) # use system zlib on OSX
201   ZLIB_LDLIBS += -lz
202 endif
203
204 ifeq ($(origin ZLIB_CFLAGS) $(origin ZLIB_LDLIBS), undefined undefined)
205   ifeq ($(shell $(PKG_CONFIG) --modversion zlib 2>/dev/null),)
206     $(error No zlib development libraries found!)
207   endif
208   ZLIB_CFLAGS += $(shell $(PKG_CONFIG) --cflags zlib)
209   ZLIB_LDLIBS +=  $(shell $(PKG_CONFIG) --libs zlib)
210 endif
211 CFLAGS += $(ZLIB_CFLAGS)
212 LDLIBS += $(ZLIB_LDLIBS)
213
214 ifeq ($(origin LIBPNG_CFLAGS) $(origin LIBPNG_LDLIBS), undefined undefined)
215   ifeq ($(shell $(PKG_CONFIG) --modversion libpng 2>/dev/null),)
216     $(error No libpng development libraries found!)
217   endif
218   LIBPNG_CFLAGS += $(shell $(PKG_CONFIG) --cflags libpng)
219   LIBPNG_LDLIBS +=  $(shell $(PKG_CONFIG) --libs libpng)
220 endif
221 CFLAGS += $(LIBPNG_CFLAGS)
222 LDLIBS += $(LIBPNG_LDLIBS)
223
224 # test for presence of SDL
225 ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined)
226   SDL_CONFIG = $(CROSS_COMPILE)sdl-config
227   ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
228     $(error No SDL development libraries found!)
229   endif
230   SDL_CFLAGS  += $(shell $(SDL_CONFIG) --cflags)
231   SDL_LDLIBS += $(shell $(SDL_CONFIG) --libs)
232 endif
233 CFLAGS += $(SDL_CFLAGS)
234 LDLIBS += $(SDL_LDLIBS) -lEGL
235
236 OSD ?= 1
237 ifeq ($(OSD), 1)
238   CFLAGS += -DM64P_OSD
239
240   ifeq ($(origin FREETYPE2_CFLAGS) $(origin FREETYPE2_LDLIBS), undefined undefined)
241     ifeq ($(shell $(PKG_CONFIG) --modversion freetype2 2>/dev/null),)
242       $(error No freetype2 development libraries found!)
243     endif
244     FREETYPE2_CFLAGS += $(shell $(PKG_CONFIG) --cflags freetype2)
245     FREETYPE2_LDLIBS +=  $(shell $(PKG_CONFIG) --libs freetype2)
246   endif
247   CFLAGS += $(FREETYPE2_CFLAGS)
248   LDLIBS += $(FREETYPE2_LDLIBS)
249
250   # search for OpenGL libraries
251   ifeq ($(OS), OSX)
252     GL_LDLIBS = -framework OpenGL
253     GLU_LDLIBS = -framework OpenGL
254   endif
255   ifeq ($(OS), MINGW)
256     GL_LDLIBS = -lopengl32
257     GLU_LDLIBS = -lglu32
258   endif
259
260   ifeq ($(origin GL_CFLAGS) $(origin GL_LDLIBS), undefined undefined)
261     ifeq ($(shell $(PKG_CONFIG) --modversion gl 2>/dev/null),)
262       $(error No OpenGL development libraries found!)
263     endif
264     GL_CFLAGS += $(shell $(PKG_CONFIG) --cflags glesv2)
265     GL_LDLIBS +=  $(shell $(PKG_CONFIG) --libs glesv2)
266   endif
267   CFLAGS += $(GL_CFLAGS)
268   LDLIBS += -lGL2
269 #  LDLIBS += $(GL_LDLIBS)
270
271   ifeq ($(origin GLU_CFLAGS) $(origin GLU_LDLIBS), undefined undefined)
272     ifeq ($(shell $(PKG_CONFIG) --modversion glu 2>/dev/null),)
273       $(error No OpenGL utility development libraries found!)
274     endif
275     GLU_CFLAGS += $(shell $(PKG_CONFIG) --cflags glu)
276     GLU_LDLIBS +=  $(shell $(PKG_CONFIG) --libs glu)
277   endif
278   CFLAGS += $(GLU_CFLAGS)
279   LDLIBS += -lGLU
280 #  LDLIBS += $(GLU_LDLIBS)
281 endif
282
283 # set base program pointers and flags
284 CC        = $(CROSS_COMPILE)gcc
285 CXX       = $(CROSS_COMPILE)g++
286 RM       ?= rm -f
287 INSTALL  ?= install
288 MKDIR ?= mkdir -p
289 COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
290 COMPILE.cc = $(Q_CXX)$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
291 LINK.o = $(Q_LD)$(CXX) $(CXXFLAGS) $(LDFLAGS) $(TARGET_ARCH)
292
293 ifeq ($(OS),OSX)
294   LDCONFIG ?= true  # no 'ldconfig' under OSX
295 else
296   ifeq ($(OS),LINUX)
297     LDCONFIG ?= PATH="$$PATH:/sbin" ldconfig -n
298   endif
299   ifeq ($(OS),FREEBSD)
300     LDCONFIG ?= PATH="$$PATH:/sbin" ldconfig -m
301   endif
302 endif
303
304 # compiler/linker flags for various compile-time options.
305 # 1. macro for no assembly language
306 ifeq ($(NO_ASM), 1)
307   CFLAGS += -DNO_ASM
308 endif
309 # 2. variables for profiling and adding debugging symbols
310 ifeq ($(PROFILE), 1)
311   CFLAGS += -pg -g
312   INSTALL_STRIP_FLAG ?= 
313 else
314   ifeq ($(DEBUG), 1)
315     CFLAGS += -g
316     INSTALL_STRIP_FLAG ?= 
317   else
318     ifneq ($(OS),OSX)
319       INSTALL_STRIP_FLAG ?= -s
320         endif
321   endif
322 endif
323 # 3. other options given to the makefile on the command line
324 ifeq ($(LIRC), 1)
325   CFLAGS += -DWITH_LIRC
326 endif
327 ifeq ($(DEBUGGER), 1)
328   CFLAGS += -DDBG
329 endif
330 ifeq ($(DBG_COMPARE), 1)
331   CFLAGS += -DCOMPARE_CORE
332 endif
333 ifeq ($(DBG_CORE), 1)
334   CFLAGS += -DCORE_DBG
335 endif
336 ifeq ($(DBG_COUNT), 1)
337   CFLAGS += -DCOUNT_INSTR
338 endif
339 ifeq ($(DBG_TIMING), 1)
340   CFLAGS += -DPROFILE
341   LDFLAGS += -lrt
342 endif
343 ifeq ($(DBG_PROFILE), 1)
344   CFLAGS += -DPROFILE_R4300
345 endif
346 # 4. compile-time directory paths for building into the library
347 ifneq ($(SHAREDIR),)
348   CFLAGS += -DSHAREDIR="$(SHAREDIR)"
349 endif
350
351 # set installation options
352 ifeq ($(PREFIX),)
353   PREFIX := /usr/local
354 endif
355 ifeq ($(SHAREDIR),)
356   SHAREDIR := $(PREFIX)/share/mupen64plus
357 endif
358 ifeq ($(LIBDIR),)
359   LIBDIR := $(PREFIX)/lib
360 endif
361 ifeq ($(INCDIR),)
362   INCDIR := $(PREFIX)/include/mupen64plus
363 endif
364
365 SRCDIR = ../../src
366 OBJDIR = _obj$(POSTFIX)
367
368 # list of required source files for compilation
369 SOURCE = \
370         $(SRCDIR)/api/callbacks.c \
371         $(SRCDIR)/api/common.c \
372         $(SRCDIR)/api/config.c \
373         $(SRCDIR)/api/debugger.c \
374         $(SRCDIR)/api/frontend.c \
375         $(SRCDIR)/api/vidext.c \
376         $(SRCDIR)/main/main.c \
377         $(SRCDIR)/main/util.c \
378         $(SRCDIR)/main/cheat.c \
379         $(SRCDIR)/main/eventloop.c \
380         $(SRCDIR)/main/md5.c \
381         $(SRCDIR)/main/rom.c \
382         $(SRCDIR)/main/savestates.c \
383         $(SRCDIR)/main/workqueue.c \
384         $(SRCDIR)/memory/dma.c \
385         $(SRCDIR)/memory/flashram.c \
386         $(SRCDIR)/memory/memory.c \
387         $(SRCDIR)/memory/n64_cic_nus_6105.c \
388         $(SRCDIR)/memory/pif.c \
389         $(SRCDIR)/memory/tlb.c \
390         $(SRCDIR)/plugin/plugin.c \
391         $(SRCDIR)/plugin/dummy_video.c \
392         $(SRCDIR)/plugin/dummy_audio.c \
393         $(SRCDIR)/plugin/dummy_input.c \
394         $(SRCDIR)/plugin/dummy_rsp.c \
395         $(SRCDIR)/r4300/r4300.c \
396         $(SRCDIR)/r4300/exception.c \
397         $(SRCDIR)/r4300/interupt.c \
398         $(SRCDIR)/r4300/profile.c \
399         $(SRCDIR)/r4300/pure_interp.c \
400         $(SRCDIR)/r4300/recomp.c \
401         $(SRCDIR)/r4300/reset.c \
402         $(SRCDIR)/osd/screenshot.cpp
403 ifeq ("$(OS)","MINGW")
404 SOURCE += \
405         $(SRCDIR)/osal/dynamiclib_win32.c \
406         $(SRCDIR)/osal/files_win32.c
407 else
408 SOURCE += \
409         $(SRCDIR)/osal/dynamiclib_unix.c \
410         $(SRCDIR)/osal/files_unix.c
411 endif
412
413 ifeq ($(OSD), 1)
414 SOURCE += \
415         $(SRCDIR)/osd/OGLFT.cpp \
416         $(SRCDIR)/osd/osd.cpp
417 else
418 SOURCE += \
419         $(SRCDIR)/api/eglport.cpp
420 endif
421
422 # source files for optional features
423 ifneq ($(NO_ASM), 1)
424   ifeq ($(CPU), X86)
425     ifeq ($(ARCH_DETECTED), 64BITS)
426       DYNAREC = x86_64
427     else
428       DYNAREC = x86
429     endif
430   endif
431   ifeq ($(CPU), ARM)
432     ifeq ($(ARCH_DETECTED), 32BITS)
433       DYNAREC = arm
434           CFLAGS += -DPANDORA
435     endif
436   endif
437 endif
438 ifneq ($(DYNAREC), )
439   CFLAGS += -DDYNAREC
440
441   ifeq ($(NEW_DYNAREC), 1)
442     ifeq ($(DYNAREC), x86)
443       CFLAGS += -DNEW_DYNAREC=1
444     else
445       ifeq ($(DYNAREC), arm)
446         CFLAGS += -DNEW_DYNAREC=3
447       else
448         $(error NEW_DYNAREC is only supported on 32 bit x86 and 32 bit armel)
449       endif
450     endif
451
452     SOURCE += \
453       $(SRCDIR)/r4300/empty_dynarec.c \
454       $(SRCDIR)/r4300/new_dynarec/linkage_$(DYNAREC).S \
455       $(SRCDIR)/r4300/new_dynarec/new_dynarec.c
456   else
457     SOURCE += \
458       $(SRCDIR)/r4300/$(DYNAREC)/assemble.c \
459       $(SRCDIR)/r4300/$(DYNAREC)/gbc.c \
460       $(SRCDIR)/r4300/$(DYNAREC)/gcop0.c \
461       $(SRCDIR)/r4300/$(DYNAREC)/gcop1.c \
462       $(SRCDIR)/r4300/$(DYNAREC)/gcop1_d.c \
463       $(SRCDIR)/r4300/$(DYNAREC)/gcop1_l.c \
464       $(SRCDIR)/r4300/$(DYNAREC)/gcop1_s.c \
465       $(SRCDIR)/r4300/$(DYNAREC)/gcop1_w.c \
466       $(SRCDIR)/r4300/$(DYNAREC)/gr4300.c \
467       $(SRCDIR)/r4300/$(DYNAREC)/gregimm.c \
468       $(SRCDIR)/r4300/$(DYNAREC)/gspecial.c \
469       $(SRCDIR)/r4300/$(DYNAREC)/gtlb.c \
470       $(SRCDIR)/r4300/$(DYNAREC)/regcache.c \
471       $(SRCDIR)/r4300/$(DYNAREC)/rjump.c
472   endif
473 else
474   SOURCE += $(SRCDIR)/r4300/empty_dynarec.c
475 endif
476
477 ifeq ($(LIRC), 1)
478   SOURCE += $(SRCDIR)/main/lirc.c
479   LDLIBS += -llirc_client
480 endif
481
482 ifeq ($(shell $(PKG_CONFIG) --modversion minizip 2>/dev/null),)
483   SOURCE += \
484         $(SRCDIR)/main/zip/ioapi.c \
485         $(SRCDIR)/main/zip/zip.c \
486         $(SRCDIR)/main/zip/unzip.c
487
488   CFLAGS += -DNOCRYPT -DNOUNCRYPT
489 else
490   CFLAGS += $(shell $(PKG_CONFIG) --cflags minizip) -DLIBMINIZIP
491   LDLIBS +=  $(shell $(PKG_CONFIG) --libs minizip)
492 endif
493
494
495 ifeq ($(DEBUGGER), 1)
496   SOURCE += \
497         $(SRCDIR)/debugger/debugger.c \
498         $(SRCDIR)/debugger/dbg_decoder.c \
499         $(SRCDIR)/debugger/dbg_memory.c \
500         $(SRCDIR)/debugger/dbg_breakpoints.c
501   LDLIBS += -lopcodes -lbfd
502 endif
503
504 # generate a list of object files to build, make a temporary directory for them
505 OBJECTS := $(patsubst $(SRCDIR)/%.c,   $(OBJDIR)/%.o, $(filter %.c,   $(SOURCE)))
506 OBJECTS += $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(filter %.cpp, $(SOURCE)))
507 OBJECTS += $(patsubst $(SRCDIR)/%.S, $(OBJDIR)/%.o, $(filter %.S, $(SOURCE)))
508 OBJDIRS = $(dir $(OBJECTS))
509 $(shell $(MKDIR) $(OBJDIRS))
510
511 # build targets
512 targets:
513         @echo "Mupen64Plus-core makefile. "
514         @echo "  Targets:"
515         @echo "    all           == Build Mupen64Plus core library"
516         @echo "    clean         == remove object files"
517         @echo "    install       == Install Mupen64Plus core library"
518         @echo "    uninstall     == Uninstall Mupen64Plus core library"
519         @echo "  Build Options:"
520         @echo "    BITS=32       == build 32-bit binaries on 64-bit machine"
521         @echo "    LIRC=1        == enable LIRC support"
522         @echo "    NO_ASM=1      == build without assembly (no dynamic recompiler or MMX/SSE code)"
523         @echo "    SHAREDIR=path == extra path to search for shared data files"
524         @echo "    OPTFLAGS=flag == compiler optimization (default: -O3 )"
525         @echo "    WARNFLAGS=flag == compiler warning levels (default: -Wall)"
526         @echo "    PIC=(1|0)     == Force enable/disable of position independent code"
527         @echo "    OSD=(1|0)     == Enable/disable build of OpenGL On-screen display"
528         @echo "    NEW_DYNAREC=1 == Replace dynamic recompiler with Ari64's experimental dynarec"
529         @echo "    POSTFIX=name  == String added to the name of the the build (default: '')"
530         @echo "  Install Options:"
531         @echo "    PREFIX=path   == install/uninstall prefix (default: /usr/local/)"
532         @echo "    SHAREDIR=path == path to install shared data files (default: PREFIX/share/mupen64plus)"
533         @echo "    LIBDIR=path   == path to install core library (default: PREFIX/lib)"
534         @echo "    INCDIR=path   == path to install core header files (default: PREFIX/include/mupen64plus)"
535         @echo "    DESTDIR=path  == path to prepend to all installation paths (only for packagers)"
536         @echo "  Debugging Options:"
537         @echo "    PROFILE=1     == build gprof instrumentation into binaries for profiling"
538         @echo "    DEBUG=1       == add debugging symbols to binaries"
539         @echo "    DEBUGGER=1    == build debugger API into core for front-ends.  runs slower."
540         @echo "    DBG_CORE=1    == print debugging info in r4300 core"
541         @echo "    DBG_COUNT=1   == print R4300 instruction count totals (64-bit dynarec only)"
542         @echo "    DBG_COMPARE=1 == enable core-synchronized r4300 debugging"
543         @echo "    DBG_TIMING=1  == print timing data"
544         @echo "    DBG_PROFILE=1 == dump profiling data for r4300 dynarec to data file"
545         @echo "    V=1           == show verbose compiler output"
546
547 all: $(TARGET)
548
549 install: $(TARGET)
550         $(INSTALL) -d "$(DESTDIR)$(LIBDIR)"
551         $(INSTALL) -m 0644 $(INSTALL_STRIP_FLAG) $(TARGET) "$(DESTDIR)$(LIBDIR)"
552         $(INSTALL) -d "$(DESTDIR)$(SHAREDIR)"
553         $(INSTALL) -m 0644 ../../data/* "$(DESTDIR)$(SHAREDIR)"
554         $(INSTALL) -d "$(DESTDIR)$(INCDIR)"
555         $(INSTALL) -m 0644 ../../src/api/m64p_*.h "$(DESTDIR)$(INCDIR)"
556         -$(LDCONFIG) "$(DESTDIR)$(LIBDIR)"
557         if [ ! -e "$(DESTDIR)$(LIBDIR)/$(SONAME)" ]; then ln -sf "$(TARGET)" "$(DESTDIR)$(LIBDIR)/$(SONAME)"; fi
558
559 uninstall:
560         $(RM) "$(DESTDIR)$(LIBDIR)/$(TARGET)"
561         if [ "$(SONAME)" != "" ]; then $(RM) "$(DESTDIR)$(LIBDIR)/$(SONAME)"; fi
562         $(RM) $(DESTDIR)$(INCDIR)/m64p_*.h
563         $(RM) "$(DESTDIR)$(SHAREDIR)/mupen64plus.cht"
564         $(RM) "$(DESTDIR)$(SHAREDIR)/mupen64plus.ini"
565         $(RM) "$(DESTDIR)$(SHAREDIR)/font.ttf"
566         $(RM) "$(DESTDIR)$(SHAREDIR)/mupencheat.txt"
567
568 clean:
569         $(RM) -r $(TARGET) $(SONAME) $(OBJDIR)
570
571 # build dependency files
572 CFLAGS += -MD -MP
573 -include $(OBJECTS:.o=.d)
574
575 CXXFLAGS += $(CFLAGS)
576
577 # standard build rules
578 $(OBJDIR)/%.o: $(SRCDIR)/%.S
579         $(COMPILE.c) -o $@ $<
580
581 $(OBJDIR)/%.o: $(SRCDIR)/%.c
582         $(COMPILE.c) -o $@ $<
583
584 $(OBJDIR)/%.o: $(SRCDIR)/%.cpp
585         $(COMPILE.cc) -o $@ $<
586
587 $(TARGET): $(OBJECTS)
588         $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
589         if [ "$(SONAME)" != "" ]; then ln -sf $@ $(SONAME); fi
590
591 .PHONY: all clean install uninstall targets