forked from libretro/parallel-n64
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
232 lines (197 loc) · 6.3 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
DEBUG=0
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -a),)
platform = win
else ifneq ($(findstring MINGW,$(shell uname -a)),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
platform = osx
else ifneq ($(findstring win,$(shell uname -a)),)
platform = win
endif
endif
TARGET_NAME := mupen64plus
CC_AS ?= $(CC)
ifneq (,$(findstring unix,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
LDFLAGS += -shared -Wl,--version-script=libretro/link.T
fpic = -fPIC
ifneq (,$(findstring gles,$(platform)))
GLES = 1
GL_LIB := -lGLESv2
else
GL_LIB := -lGL
endif
PLATFORM_EXT := unix
else ifneq (,$(findstring osx,$(platform)))
TARGET := $(TARGET_NAME)_libretro.dylib
LDFLAGS += -dynamiclib
fpic = -fPIC
CPPFLAGS += -D__MACOSX__
GL_LIB := -framework OpenGL
PLATFORM_EXT := unix
else ifneq (,$(findstring ios,$(platform)))
TARGET := $(TARGET_NAME)_libretro_ios.dylib
CPPFLAGS += -DIOS -marm
LDFLAGS += -dynamiclib -marm
fpic = -fPIC
GLES = 1
GL_LIB := -framework OpenGLES
OBJECTS += libretro/libco/armeabi_asm.o
CC = clang -arch armv7 -isysroot $(IOSSDK)
CC_AS = perl ./tools/gas-preprocessor.pl $(CC)
CXX = clang++ -arch armv7 -isysroot $(IOSSDK)
CPPFLAGS += -DNO_ASM -DIOS -DNOSSE -DHAVE_POSIX_MEMALIGN
PLATFORM_EXT := unix
else ifneq (,$(findstring android,$(platform)))
TARGET := libretro_$(TARGET_NAME).so
LDFLAGS += -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined -Wl,--warn-common
GL_LIB := -lGLESv2
OBJECTS += libretro/libco/armeabi_asm.o
CC = arm-linux-androideabi-gcc
CXX = arm-linux-androideabi-g++
GLES = 1
CPPFLAGS += -DNO_ASM -DNOSSE
fpic = -fPIC
PLATFORM_EXT := unix
else ifneq (,$(findstring armv,$(platform)))
CC = gcc
CXX = g++
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined
CPPFLAGS += -I.
LIBS := -lz
ifneq (,$(findstring gles,$(platform)))
GLES := 1
else
GL_LIB := -lGL
endif
ifneq (,$(findstring cortexa8,$(platform)))
CPPFLAGS += -marm -mcpu=cortex-a8
else ifneq (,$(findstring cortexa9,$(platform)))
CPPFLAGS += -marm -mcpu=cortex-a9
endif
CPPFLAGS += -marm
ifneq (,$(findstring neon,$(platform)))
CPPFLAGS += -mfpu=neon
HAVE_NEON = 1
endif
ifneq (,$(findstring softfloat,$(platform)))
CPPFLAGS += -mfloat-abi=softfp
else ifneq (,$(findstring hardfloat,$(platform)))
CPPFLAGS += -mfloat-abi=hard
endif
CPPFLAGS += -DARM
else ifneq (,$(findstring win,$(platform)))
TARGET := $(TARGET_NAME)_libretro.dll
LDFLAGS += -shared -static-libgcc -static-libstdc++ -Wl,--version-script=libretro/link.T -lwinmm -lgdi32
GL_LIB := -lopengl32
CPPFLAGS += -msse -msse2
PLATFORM_EXT := win32
CC = gcc
CXX = g++
endif
# libretro
CFILES += $(wildcard libretro/*.c) libretro/libco/libco.c
# RSP Plugin
RSPDIR = mupen64plus-rsp-hle
CFILES += $(wildcard $(RSPDIR)/src/*.c)
CXXFILES += $(wildcard $(RSPDIR)/src/*.cpp)
# Core
COREDIR = mupen64plus-core
CFILES += \
$(COREDIR)/src/api/callbacks.c \
$(COREDIR)/src/api/common.c \
$(COREDIR)/src/api/config.c \
$(COREDIR)/src/api/frontend.c \
$(COREDIR)/src/main/main.c \
$(COREDIR)/src/main/md5.c \
$(COREDIR)/src/main/rom.c \
$(COREDIR)/src/main/savestates.c \
$(COREDIR)/src/main/util.c \
$(COREDIR)/src/memory/dma.c \
$(COREDIR)/src/memory/flashram.c \
$(COREDIR)/src/memory/memory.c \
$(COREDIR)/src/memory/n64_cic_nus_6105.c \
$(COREDIR)/src/memory/pif.c \
$(COREDIR)/src/memory/tlb.c \
$(COREDIR)/src/plugin/plugin.c \
$(COREDIR)/src/r4300/profile.c \
$(COREDIR)/src/r4300/recomp.c \
$(COREDIR)/src/r4300/exception.c \
$(COREDIR)/src/r4300/pure_interp.c \
$(COREDIR)/src/r4300/reset.c \
$(COREDIR)/src/r4300/interupt.c \
$(COREDIR)/src/r4300/r4300.c
# $(COREDIR)/src/api/debugger.c \
# $(COREDIR)/src/main/ini_reader.c \
#
### DYNAREC ###
ifdef WITH_DYNAREC
CPPFLAGS += -DDYNAREC
ifeq ($(WITH_DYNAREC), arm)
CPPFLAGS += -DNEW_DYNAREC=3
CFILES += \
$(COREDIR)/src/r4300/empty_dynarec.c \
$(COREDIR)/src/r4300/new_dynarec/new_dynarec.c
OBJECTS += \
$(COREDIR)/src/r4300/new_dynarec/linkage_$(WITH_DYNAREC).o
else
CFILES += $(wildcard $(COREDIR)/src/r4300/$(WITH_DYNAREC)/*.c)
endif
else
CFILES += $(COREDIR)/src/r4300/empty_dynarec.c
endif
### VIDEO PLUGINS ###
# Rice
VIDEODIR_RICE=gles2rice/src
CPPFLAGS += -DSDL_VIDEO_OPENGL_ES2=1
#LDFLAGS += -lpng
ricevideosrc = $(wildcard $(VIDEODIR_RICE)/*.cpp)
ricevideoblack = $(VIDEODIR_RICE)/CNvTNTCombiner.cpp $(VIDEODIR_RICE)/OGLCombinerNV.cpp $(VIDEODIR_RICE)/OGLCombinerTNT2.cpp \
$(VIDEODIR_RICE)/OGLExtensions.cpp $(VIDEODIR_RICE)/OGLFragmentShaders.cpp
CXXFILES += $(filter-out $(ricevideoblack), $(ricevideosrc))
CFILES += \
$(VIDEODIR_RICE)/osal_files_$(PLATFORM_EXT).c \
$(VIDEODIR_RICE)/liblinux/BMGImage.c \
$(VIDEODIR_RICE)/liblinux/BMGUtils.c \
$(VIDEODIR_RICE)/liblinux/bmp.c
#$(VIDEODIR_RICE)/liblinux/pngrw.c
# gln64
VIDEODIR_GLN64 = gles2n64/src
# TODO: Use neon versions when possible
gln64videosrc = $(wildcard $(VIDEODIR_GLN64)/*.cpp)
gln64videoblack = $(VIDEODIR_GLN64)/3DMathNeon.cpp $(VIDEODIR_GLN64)/gSPNeon.cpp
CXXFILES += $(filter-out $(gln64videoblack), $(gln64videosrc))
# Glide64
VIDEODIR_GLIDE = gles2glide64/src
CPPFLAGS += -I$(VIDEODIR_GLIDE)/Glitch64/inc
CXXFILES += $(wildcard $(VIDEODIR_GLIDE)/Glide64/*.cpp)
CXXFILES += $(wildcard $(VIDEODIR_GLIDE)/Glitch64/*.cpp)
### Finalize ###
OBJECTS += $(CXXFILES:.cpp=.o) $(CFILES:.c=.o)
CPPFLAGS += -D__LIBRETRO__ -I$(COREDIR)/src -I$(COREDIR)/src/api -Ilibretro/libco -Ilibretro
CPPFLAGS += -DM64P_CORE_PROTOTYPES -D_ENDUSER_RELEASE $(fpic)
CFLAGS += -std=gnu99
LDFLAGS += -lm $(fpic) -lz
ifeq ($(GLES), 1)
CPPFLAGS += -DGLES
endif
ifeq ($(DEBUG), 1)
CPPFLAGS += -O0 -g
CPPFLAGS += -DOPENGL_DEBUG
else
CPPFLAGS += -O3
endif
all: $(TARGET)
$(COREDIR)/src/r4300/new_dynarec/linkage_arm.o: $(COREDIR)/src/r4300/new_dynarec/linkage_arm.S
$(CC_AS) $(CFLAGS) -c $^ -o $@
$(COREDIR)/src/r4300/new_dynarec/new_dynarec.o: $(COREDIR)/src/r4300/new_dynarec/new_dynarec.c
$(CC) -c -o $@ $< $(CPPFLAGS) $(CFLAGS) -O0
$(TARGET): $(OBJECTS)
$(CXX) -o $@ $(OBJECTS) $(LDFLAGS) $(GL_LIB)
clean:
rm -f $(OBJECTS) $(TARGET)
.PHONY: clean