1
#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2
# * Mupen64plus - Makefile *
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
# include pre-make file with a bunch of definitions
27
include ./pre.mk.win32
33
LDFLAGS += -Wl,-export-dynamic
36
# set executable stack as a linker option for X86 architecture, for dynamic recompiler
39
LDFLAGS += -z execstack
47
ifeq ($(DBG_COMPARE), 1)
48
CFLAGS += -DCOMPARE_CORE
53
ifeq ($(DBG_COUNT), 1)
54
CFLAGS += -DCOUNT_INSTR
56
ifeq ($(DBG_PROFILE), 1)
57
CFLAGS += -DPROFILE_R4300
66
CFLAGS += $(QT_FLAGS) $(GTK_FLAGS)
69
CFLAGS += $(GTK_FLAGS)
73
CFLAGS += $(GTK_FLAGS)
78
# set installation options
83
SHAREDIR := $(PREFIX)/share/mupen64plus
86
BINDIR := $(PREFIX)/bin
89
LIBDIR := $(SHAREDIR)/plugins
92
MANDIR := $(PREFIX)/man/man1
94
ifeq ($(APPLICATIONSDIR),)
95
APPLICATIONSDIR := $(PREFIX)/share/applications
98
INSTALLOPTS := "$(DESTDIR)$(PREFIX)" "$(DESTDIR)$(SHAREDIR)" "$(DESTDIR)$(BINDIR)" "$(DESTDIR)$(LIBDIR)" "$(DESTDIR)$(MANDIR)" "$(DESTDIR)$(APPLICATIONSDIR)"
100
# list of object files to generate
116
main/7zip/7zAlloc.o \
117
main/7zip/7zBuffer.o \
119
main/7zip/7zDecode.o \
120
main/7zip/7zExtract.o \
121
main/7zip/7zHeader.o \
125
main/7zip/LzmaDecode.o \
126
main/7zip/BranchX86.o \
127
main/7zip/BranchX86_2.o \
135
r4300/compare_core.o \
145
r4300/pure_interp.o \
151
# handle dynamic recompiler objects
154
ifeq ($(ARCH), 64BITS)
161
r4300/$(DYNAREC)/assemble.o \
162
r4300/$(DYNAREC)/debug.o \
163
r4300/$(DYNAREC)/gbc.o \
164
r4300/$(DYNAREC)/gcop0.o \
165
r4300/$(DYNAREC)/gcop1.o \
166
r4300/$(DYNAREC)/gcop1_d.o \
167
r4300/$(DYNAREC)/gcop1_l.o \
168
r4300/$(DYNAREC)/gcop1_s.o \
169
r4300/$(DYNAREC)/gcop1_w.o \
170
r4300/$(DYNAREC)/gr4300.o \
171
r4300/$(DYNAREC)/gregimm.o \
172
r4300/$(DYNAREC)/gspecial.o \
173
r4300/$(DYNAREC)/gtlb.o \
174
r4300/$(DYNAREC)/regcache.o \
175
r4300/$(DYNAREC)/rjump.o
177
OBJ_DYNAREC = r4300/empty_dynarec.o
189
main/gui_gtk/main_gtk.o \
190
main/gui_gtk/icontheme.o \
191
main/gui_gtk/aboutdialog.o \
192
main/gui_gtk/cheatdialog.o \
193
main/gui_gtk/configdialog.o \
194
main/gui_gtk/rombrowser.o \
195
main/gui_gtk/romproperties.o
198
debugger/debugger.o \
200
debugger/opprintf.o \
202
debugger/breakpoints.o
205
main/gui_gtk/debugger/debugger.o \
206
main/gui_gtk/debugger/breakpoints.o \
207
main/gui_gtk/debugger/desasm.o \
208
main/gui_gtk/debugger/memedit.o \
209
main/gui_gtk/debugger/varlist.o \
210
main/gui_gtk/debugger/registers.o \
211
main/gui_gtk/debugger/regGPR.o \
212
main/gui_gtk/debugger/regCop0.o \
213
main/gui_gtk/debugger/regSpecial.o \
214
main/gui_gtk/debugger/regCop1.o \
215
main/gui_gtk/debugger/regAI.o \
216
main/gui_gtk/debugger/regPI.o \
217
main/gui_gtk/debugger/regRI.o \
218
main/gui_gtk/debugger/regSI.o \
219
main/gui_gtk/debugger/regVI.o \
220
main/gui_gtk/debugger/regTLB.o \
221
main/gui_gtk/debugger/ui_clist_edit.o \
222
main/gui_gtk/debugger/ui_disasm_list.o
224
OBJ_QT4_GUI = main/gui_qt4/libgui_qt4.a
226
PLUGINS = plugins/blight_input.$(SO_EXTENSION) \
227
plugins/dummyaudio.$(SO_EXTENSION) \
228
plugins/dummyvideo.$(SO_EXTENSION) \
229
plugins/ricevideo.$(SO_EXTENSION) \
230
plugins/glide64.$(SO_EXTENSION) \
231
plugins/jttl_audio.$(SO_EXTENSION) \
232
plugins/mupen64_hle_rsp_azimer.$(SO_EXTENSION) \
233
plugins/mupen64_input.$(SO_EXTENSION)
235
SHARE = $(shell grep CONFIG_PATH config.h | cut -d '"' -f 2)
237
# set primary objects and libraries for all outputs
238
ALL = mupen64plus $(PLUGINS)
239
OBJECTS = $(OBJ_CORE) $(OBJ_DYNAREC) $(OBJ_OPENGL)
240
LIBS = $(SDL_LIBS) $(LIBGL_LIBS) -lbz2
243
# add extra objects and libraries for selected options
245
OBJECTS += $(OBJ_DBG) $(OBJ_GTK_DBG_GUI)
246
STATIC_LIBS += /usr/lib/libopcodes.a
249
OBJECTS += $(OBJ_LIRC)
250
LDFLAGS += -llirc_client
253
ifneq ($(OS), WINDOWS)
254
MISC_DEPS = mupen64plus.desktop
258
OBJECTS += $(OBJ_QT4_GUI)
259
LIBS += $(QT_LIBS) $(GTK_LIBS)
261
# we reimplement the translation functions in the Qt gui
262
OBJECTS += main/translate.o
264
OBJECTS += $(OBJ_GTK_GUI)
265
LIBS += $(GTK_LIBS) $(GTHREAD_LIBS)
271
@echo "Mupen64Plus makefile. "
273
@echo " all == Build Mupen64Plus and all plugins"
274
@echo " clean == remove object files (also try clean-core or clean-plugins)"
275
@echo " rebuild == clean and re-build all"
276
@echo " install == Install Mupen64Plus and all plugins"
277
@echo " uninstall == Uninstall Mupen64Plus and all plugins"
279
@echo " BITS=32 == build 32-bit binaries on 64-bit machine"
280
@echo " LIRC=1 == enable LIRC support"
281
@echo " NO_RESAMP=1 == disable libsamplerate support in jttl_audio"
282
@echo " NO_ASM=1 == build without assembly (no dynamic recompiler or MMX/SSE code)"
283
@echo " GUI=NONE == build without GUI support"
284
@echo " GUI=GTK2 == build with GTK2 GUI support (default)"
285
@echo " GUI=QT4 == build with QT4 GUI support"
286
@echo " WIN32=1 == mingw build"
287
@echo " Install Options:"
288
@echo " PREFIX=path == install/uninstall prefix (default: /usr/local/)"
289
@echo " SHAREDIR=path == path to install shared data (default: PREFIX/share/mupen64plus/)"
290
@echo " BINDIR=path == path to install mupen64plus binary (default: PREFIX/bin/)"
291
@echo " LIBDIR=path == path to install plugin libraries (default: SHAREDIR/plugins/)"
292
@echo " MANDIR=path == path to install manual files (default: PREFIX/man/man1/)"
293
@echo " Debugging Options:"
294
@echo " PROFILE=1 == build gprof instrumentation into binaries for profiling"
295
@echo " DBGSYM=1 == add debugging symbols to binaries"
296
@echo " DBG=1 == build graphical debugger"
297
@echo " DBG_CORE=1 == print debugging info in r4300 core"
298
@echo " DBG_COUNT=1 == print R4300 instruction count totals (64-bit dynarec only)"
299
@echo " DBG_COMPARE=1 == enable core-synchronized r4300 debugging"
300
@echo " DBG_PROFILE=1 == dump profiling data for r4300 dynarec to data file"
301
# @echo " RELEASE=1 == inhibit SVN info from version strings"
302
# @echo " VER=x.y.z == use this version number when RELEASE=1"
303
# The RELEASE and VER flags are hidden from view as they should only be used internally.
304
# They only affect the version strings
306
all: version.h $(ALL)
308
mupen64plus: $(MISC_DEPS) version.h $(OBJECTS)
309
$(CXX) $(OBJECTS) $(LDFLAGS) $(CORE_LDFLAGS) $(LIBS) -o $@ $(STATIC_LIBS)
310
ifneq ($(OS), WINDOWS)
315
./install.sh $(INSTALLOPTS)
318
./uninstall.sh $(INSTALLOPTS)
321
ifneq ($(OS), WINDOWS)
322
$(MAKE) -C blight_input clean
323
$(MAKE) -C dummy_audio clean
324
$(MAKE) -C dummy_video clean
325
$(MAKE) -C rice_video clean
326
$(MAKE) -C glide64 clean
327
$(MAKE) -C jttl_audio clean
328
$(MAKE) -C rsp_hle clean
329
$(MAKE) -C mupen64_input clean
330
$(RM_F) plugins/mupen64_input.$(SO_EXTENSION) blight_input/arial.ttf.c blight_input/ttftoh plugins/blight_input.$(SO_EXTENSION) plugins/mupen64_hle_rsp_azimer.$(SO_EXTENSION)
331
$(RM_F) plugins/dummyaudio.$(SO_EXTENSION) plugins/dummyvideo.$(SO_EXTENSION) plugins/jttl_audio.$(SO_EXTENSION) plugins/ricevideo.$(SO_EXTENSION) plugins/glide64.$(SO_EXTENSION)
335
ifneq ($(OS), WINDOWS)
336
$(RM_F) ./r4300/*.o ./r4300/x86/*.o ./r4300/x86_64/*.o ./memory/*.o ./debugger/*.o ./opengl/*.o
337
$(RM_F) ./main/*.o ./main/version.h ./main/zip/*.o ./main/lzma/*.o ./main/7zip/*.o ./main/gui_gtk/*.o ./main/gui_gtk/debugger/*.o
338
$(RM_F) mupen64plus mupen64plus.desktop
339
$(RM_F) main/gui_qt4/moc_* main/gui_qt4/ui_*.h main/gui_qt4/*.o main/gui_qt4/*.a main/gui_qt4/Makefile
340
$(RM_F) translations/*.qm
342
del /S *.o *.$(SO_EXTENSION) mupen64plus.exe moc_* *.a *.qm
347
clean: clean-core clean-plugins
352
mupen64plus.desktop: FORCE
353
@sed s:SHARE_DIR:"$(SHAREDIR)": mupen64plus.desktop.in > mupen64plus.desktop
356
ifneq ($(OS), WINDOWS)
357
@sed 's|@MUPEN_VERSION@|\"$(MUPEN_VERSION)\"| ; s|@PLUGIN_VERSION@|\"$(PLUGIN_VERSION)\"|' \
358
main/version.template > version.h
359
@$(MV) version.h main/version.h
361
copy version.win32.h main\version.h
365
$(CXX) -o $@ $(CFLAGS) $(SDL_FLAGS) -c $<
368
$(CC) -o $@ $(CFLAGS) $(SDL_FLAGS) -c $<
370
main/gui_qt4/Makefile:
371
${QMAKE} main/gui_qt4/gui_qt4.pro -o main/gui_qt4/Makefile
373
main/gui_qt4/libgui_qt4.a: main/gui_qt4/Makefile FORCE
374
ifneq ($(OS), WINDOWS)
375
${MAKE} -C main/gui_qt4
376
# Run lrelease only on ts files with locale suffix, makes no sense to run it on
377
# the template. For some reason this fails on windows.
378
${LRELEASE} translations/*_*.ts
380
# I wonder whether we can avoid this somehow
381
${MAKE} -C main/gui_qt4 CXXFLAGS="${CFLAGS}"
382
copy main\gui_qt4\release\libgui_qt4.a main\gui_qt4
385
plugins/blight_input.$(SO_EXTENSION): FORCE
386
$(MAKE) -C blight_input all
387
ifneq ($(OS), WINDOWS)
388
@$(CP) ./blight_input/blight_input.so ./plugins/blight_input.so
390
copy blight_input\blight_input.dll plugins
393
plugins/dummyaudio.$(SO_EXTENSION): FORCE
394
$(MAKE) -C dummy_audio all
395
ifneq ($(OS), WINDOWS)
396
@$(CP) ./dummy_audio/dummyaudio.so ./plugins/dummyaudio.so
398
copy dummy_audio\dummyaudio.dll plugins
401
plugins/dummyvideo.$(SO_EXTENSION): FORCE
402
$(MAKE) -C dummy_video all
403
ifneq ($(OS), WINDOWS)
404
@$(CP) ./dummy_video/dummyvideo.so ./plugins/dummyvideo.so
406
copy dummy_video\dummyvideo.dll plugins
409
plugins/ricevideo.$(SO_EXTENSION): FORCE
410
$(MAKE) -C rice_video all
411
@$(CP) ./rice_video/ricevideo.$(SO_EXTENSION) ./plugins/ricevideo.$(SO_EXTENSION)
413
plugins/glide64.$(SO_EXTENSION): FORCE
414
$(MAKE) -C glide64 all
415
@$(CP) ./glide64/glide64.$(SO_EXTENSION) ./plugins/glide64.$(SO_EXTENSION)
417
plugins/jttl_audio.$(SO_EXTENSION): FORCE
418
$(MAKE) -C jttl_audio all
419
@$(CP) ./jttl_audio/jttl_audio.$(SO_EXTENSION) ./plugins/jttl_audio.$(SO_EXTENSION)
421
plugins/mupen64_hle_rsp_azimer.$(SO_EXTENSION): FORCE
422
$(MAKE) -C rsp_hle all
423
@$(CP) ./rsp_hle/mupen64_hle_rsp_azimer.$(SO_EXTENSION) ./plugins/mupen64_hle_rsp_azimer.$(SO_EXTENSION)
425
plugins/mupen64_input.$(SO_EXTENSION): FORCE
426
$(MAKE) -C mupen64_input all
427
@$(CP) ./mupen64_input/mupen64_input.$(SO_EXTENSION) ./plugins/mupen64_input.$(SO_EXTENSION)
429
# This is used to force the plugin builds