1
#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
# * Arachnoid - Makefile *
3
# * http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/ *
4
# * Copyright (C) 2009 Richard42, Jon Ring *
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
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
21
# Makefile for mupen64plus-video-arachnoid
23
# detect operation system
24
UNAME = $(shell uname -s)
25
ifeq ("$(UNAME)","Linux")
30
ifeq ("$(UNAME)","linux")
35
ifneq ("$(filter GNU hurd,$(UNAME))","")
40
ifeq ("$(UNAME)","Darwin")
42
LDFLAGS += -liconv -lpng
46
ifeq ("$(UNAME)","FreeBSD")
51
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
57
# detect system architecture
58
HOST_CPU ?= $(shell uname -m)
60
ifneq ("$(filter x86_64 amd64,$(HOST_CPU))","")
62
ifeq ("$(BITS)", "32")
63
ARCH_DETECTED := 64BITS_32
65
ARCH_DETECTED := 64BITS
68
ifneq ("$(filter pentium i%86,$(HOST_CPU))","")
70
ARCH_DETECTED := 32BITS
72
ifneq ("$(filter ppc powerpc,$(HOST_CPU))","")
74
ARCH_DETECTED := 32BITS
76
ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
78
ARCH_DETECTED := 64BITS
81
# base CFLAGS, LIBS, and LDFLAGS
82
CFLAGS += -ffast-math -funroll-loops -fexpensive-optimizations -fno-strict-aliasing -fvisibility=hidden -I../../src \
83
-I../../src/hash -I../../src/ucodes -I../../src/GBI -I../../src/RDP -I../../src/utils \
84
-I../../src/log -I../../src/RSP -I../../src/framebuffer -I../../src/math -I../../src/renderer \
85
-I../../src/Assembler -I../../src/texture -I../../src/config -I../../src/Combiner
86
ifneq ($(OS), FREEBSD)
89
CXXFLAGS += -fvisibility-inlines-hidden
91
# On OS X, add a few extra flags to elegantly support cross-compilation and backward
92
# compatibility (and also the flags to link against OpenGL)
95
ifeq ($(ARCH_DETECTED), 64BITS)
96
CFLAGS += -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
97
LDFLAGS += -bundle -framework OpenGL -arch x86_64 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.5.sdk
99
CFLAGS += -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
100
LDFLAGS += -bundle -framework OpenGL -arch i686 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.5.sdk
104
# flags for other Unices
105
LDFLAGS += -ldl -lGL -lGLU -lpthread
109
ifeq ($(ARCH_DETECTED), 64BITS)
113
# set mupen64plus core API header path
114
ifneq ("$(APIDIR)","")
115
CFLAGS += "-I$(APIDIR)"
117
TRYDIR = ../../../mupen64plus-core/src/api
118
ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
119
CFLAGS += -I$(TRYDIR)
121
TRYDIR = /usr/local/include/mupen64plus
122
ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
123
CFLAGS += -I$(TRYDIR)
125
TRYDIR = /usr/include/mupen64plus
126
ifneq ("$(wildcard $(TRYDIR)/m64p_types.h)","")
127
CFLAGS += -I$(TRYDIR)
133
# set special flags per-system
135
# only export api symbols
136
LDFLAGS += -Wl,-version-script,$(SRCDIR)/video_api_export.ver
138
ifneq ($(OS), FREEBSD)
140
ifeq ($(ARCH_DETECTED), 64BITS)
141
CFLAGS += -march=athlon64
143
CFLAGS += -mmmx -msse -march=i686 -mtune=pentium-m -fomit-frame-pointer
145
# tweak flags for 32-bit build on 64-bit system
146
ifeq ($(ARCH_DETECTED), 64BITS_32)
148
LDFLAGS += -m32 -m elf_i386
152
ifeq ($(ARCH_DETECTED), 64BITS_32)
153
$(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
157
CFLAGS += -mcpu=powerpc
160
# set shell function names
161
# set shell function names
172
# set special flags for given Makefile parameters
174
CFLAGS += -g -fno-inline -Werror
175
STRIP = true # disable binary strip
178
# set installation options
183
SHAREDIR := $(PREFIX)/share/mupen64plus
186
LIBDIR := $(PREFIX)/lib/mupen64plus
193
# list of source files to compile
196
$(SRCDIR)/log/Logger.cpp \
197
$(SRCDIR)/config/Config.cpp \
198
$(SRCDIR)/config/StringFunctions.cpp \
199
$(SRCDIR)/GraphicsPlugin.cpp \
200
$(SRCDIR)/OpenGLManager.cpp \
201
$(SRCDIR)/renderer/OpenGLRenderer.cpp \
202
$(SRCDIR)/framebuffer/FrameBuffer.cpp \
203
$(SRCDIR)/renderer/OpenGL2DRenderer.cpp \
204
$(SRCDIR)/FogManager.cpp \
205
$(SRCDIR)/MultiTexturingExt.cpp \
206
$(SRCDIR)/ExtensionChecker.cpp \
207
$(SRCDIR)/SecondaryColorExt.cpp \
208
$(SRCDIR)/Memory.cpp \
209
$(SRCDIR)/math/Matrix4.cpp \
210
$(SRCDIR)/texture/CachedTexture.cpp \
211
$(SRCDIR)/texture/TextureCache.cpp \
212
$(SRCDIR)/texture/ImageFormatSelector.cpp \
213
$(SRCDIR)/hash/CRCCalculator.cpp \
214
$(SRCDIR)/hash/CRCCalculator2.cpp \
215
$(SRCDIR)/texture/TextureLoader.cpp \
216
$(SRCDIR)/DisplayListParser.cpp \
218
$(SRCDIR)/ucodes/UCodeSelector.cpp \
219
$(SRCDIR)/ucodes/UCode0.cpp \
220
$(SRCDIR)/ucodes/UCode1.cpp \
221
$(SRCDIR)/ucodes/UCode2.cpp \
222
$(SRCDIR)/ucodes/UCode3.cpp \
223
$(SRCDIR)/ucodes/UCode4.cpp \
224
$(SRCDIR)/ucodes/UCode5.cpp \
225
$(SRCDIR)/ucodes/UCode6.cpp \
226
$(SRCDIR)/ucodes/UCode7.cpp \
227
$(SRCDIR)/ucodes/UCode8.cpp \
228
$(SRCDIR)/ucodes/UCode9.cpp \
229
$(SRCDIR)/ucodes/UCode10.cpp \
230
$(SRCDIR)/GBI/GBI.cpp \
231
$(SRCDIR)/RSP/RSP.cpp \
232
$(SRCDIR)/RSP/RSPMatrixManager.cpp \
233
$(SRCDIR)/RSP/RSPVertexManager.cpp \
234
$(SRCDIR)/RSP/RSPLightManager.cpp \
235
$(SRCDIR)/Combiner/AdvancedCombinerManager.cpp \
236
$(SRCDIR)/Combiner/CombinerBase.cpp \
237
$(SRCDIR)/Combiner/AdvancedTexEnvCombiner.cpp \
238
$(SRCDIR)/Combiner/SimpleTexEnvCombiner.cpp \
239
$(SRCDIR)/Combiner/DummyCombiner.cpp \
240
$(SRCDIR)/Combiner/CombinerStageMerger.cpp \
241
$(SRCDIR)/Combiner/CombinerStageCreator.cpp \
242
$(SRCDIR)/Combiner/CombinerCache.cpp \
243
$(SRCDIR)/RomDetector.cpp \
244
$(SRCDIR)/RDP/RDP.cpp \
245
$(SRCDIR)/RDP/RDPInstructions.cpp \
246
$(SRCDIR)/osal_dynamiclib_unix.cpp
249
# generate a list of object files build, make a temporary directory for them
250
OBJECTS := $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(filter %.cpp, $(SOURCE)))
251
OBJDIRS = $(dir $(OBJECTS))
252
$(shell mkdir -p $(OBJDIRS))
256
TARGET = mupen64plus-video-arachnoid.$(SO_EXTENSION)
258
@echo "Mupen64plus-video-arachnoid N64 Graphics plugin makefile. "
260
@echo " all == Build Mupen64plus-video-arachnoid plugin"
261
@echo " clean == remove object files"
262
@echo " rebuild == clean and re-build all"
263
@echo " install == Install Mupen64Plus-video-arachnoid plugin"
264
@echo " uninstall == Uninstall Mupen64Plus-video-arachnoid plugin"
266
@echo " BITS=32 == build 32-bit binaries on 64-bit machine"
267
@echo " APIDIR=path == path to find Mupen64Plus Core headers"
268
@echo " Install Options:"
269
@echo " PREFIX=path == install/uninstall prefix (default: /usr/local)"
270
@echo " LIBDIR=path == path to install plugin libraries (default: PREFIX/lib/mupen64plus)"
271
@echo " DESTDIR=path == path to prepend to all installation paths (only for packagers)"
272
@echo " Debugging Options:"
273
@echo " DEBUG=1 == add debugging symbols"
274
@echo " V=1 == show verbose compiler output"
279
$(INSTALL) -d -v "$(DESTDIR)$(LIBDIR)"
280
$(INSTALL) -m 0644 $(TARGET) "$(DESTDIR)$(LIBDIR)"
283
rm -f "$(DESTDIR)$(LIBDIR)/$(TARGET)"
287
rm -rf ./_obj mupen64plus-video-arachnoid.$(SO_EXTENSION)
289
# build dependency files
291
-include $(OBJECTS:.o=.d)
293
CXXFLAGS += $(CFLAGS)
295
# reduced compile output when running make without V=1
296
ifneq ($(findstring $(MAKEFLAGS),s),s)
298
Q_CC = @echo ' CC '$@;
299
Q_CXX = @echo ' CXX '$@;
300
Q_LD = @echo ' LD '$@;
305
$(TARGET): $(OBJECTS)
306
$(Q_LD)$(CXX) $(SHARED) $^ $(LDFLAGS) -o $@
309
$(OBJDIR)/%.o: $(SRCDIR)/%.c
310
$(Q_CC)$(CC) -o $@ $(CFLAGS) -c $<
312
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
313
$(Q_CXX)$(CXX) -o $@ $(CXXFLAGS) -c $<