Files
Mu/libretroBuildSystem/build/Makefile.common
2022-10-02 16:25:53 -04:00

130 lines
3.9 KiB
Makefile

EMU_PATH := $(CORE_DIR)/../src
LIBRETRO_COMM_DIR := $(CORE_DIR)/libretro-common
COREDEFINES :=
# my first make function!!!
CHECK_ALL = $(strip $(foreach v,$(2),$(if $(findstring $(v),$(1)),$(v),)))
INCFLAGS := -I$(CORE_DIR)/../include -I$(LIBRETRO_COMM_DIR)/include
ifeq ($(DEBUG), 1)
COREDEFINES += -DEMU_DEBUG
else
EMU_NO_SAFETY := 1
endif
# "unix" or "win" is not specific enough, need to know the CPU arch too
this_system := $(platform)
ifneq (,$(filter unix win,$(this_system)))
this_system := $(shell $(CC) -dumpmachine)
endif
ifneq (,$(findstring msvc200,$(this_system)))
INCFLAGS += -I$(LIBRETRO_COMM_DIR)/include/compat/msvc
endif
ifneq (,$(findstring msvc20,$(this_system)))
# Mu is dependent on stdbool.h and the standard inline directive existing
INCFLAGS += -I$(CORE_DIR)/fixIncludes/stdbool
COREDEFINES += -Dinline=_inline -DINLINE=_inline
endif
ifneq (,$(call CHECK_ALL,$(this_system),windows mingw))
# Windows
ifeq (,$(findstring msvc,$(this_system)))
EMU_SUPPORT_PALM_OS5 := 1
EMU_OS := windows
ifneq (,$(call CHECK_ALL,$(this_system),x86_64 x64))
EMU_ARCH := x86_64
else
EMU_ARCH := x86_32
endif
else
# MSVC uses its own(incompatible) ASM syntax
EMU_SUPPORT_PALM_OS5 := 0
endif
else ifneq (,$(call CHECK_ALL,$(this_system),armv8 aarch64))
# ARM Linux 64
EMU_SUPPORT_PALM_OS5 := 1
EMU_ARCH := armv8
EMU_OS := linux
else ifneq (,$(call CHECK_ALL,$(this_system),armv rpi2 rpi3))
# ARM Linux(rpi3 is aarch64 but its almost always used in 32bit mode)
EMU_SUPPORT_PALM_OS5 := 1
EMU_ARCH := armv7
EMU_OS := linux
else ifneq (,$(findstring armhf,$(this_system)))
# ARM Linux ARMv5
# this needs to be before "linux" because it will trigger the linux case
EMU_SUPPORT_PALM_OS5 := 0
else ifneq (,$(call CHECK_ALL,$(this_system),osx linux))
# x86_* Linux
EMU_SUPPORT_PALM_OS5 := 1
ifneq (,$(call CHECK_ALL,$(this_system),osx x86_64 x64))
EMU_ARCH := x86_64
else
EMU_ARCH := x86_32
endif
EMU_OS := linux
endif
# OS 5 isnt even booting yet, just turn the dynarec off to make it compile easier
EMU_ARCH := unknown
ifneq (,$(filter ps3 sncps3 psl1ght ngc wii wiiu,$(this_system)))
COREDEFINES += -DEMU_BIG_ENDIAN
else ifeq ($(this_system), osx)
ifeq ($(arch), ppc)
COREDEFINES += -DEMU_BIG_ENDIAN
endif
endif
# use all CPUs and optimize for the most likely outcome, Android is handled separately
# Apple broke OpenMP in there port of Clang so no Mac OS or iOS
# ifneq (,$(call CHECK_ALL,$(this_system),windows mingw linux))
# # none of libretros MSVC compilers work with these optimizations for multiple different reasons
# # they dont have the library "VCOMP.lib"
# # they are too old for the extension to exist
# # MSVC never has or will support __builtin_expect
# ifeq (,$(findstring msvc,$(this_system)))
# COREDEFINES += -fopenmp -DEMU_MULTITHREADED -DEMU_MANAGE_HOST_CPU_PIPELINE
# LDFLAGS += -fopenmp
# endif
# endif
# use C++11
ifeq ($(EMU_SUPPORT_PALM_OS5), 1)
ifneq ($(this_system), android_jni)
CXXFLAGS += -std=c++11
endif
endif
# RetroArch needs to be able to launch files directly
EMU_HAVE_FILE_LAUNCHER := 1
include $(EMU_PATH)/makefile.all
COREDEFINES += $(EMU_DEFINES)
SOURCES_C := $(CORE_DIR)/libretro.c \
$(CORE_DIR)/cursors.c \
$(CORE_DIR)/miniz.c \
$(EMU_SOURCES_C)
SOURCES_CXX := $(EMU_SOURCES_CXX)
SOURCES_ASM := $(EMU_SOURCES_ASM)
ifneq ($(STATIC_LINKING), 1)
SOURCES_C += $(LIBRETRO_COMM_DIR)/compat/compat_strl.c \
$(LIBRETRO_COMM_DIR)/compat/compat_posix_string.c \
$(LIBRETRO_COMM_DIR)/compat/fopen_utf8.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \
$(LIBRETRO_COMM_DIR)/memmap/memmap.c \
$(LIBRETRO_COMM_DIR)/streams/file_stream.c \
$(LIBRETRO_COMM_DIR)/string/stdstring.c \
$(LIBRETRO_COMM_DIR)/vfs/vfs_implementation.c
endif
# Make sure C++ shares our include flags!
CXXFLAGS += $(INCFLAGS)