1
#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
# * Mupen64plus-video-rice - Makefile *
3
# * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
4
# * Copyright (C) 2007-2009 Richard Goedeken *
5
# * Copyright (C) 2007-2008 DarkJeztr Tillin9 *
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. *
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. *
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 RiceVideo plugin in Mupen64Plus
24
# detect operating system
25
UNAME = $(shell uname -s)
27
ifeq ("$(UNAME)","Linux")
32
ifeq ("$(UNAME)","linux")
37
ifneq ("$(filter GNU hurd,$(UNAME))","")
42
ifeq ("$(UNAME)","Darwin")
47
ifeq ("$(UNAME)","FreeBSD")
52
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
58
$(error OS type "$(UNAME)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
61
# detect system architecture
62
HOST_CPU ?= $(shell uname -m)
64
ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","")
66
ifeq ("$(BITS)", "32")
67
ARCH_DETECTED := 64BITS_32
69
ARCH_DETECTED := 64BITS
72
ifneq ("$(filter pentium i%86,$(HOST_CPU))","")
74
ARCH_DETECTED := 32BITS
76
# PPC doesn't work yet
77
#ifneq ("$(filter ppc powerpc,$(HOST_CPU))","")
79
# ARCH_DETECTED := 32BITS
82
#ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
84
# ARCH_DETECTED := 64BITS
87
ifeq ("$(CPU)","NONE")
88
$(error CPU type "$(HOST_CPU)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
91
# base CFLAGS, LIBS, and LDFLAGS
92
CFLAGS += -Wall -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -fvisibility=hidden -I../../src
93
CXXFLAGS += -fvisibility-inlines-hidden
96
# Since we are building a shared library, we must compile with -fPIC for x86_64 CPUs.
97
# On 32-bit systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch
98
ifeq ($(ARCH_DETECTED), 64BITS)
101
# tweak flags for 32-bit build on 64-bit system
102
ifeq ($(ARCH_DETECTED), 64BITS_32)
103
ifeq ($(OS), FREEBSD)
104
$(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
107
LDFLAGS += -m32 -m elf_i386
110
# set special flags per-system
112
LDFLAGS += -lGL $(shell pkg-config --libs libpng)
113
CFLAGS += $(shell pkg-config --cflags libpng)
117
# only export api symbols
118
LDFLAGS += -Wl,-version-script,$(SRCDIR)/video_api_export.ver
120
ifeq ($(ARCH_DETECTED), 64BITS)
121
CFLAGS += -pipe -O3 -march=athlon64
123
CFLAGS += -pipe -O3 -mmmx -msse -march=i686 -mtune=pentium-m -fomit-frame-pointer
129
ifeq ($(ARCH_DETECTED), 64BITS)
130
CFLAGS += -pipe -O3 -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
131
LDFLAGS += -ldl -bundle -framework OpenGL -arch x86_64
133
CFLAGS += -pipe -O3 -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
134
LDFLAGS += -ldl -bundle -framework OpenGL -arch i686
139
CFLAGS += -mcpu=powerpc
142
# test for presence of SDL
143
ifeq ($(shell which sdl-config 2>/dev/null),)
144
$(error No SDL development libraries found!)
147
CFLAGS += $(shell sdl-config --cflags) -DPIC
148
LDFLAGS += $(shell sdl-config --libs) -DPIC
151
CFLAGS += $(shell sdl-config --cflags) -DPIC
152
# sdl-config on mac screws up when we're trying to build a library and not an executable
153
# SDL 1.3 is supposed to fix that, if it's ever released
154
LDFLAGS += -L/usr/local/lib -lSDL -Wl,-framework,Cocoa
157
CFLAGS += $(shell sdl-config --cflags)
158
LDFLAGS += $(shell sdl-config --libs)
161
# set mupen64plus core API header path
162
ifneq ("$(APIDIR)","")
163
CFLAGS += "-I$(APIDIR)"
165
TRYDIR = ../../../mupen64plus-core/src/api
166
ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
167
CFLAGS += -I$(TRYDIR)
169
TRYDIR = /usr/local/include/mupen64plus
170
ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
171
CFLAGS += -I$(TRYDIR)
173
TRYDIR = /usr/include/mupen64plus
174
ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
175
CFLAGS += -I$(TRYDIR)
177
$(error Mupen64Plus API header files not found! Use makefile parameter APIDIR to force a location.)
183
# set shell function names
193
# set special flags for given Makefile parameters
196
STRIP = true # disable binary strip
202
# set installation options
207
SHAREDIR := $(PREFIX)/share/mupen64plus
210
LIBDIR := $(PREFIX)/lib/mupen64plus
216
# list of source files to compile
218
$(SRCDIR)/liblinux/BMGImage.c \
219
$(SRCDIR)/liblinux/BMGUtils.cpp \
220
$(SRCDIR)/liblinux/bmp.c \
221
$(SRCDIR)/liblinux/pngrw.c \
222
$(SRCDIR)/osal_dynamiclib_unix.c \
223
$(SRCDIR)/osal_files_unix.c \
224
$(SRCDIR)/Blender.cpp \
225
$(SRCDIR)/Combiner.cpp \
226
$(SRCDIR)/CombinerTable.cpp \
227
$(SRCDIR)/Config.cpp \
228
$(SRCDIR)/ConvertImage.cpp \
229
$(SRCDIR)/ConvertImage16.cpp \
230
$(SRCDIR)/CNvTNTCombiner.cpp \
231
$(SRCDIR)/Debugger.cpp \
232
$(SRCDIR)/DecodedMux.cpp \
233
$(SRCDIR)/DirectXDecodedMux.cpp \
234
$(SRCDIR)/DeviceBuilder.cpp \
235
$(SRCDIR)/FrameBuffer.cpp \
236
$(SRCDIR)/GeneralCombiner.cpp \
237
$(SRCDIR)/GraphicsContext.cpp \
238
$(SRCDIR)/OGLCombiner.cpp \
239
$(SRCDIR)/OGLCombinerNV.cpp \
240
$(SRCDIR)/OGLCombinerTNT2.cpp \
241
$(SRCDIR)/OGLDecodedMux.cpp \
242
$(SRCDIR)/OGLExtCombiner.cpp \
243
$(SRCDIR)/OGLExtensions.cpp \
244
$(SRCDIR)/OGLExtRender.cpp \
245
$(SRCDIR)/OGLFragmentShaders.cpp \
246
$(SRCDIR)/OGLGraphicsContext.cpp \
247
$(SRCDIR)/OGLRender.cpp \
248
$(SRCDIR)/OGLRenderExt.cpp \
249
$(SRCDIR)/OGLTexture.cpp \
250
$(SRCDIR)/Render.cpp \
251
$(SRCDIR)/RenderBase.cpp \
252
$(SRCDIR)/RenderExt.cpp \
253
$(SRCDIR)/RenderTexture.cpp \
254
$(SRCDIR)/RSP_Parser.cpp \
255
$(SRCDIR)/RSP_S2DEX.cpp \
256
$(SRCDIR)/Texture.cpp \
257
$(SRCDIR)/TextureFilters.cpp \
258
$(SRCDIR)/TextureFilters_2xsai.cpp \
259
$(SRCDIR)/TextureFilters_hq2x.cpp \
260
$(SRCDIR)/TextureFilters_hq4x.cpp \
261
$(SRCDIR)/TextureManager.cpp \
262
$(SRCDIR)/VectorMath.cpp \
265
# generate a list of object files build, make a temporary directory for them
266
OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter %.c, $(SOURCE)))
267
OBJECTS += $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(filter %.cpp, $(SOURCE)))
268
OBJDIRS = $(dir $(OBJECTS))
269
$(shell mkdir -p $(OBJDIRS))
272
TARGET = mupen64plus-video-rice.$(SO_EXTENSION)
275
@echo "Mupen64plus-video-rice N64 Graphics plugin makefile. "
277
@echo " all == Build Mupen64plus-video-rice plugin"
278
@echo " clean == remove object files"
279
@echo " rebuild == clean and re-build all"
280
@echo " install == Install Mupen64Plus-video-rice plugin"
281
@echo " uninstall == Uninstall Mupen64Plus-video-rice plugin"
283
@echo " BITS=32 == build 32-bit binaries on 64-bit machine"
284
@echo " NO_ASM=1 == build without inline assembly code (x86 MMX/SSE)"
285
@echo " APIDIR=path == path to find Mupen64Plus Core headers"
286
@echo " Install Options:"
287
@echo " PREFIX=path == install/uninstall prefix (default: /usr/local)"
288
@echo " SHAREDIR=path == path to install shared data files (default: PREFIX/share/mupen64plus)"
289
@echo " LIBDIR=path == path to install plugin libraries (default: PREFIX/lib/mupen64plus)"
290
@echo " DESTDIR=path == path to prepend to all installation paths (only for packagers)"
291
@echo " Debugging Options:"
292
@echo " DEBUG=1 == add debugging symbols"
297
$(INSTALL) -d -v "$(DESTDIR)$(LIBDIR)"
298
$(INSTALL) -m 0644 $(TARGET) "$(DESTDIR)$(LIBDIR)"
299
$(INSTALL) -d -v "$(DESTDIR)$(SHAREDIR)"
300
$(INSTALL) -m 0644 "../../data/RiceVideoLinux.ini" "$(DESTDIR)$(SHAREDIR)"
303
rm -f "$(DESTDIR)$(LIBDIR)/$(TARGET)"
304
rm -f "$(DESTDIR)$(SHAREDIR)/RiceVideoLinux.ini"
307
rm -rf ./_obj/* $(TARGET)
312
# build dependency files
314
-include $(OBJECTS:.o=.d)
316
CXXFLAGS += $(CFLAGS)
318
# reduced compile output when running make without V=1
319
ifneq ($(findstring $(MAKEFLAGS),s),s)
321
Q_CC = @echo ' CC '$@;
322
Q_CXX = @echo ' CXX '$@;
323
Q_LD = @echo ' LD '$@;
328
$(TARGET): $(OBJECTS)
329
$(Q_LD)$(CXX) $(SHARED) $^ $(LDFLAGS) -o $@
332
$(OBJDIR)/%.o: $(SRCDIR)/%.c
333
$(Q_CC)$(CC) -o $@ $(CFLAGS) -c $<
335
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
336
$(Q_CXX)$(CXX) -o $@ $(CXXFLAGS) -c $<