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