1
#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
# * Mupen64plus - pre.mk *
3
# * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
4
# * Copyright (C) 2007-2008 DarkJeztr Tillin9 Richard42 *
6
# * This program is free software; you can redistribute it and/or modify *
7
# * it under the terms of the GNU General Public License as published by *
8
# * the Free Software Foundation; either version 2 of the License, or *
9
# * (at your option) any later version. *
11
# * This program is distributed in the hope that it will be useful, *
12
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
# * GNU General Public License for more details. *
16
# * You should have received a copy of the GNU General Public License *
17
# * along with this program; if not, write to the *
18
# * Free Software Foundation, Inc., *
19
# * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
20
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
22
# detect system architecture: i386, x86_64, or PPC/PPC64
23
UNAME = $(shell uname -m)
24
ifeq ("$(UNAME)","x86_64")
26
ifeq ("$(BITS)", "32")
32
ifneq ("$(filter i%86,$(UNAME))","")
36
ifeq ("$(UNAME)","ppc")
41
ifeq ("$(UNAME)","ppc64")
47
# detect operation system. Currently just linux and OSX.
48
UNAME = $(shell uname -s)
49
ifeq ("$(UNAME)","Linux")
52
ifeq ("$(UNAME)","linux")
55
ifeq ("$(UNAME)","Darwin")
57
LDFLAGS += -liconv -lpng
61
$(warning OS not supported or detected, using default linux options.)
65
# test for presence of SDL
66
ifeq ($(shell which sdl-config 2>/dev/null),)
67
$(error No SDL development libraries found!)
69
SDL_FLAGS = $(shell sdl-config --cflags)
70
SDL_LIBS = $(shell sdl-config --libs)
72
# test for presence of FreeType
73
ifeq ($(shell which freetype-config 2>/dev/null),)
74
$(error freetype-config not installed!)
76
FREETYPE_LIBS = $(shell freetype-config --libs)
77
FREETYPE_FLAGS = $(shell freetype-config --cflags)
80
FREETYPEINC = $(shell pkg-config --cflags freetype2)
81
CFLAGS += $(FREETYPEINC)
88
# set GTK2 flags and libraries
89
# ideally we don't always do this, only when using the Gtk GUI,
90
# but too many plugins require it...
92
# test for presence of GTK 2.0
93
ifeq ($(shell which pkg-config 2>/dev/null),)
94
$(error pkg-config not installed!)
96
ifneq ("$(shell pkg-config gtk+-2.0 --modversion | head -c 2)", "2.")
97
$(error No GTK 2.x development libraries found!)
99
# set GTK flags and libraries
100
GTK_FLAGS = $(shell pkg-config gtk+-2.0 --cflags)
101
GTK_LIBS = $(shell pkg-config gtk+-2.0 --libs)
102
GTHREAD_LIBS = $(shell pkg-config gthread-2.0 --libs)
104
# set Qt flags and libraries
105
# some distros append -qt4 to the binaries so look for those first
108
QMAKE = ${shell which qmake-qt4 2>/dev/null}
110
QMAKE = ${shell which qmake 2>/dev/null}
113
$(error qmake from Qt not found! Make sure the Qt binaries are in your PATH)
115
MOC = $(shell which moc-qt4 2>/dev/null)
117
MOC = $(shell which moc 2>/dev/null)
120
$(error moc from Qt not found! Make sure the Qt binaries are in your PATH)
122
UIC = $(shell which uic-qt4 2>/dev/null)
124
UIC = $(shell which uic 2>/dev/null)
127
$(error uic from Qt not found! Make sure the Qt binaries are in your PATH)
129
RCC = $(shell which rcc-qt4 2>/dev/null)
131
RCC = $(shell which rcc 2>/dev/null)
134
$(error rcc from Qt not found! Make sure the Qt binaries are in your PATH)
136
LRELEASE = $(shell which lrelease-qt4 2>/dev/null)
138
LRELEASE = $(shell which lrelease 2>/dev/null)
141
$(error lrelease from Qt not found! Make sure the Qt binaries are in your PATH)
143
QT_FLAGS = $(shell pkg-config QtCore QtGui --cflags)
144
QT_LIBS = $(shell pkg-config QtCore QtGui --libs)
145
# define Gtk flags when using Qt4 gui so it can load plugins, etc.
149
# set base program pointers and flags
168
# create SVN version defines
172
MUPEN_VERSION = $(VER)
173
PLUGIN_VERSION = $(VER)
175
ifeq ($(shell svn info ./ 2>/dev/null),)
176
MUPEN_VERSION = $(MUPEN_RELEASE)-development
177
PLUGIN_VERSION = $(MUPEN_RELEASE)-development
179
SVN_REVISION = $(shell svn info ./ 2>/dev/null | sed -n '/^Revision: /s/^Revision: //p')
180
SVN_BRANCH = $(shell svn info ./ 2>/dev/null | sed -n '/^URL: /s/.*mupen64plus.//1p')
181
SVN_DIFFHASH = $(shell svn diff ./ 2>/dev/null | md5sum | sed '/.*/s/ -//;/^d41d8cd98f00b204e9800998ecf8427e/d')
182
MUPEN_VERSION = $(MUPEN_RELEASE)-$(SVN_BRANCH)-r$(SVN_REVISION) $(SVN_DIFFHASH)
183
PLUGIN_VERSION = $(MUPEN_RELEASE)-$(SVN_BRANCH)-r$(SVN_REVISION)
187
# set base CFLAGS and LDFLAGS
188
CFLAGS += -pipe -O3 -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing
189
CORE_LDFLAGS += -lz -lm -lpng -lfreetype -ldl
191
# set special flags per-system
193
ifeq ($(ARCH), 64BITS)
194
CFLAGS += -march=athlon64
196
CFLAGS += -march=i686 -mtune=pentium-m -mmmx -msse
197
ifneq ($(PROFILE), 1)
198
CFLAGS += -fomit-frame-pointer
201
# tweak flags for 32-bit build on 64-bit system
202
ifeq ($(ARCH), 64BITS_32)
204
LDFLAGS += -m32 -m elf_i386
208
CFLAGS += -mcpu=powerpc -D_BIG_ENDIAN
211
# set CFLAGS, LIBS, and LDFLAGS for external dependencies
213
PLUGIN_LDFLAGS = -Wl,-Bsymbolic -shared
216
PLUGIN_LDFLAGS = -bundle
220
LIBGL_LIBS = -L/usr/X11R6/lib -lGL -lGLU
223
LIBGL_LIBS = -framework OpenGL
226
# set flags for compile options.
228
# set CFLAGS macro for no assembly language if required
233
# set variables for profiling
238
else # set variables for debugging symbols