11 UNAME
=$(shell uname
-a
)
16 ARCH
= $(shell uname
-m
)
20 WITH_DYNAREC
= $(ARCH
)
23 ifeq ($(ARCH
), $(filter $(ARCH
), i386 i686
))
32 else ifneq ($(findstring MINGW
,$(UNAME
)),)
34 else ifneq ($(findstring Darwin
,$(UNAME
)),)
36 else ifneq ($(findstring win
,$(UNAME
)),)
44 FFMPEGDIR
= $(CORE_DIR
)/ffmpeg
45 LIBRETRODIR
= $(CORE_DIR
)/libretro
46 COREDIR
= $(CORE_DIR
)/Core
47 COMMONDIR
= $(CORE_DIR
)/Common
48 GPUCOMMONDIR
= $(CORE_DIR
)/GPU
/Common
49 GPUDIR
= $(CORE_DIR
)/GPU
50 NATIVEDIR
= $(CORE_DIR
)/native
51 EXTDIR
= $(CORE_DIR
)/ext
54 GIT_VERSION
:= " $(shell git rev-parse --short HEAD || echo unknown)"
55 ifneq ($(GIT_VERSION
)," unknown")
56 CXXFLAGS
+= -DGIT_VERSION
=\"$(GIT_VERSION
)\"
64 ifneq (,$(findstring unix
,$(platform
)))
65 TARGET
:= $(TARGET_NAME
)_libretro.so
66 LDFLAGS
+= -shared
-Wl
,--version-script
=link.T
-Wl
,--no-undefined
68 FFMPEGINCFLAGS
+= -I
$(FFMPEGDIR
)/linux
/$(FFMPEG_ARCH
)/include
69 FFMPEGLIBDIR
:= $(FFMPEGDIR
)/linux
/$(FFMPEG_ARCH
)/lib
70 FFMPEGLDFLAGS
+= -L
$(FFMPEGLIBDIR
) -lavformat
-lavcodec
-lavutil
-lswresample
-lswscale
72 ifneq (,$(findstring gles
,$(platform
)))
82 else ifneq (,$(findstring rpi
,$(platform
)))
83 TARGET
:= $(TARGET_NAME
)_libretro.so
84 LDFLAGS
+= -shared
-Wl
,--version-script
=link.T
88 ifneq (,$(findstring mesa
,$(platform
)))
91 GL_LIB
:= -L
/opt
/vc
/lib
-lGLESv2
92 INCFLAGS
+= -I
/opt
/vc
/include -I
/opt
/vc
/include/interface
/vcos
-I
/opt
/vc
/include/interface
/vcos
/pthreads
95 ifneq (,$(findstring rpi2
,$(platform
)))
96 CPUFLAGS
+= -mcpu
=cortex-a7
-mfpu
=neon-vfpv4
-mfloat-abi
=hard
98 FFMPEGINCFLAGS
+= -I
$(FFMPEGDIR
)/linux
/armv7
/include
99 FFMPEGLIBDIR
:= $(FFMPEGDIR
)/linux
/armv7
/lib
100 else ifneq (,$(findstring rpi3
,$(platform
)))
101 CPUFLAGS
+= -march
=armv8-a
+crc
-mtune
=cortex-a53
-mfpu
=neon-fp-armv8
-mfloat-abi
=hard
103 FFMPEGINCFLAGS
+= -I
$(FFMPEGDIR
)/linux
/armv7
/include
104 FFMPEGLIBDIR
:= $(FFMPEGDIR
)/linux
/armv7
/lib
106 FFMPEGINCFLAGS
+= -I
$(FFMPEGDIR
)/linux
/arm
/include
107 FFMPEGLIBDIR
:= $(FFMPEGDIR
)/linux
/arm
/lib
108 CPUFLAGS
+= -DARMv5_ONLY
111 FFMPEGLDFLAGS
+= -L
$(FFMPEGLIBDIR
) -lavformat
-lavcodec
-lavutil
-lswresample
-lswscale
118 else ifneq (,$(findstring imx6
,$(platform
)))
119 TARGET
:= $(TARGET_NAME
)_libretro.so
120 LDFLAGS
+= -shared
-Wl
,--version-script
=link.T
128 FFMPEGINCFLAGS
+= -I
$(FFMPEGDIR
)/linux
/armv7
/include
129 FFMPEGLIBDIR
:= $(FFMPEGDIR
)/linux
/armv7
/lib
130 FFMPEGLDFLAGS
+= -L
$(FFMPEGLIBDIR
) -lavformat
-lavcodec
-lavutil
-lswresample
-lswscale
134 else ifneq (,$(findstring osx
,$(platform
)))
135 TARGET
:= $(TARGET_NAME
)_libretro.dylib
136 LDFLAGS
+= -dynamiclib
137 OSXVER
= `sw_vers -productVersion | cut -d. -f 2`
138 OSX_LT_MAVERICKS
= `(( $(OSXVER) <= 9 )) && echo "YES"`
139 ifeq ($(OSX_LT_MAVERICKS
),"YES")
140 LDFLAGS
+= -mmacosx-version-min
=10.5
142 LDFLAGS
+= -stdlib
=libc
++
145 FFMPEGINCFLAGS
+= -I
$(FFMPEGDIR
)/macosx
/$(FFMPEG_ARCH
)/include
146 FFMPEGLIBDIR
:= $(FFMPEGDIR
)/macosx
/$(FFMPEG_ARCH
)/lib
147 FFMPEGLDFLAGS
+= -liconv
-L
$(FFMPEGLIBDIR
) -lavformat
-lavcodec
-lavutil
-lswresample
-lswscale
148 PLATCFLAGS
+= -D__MACOSX__
149 GL_LIB
:= -framework OpenGL
153 else ifneq (,$(findstring ios
,$(platform
)))
154 TARGET
:= $(TARGET_NAME
)_libretro_ios.dylib
156 LDFLAGS
+= -dynamiclib
-marm
159 GL_LIB
:= -framework OpenGLES
162 FFMPEGINCFLAGS
+= -I
$(FFMPEGDIR
)/ios
/universal
/include
163 FFMPEGLIBDIR
:= $(FFMPEGDIR
)/ios
/universal
/lib
164 FFMPEGLDFLAGS
+= -L
$(FFMPEGLIBDIR
) -lavformat
-lavcodec
-lavutil
-lswresample
-lswscale
167 IOSSDK
:= $(shell xcodebuild
-version
-sdk iphoneos Path
)
170 CC
= clang
-arch armv7
-isysroot
$(IOSSDK
)
172 CXX
= clang
++ -arch armv7
-isysroot
$(IOSSDK
)
173 OSXVER
= `sw_vers -productVersion | cut -c 4`
175 CC
+= -miphoneos-version-min
=5.0
176 CC_AS
+= -miphoneos-version-min
=5.0
177 CXX
+= -miphoneos-version-min
=5.0
178 PLATCFLAGS
+= -miphoneos-version-min
=5.0
180 PLATCFLAGS
+= -DIOS
-DHAVE_POSIX_MEMALIGN
181 CPUFLAGS
+= -DARMv5_ONLY
-DARM
186 else ifneq (,$(findstring android
,$(platform
)))
188 TARGET
:= $(TARGET_NAME
)_libretro_android.so
189 LDFLAGS
+= -shared
-Wl
,--version-script
=link.T
-Wl
,--no-undefined
-Wl
,--warn-common
192 CC
= arm-linux-androideabi-gcc
193 CXX
= arm-linux-androideabi-g
++
196 PLATCFLAGS
+= -DANDROID
199 CPUFLAGS
+= -marm
-mcpu
=cortex-a8
-mfpu
=neon
-mfloat-abi
=softfp
-D__arm__
-DARM_ASM
-D__NEON_OPT
201 LDFLAGS
+= -llog
-lGLESv2
-lEGL
203 FFMPEGINCFLAGS
+= -I
$(FFMPEGDIR
)/android
/armv7
/include
204 FFMPEGLIBDIR
:= $(FFMPEGDIR
)/android
/armv7
/lib
205 FFMPEGLDFLAGS
+= -L
$(FFMPEGLIBDIR
) -lavformat
-lavcodec
-lavutil
-lswresample
-lswscale
210 else ifeq ($(platform
), qnx
)
212 TARGET
:= $(TARGET_NAME
)_libretro_qnx.so
213 LDFLAGS
+= -shared
-Wl
,--version-script
=link.T
-Wl
,--no-undefined
-Wl
,--warn-common
216 CC
= qcc
-Vgcc_ntoarmv7le
217 CC_AS
= qcc
-Vgcc_ntoarmv7le
218 CXX
= QCC
-Vgcc_ntoarmv7le
219 AR
= QCC
-Vgcc_ntoarmv7le
222 PLATCFLAGS
+= -D__BLACKBERRY_QNX__
224 CPUFLAGS
+= -marm
-mcpu
=cortex-a9
-mfpu
=neon
-mfloat-abi
=softfp
-D__arm__
-DARM_ASM
-D__NEON_OPT
230 else ifneq (,$(findstring armv
,$(platform
)))
233 TARGET
:= $(TARGET_NAME
)_libretro.so
235 LDFLAGS
+= -shared
-Wl
,--version-script
=link.T
-Wl
,--no-undefined
236 FFMPEGINCFLAGS
+= -I
$(FFMPEGDIR
)/linux
/$(FFMPEG_ARCH
)/include
237 FFMPEGLIBDIR
:= $(FFMPEGDIR
)/linux
/$(FFMPEG_ARCH
)/lib
238 FFMPEGLDFLAGS
+= -L
$(FFMPEGLIBDIR
) -lavformat
-lavcodec
-lavutil
-lswresample
-lswscale
241 ifneq (,$(findstring gles
,$(platform
)))
243 GL_LIB
:= -lGLESv2
-lEGL
244 LDFLAGS
+= -lGLESv2
-lEGL
248 ifneq (,$(findstring cortexa8
,$(platform
)))
249 CPUFLAGS
+= -marm
-mcpu
=cortex-a8
250 else ifneq (,$(findstring cortexa9
,$(platform
)))
251 CPUFLAGS
+= -marm
-mcpu
=cortex-a9
254 ifneq (,$(findstring neon
,$(platform
)))
255 CPUFLAGS
+= -mfpu
=neon
-D__NEON_OPT
258 ifneq (,$(findstring softfloat
,$(platform
)))
259 CPUFLAGS
+= -mfloat-abi
=softfp
260 else ifneq (,$(findstring hardfloat
,$(platform
)))
261 CPUFLAGS
+= -mfloat-abi
=hard
263 CPUFLAGS
+= -D__arm__
-DARM_ASM
268 else ifeq ($(platform
), emscripten
)
269 TARGET
:= $(TARGET_NAME
)_libretro_emscripten.bc
272 PLATCFLAGS
+= -DCC_resampler
=mupen_CC_resampler
-Dsinc_resampler
=mupen_sinc_resampler \
273 -Drglgen_symbol_map
=mupen_rglgen_symbol_map
-Dmain_exit
=mupen_main_exit \
274 -Dadler32
=mupen_adler32
-Drarch_resampler_realloc
=mupen_rarch_resampler_realloc \
275 -Daudio_convert_s16_to_float_C
=mupen_audio_convert_s16_to_float_C
-Daudio_convert_float_to_s16_C
=mupen_audio_convert_float_to_s16_C \
276 -Daudio_convert_init_simd
=mupen_audio_convert_init_simd
-Drglgen_resolve_symbols_custom
=mupen_rglgen_resolve_symbols_custom \
277 -Drglgen_resolve_symbols
=mupen_rglgen_resolve_symbols
279 #HAVE_SHARED_CONTEXT := 1
282 else ifneq (,$(findstring win
,$(platform
)))
283 TARGET
:= $(TARGET_NAME
)_libretro.dll
284 LDFLAGS
+= -shared
-static-libgcc
-static-libstdc
++ -Wl
,--version-script
=link.T
-lwinmm
-lgdi32
-lwsock32
-lws2_32
286 PLATFORM_EXT
:= win32
291 include Makefile.common
293 ifeq ($(PERF_TEST
), 1)
294 COREFLAGS
+= -DPERF_TEST
297 ifeq ($(HAVE_SHARED_CONTEXT
), 1)
298 COREFLAGS
+= -DHAVE_SHARED_CONTEXT
301 ifeq ($(SINGLE_THREAD
), 1)
302 COREFLAGS
+= -DSINGLE_THREAD
306 GLFLAGS
+= -DGLES
-DUSING_GLES2
308 GLFLAGS
+= -DHAVE_OPENGL
311 COREFLAGS
+= -D__LIBRETRO__
-DINLINE
="inline" -DPPSSPP
-DUSE_FFMPEG
-DBAKE_IN_GIT
-DPROFILE_THIS_SCOPE\
(x\
)
315 CPUOPTS
+= -DOPENGL_DEBUG
317 CPUOPTS
+= -O3
-DNDEBUG
321 OBJECTS
+= $(SOURCES_CXX
:.
cpp=.o
) $(SOURCES_C
:.c
=.o
) $(ASMFILES
:.S
=.o
)
322 CXXFLAGS
+= -std
=c
++11 $(CPUOPTS
) $(COREFLAGS
) $(INCFLAGS
) $(PLATCFLAGS
) $(fpic
) $(PLATCFLAGS
) $(CPUFLAGS
) $(GLFLAGS
) $(DYNAFLAGS
)
323 CFLAGS
+= $(CPUOPTS
) $(COREFLAGS
) $(INCFLAGS
) $(PLATCFLAGS
) $(fpic
) $(PLATCFLAGS
) $(CPUFLAGS
) $(GLFLAGS
) $(DYNAFLAGS
)
325 LDFLAGS
+= -lm
-lz
-lavcodec
-lavformat
-lswresample
-lavutil
-lswscale
$(FFMPEGLDFLAGS
) $(fpic
)
326 ifeq (,$(findstring android
,$(platform
)))
333 $(CC_AS
) $(CFLAGS
) -c
$^
-o
$@
336 $(CC
) $(CFLAGS
) -c
$^
-o
$@
339 $(CXX
) $(CXXFLAGS
) -c
$^
-o
$@
341 $(TARGET
): $(OBJECTS
)
342 $(CXX
) -o
$@
$(OBJECTS
) $(LDFLAGS
) $(GL_LIB
)
345 rm -f
$(OBJECTS
) $(TARGET
)