Skip to content

Commit

Permalink
Add PLATFORM_DEFINES for PLATFORM_SUPPORTS_*** color format
Browse files Browse the repository at this point in the history
  • Loading branch information
LibretroAdmin committed Feb 26, 2024
1 parent 1a828d4 commit 0058231
Showing 1 changed file with 49 additions and 20 deletions.
69 changes: 49 additions & 20 deletions Makefile.libretro
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@ ifneq ($(findstring SunOS,$(shell uname -a)),)
else
SHARED := -shared -Wl,--version-script=$(LINK_T) -Wl,-no-undefined
endif
PLATFORM_DEFINES := -DFRONTEND_SUPPORTS_ARGB888

else ifeq ($(platform), linux-portable)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC -nostdlib
SHARED := -shared -Wl,--version-script=$(LINK_T)
LIBM :=
PLATFORM_DEFINES := -DFRONTEND_SUPPORTS_ARGB888
# OS X
else ifeq ($(platform), osx)
TARGET := $(TARGET_NAME)_libretro.dylib
Expand All @@ -101,14 +103,13 @@ else ifeq ($(platform), osx)
CFLAGS += $(ARCHFLAGS)
LDFLAGS += $(ARCHFLAGS)
endif

PLATFORM_DEFINES := -DFRONTEND_SUPPORTS_ARGB888
# iOS
else ifneq (,$(findstring ios,$(platform)))

TARGET := $(TARGET_NAME)_libretro_ios.dylib
fpic := -fPIC
SHARED := -dynamiclib
CFLAGS += -DIOS
ifeq ($(IOSSDK),)
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
endif
Expand All @@ -117,15 +118,14 @@ else ifneq (,$(findstring ios,$(platform)))
else
CC = cc -arch armv7 -isysroot $(IOSSDK)
endif
CFLAGS += -DIOS
ifeq ($(platform),$(filter $(platform),ios9 ios-arm64))
CC += -miphoneos-version-min=8.0
CFLAGS += -miphoneos-version-min=8.0
else
CC += -miphoneos-version-min=5.0
CFLAGS += -miphoneos-version-min=5.0
endif

PLATFORM_DEFINES := -DFRONTEND_SUPPORTS_ARGB888 -DIOS
# tvOS
else ifeq ($(platform), tvos-arm64)
TARGET := $(TARGET_NAME)_libretro_tvos.dylib
Expand All @@ -137,6 +137,7 @@ else ifeq ($(platform), tvos-arm64)
endif
CC = clang -arch arm64 -isysroot $(IOSSDK)
CXX = clang++ -arch arm64 -isysroot $(IOSSDK)
PLATFORM_DEFINES := -DFRONTEND_SUPPORTS_ARGB888

# Theos iOS
else ifeq ($(platform), theos_ios)
Expand All @@ -147,6 +148,7 @@ else ifeq ($(platform), theos_ios)
THEOS_BUILD_DIR := objs
include $(THEOS)/makefiles/common.mk
LIBRARY_NAME = $(TARGET_NAME)_libretro_ios
PLATFORM_DEFINES := -DFRONTEND_SUPPORTS_ARGB888

# QNX
else ifeq ($(platform), qnx)
Expand All @@ -164,7 +166,8 @@ else ifeq ($(platform), ps2)
AR = mips64r5900el-ps2-elf-ar$(EXE_EXT)
FCEU_DEFINES := -DPATH_MAX=1024 -DINLINE=inline -DFCEU_VERSION_NUMERIC=9813 -DHAVE_ASPRINTF
ENDIANNESS_DEFINES := -DLSB_FIRST -DLOCAL_LE=1
PLATFORM_DEFINES := -DPS2 -D_EE -G0 -DFRONTEND_SUPPORTS_ABGR1555 -DRENDER_GSKIT_PS2
PLATFORM_DEFINES := -DFRONTEND_SUPPORTS_ABGR1555 -DPS2
PLATFORM_DEFINES += -D_EE -G0 -DRENDER_GSKIT_PS2
PLATFORM_DEFINES += -I$(PS2SDK)/ee/include -I$(PS2SDK)/common/include -I$(PS2DEV)/gsKit/include
STATIC_LINKING=1
EXTERNAL_ZLIB=1
Expand All @@ -175,8 +178,8 @@ else ifeq ($(platform), psp1)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = psp-gcc$(EXE_EXT)
AR = psp-ar$(EXE_EXT)
PLATFORM_DEFINES := -DPSP -G0
PLATFORM_DEFINES += -march=allegrex -mfp32 -mgp32 -mlong32 -mabi=eabi
PLATFORM_DEFINES := -DPSP
PLATFORM_DEFINES += -G0 -march=allegrex -mfp32 -mgp32 -mlong32 -mabi=eabi
PLATFORM_DEFINES += -fomit-frame-pointer -fstrict-aliasing
PLATFORM_DEFINES += -falign-functions=32 -falign-loops -falign-labels -falign-jumps
STATIC_LINKING=1
Expand All @@ -200,13 +203,15 @@ else ifeq ($(platform), dos)
CFLAGS += -march=i386
STATIC_LINKING=1
EXTERNAL_ZLIB=1
PLATFORM_DEFINES := -DFRONTEND_SUPPORTS_RGB565

# CTR(3DS)
else ifeq ($(platform), ctr)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT)
AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT)
PLATFORM_DEFINES := -DARM11 -D_3DS
PLATFORM_DEFINES := -FRONTEND_SUPPORTS_RGB565 -D_3DS
PLATFORM_DEFINES += -DARM11
CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard
CFLAGS += -Wall -mword-relocations
CFLAGS += -fomit-frame-pointer -fstrict-aliasing -ffast-math
Expand All @@ -222,6 +227,7 @@ else ifeq ($(platform), rpi1)
CFLAGS += -DARM11
CFLAGS += -marm -march=armv6j -mfpu=vfp -mfloat-abi=hard -funsafe-math-optimizations
CFLAGS += -fomit-frame-pointer -fstrict-aliasing -ffast-math
PLATFORM_DEFINES := -FRONTEND_SUPPORTS_RGB565

# Raspberry Pi 2
else ifeq ($(platform), rpi2)
Expand All @@ -231,6 +237,7 @@ else ifeq ($(platform), rpi2)
CFLAGS += -DARM
CFLAGS += -marm -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -funsafe-math-optimizations
CFLAGS += -fomit-frame-pointer -fstrict-aliasing -ffast-math
PLATFORM_DEFINES := -FRONTEND_SUPPORTS_ARGB888

# Raspberry Pi 3
else ifeq ($(platform), rpi3)
Expand All @@ -240,6 +247,7 @@ else ifeq ($(platform), rpi3)
CFLAGS += -DARM
CFLAGS += -marm -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -funsafe-math-optimizations
CFLAGS += -fomit-frame-pointer -fstrict-aliasing -ffast-math
PLATFORM_DEFINES := -FRONTEND_SUPPORTS_ARGB888

# Raspberry Pi 3 (64 bit)
else ifeq ($(platform), rpi3_64)
Expand All @@ -248,6 +256,7 @@ else ifeq ($(platform), rpi3_64)
SHARED := -shared -Wl,--version-script=$(LINK_T) -Wl,-no-undefined
CFLAGS += -mcpu=cortex-a53 -mtune=cortex-a53 -funsafe-math-optimizations
CFLAGS += -fomit-frame-pointer -fstrict-aliasing -ffast-math
PLATFORM_DEFINES := -FRONTEND_SUPPORTS_ARGB888

# Raspberry Pi 4 (64-bit)
else ifneq (,$(findstring rpi4,$(platform)))
Expand All @@ -256,13 +265,14 @@ else ifneq (,$(findstring rpi4,$(platform)))
SHARED := -shared -Wl,--version-script=$(LINK_T) -Wl,-no-undefined
CFLAGS += -mcpu=cortex-a72 -mtune=cortex-a72 -funsafe-math-optimizations
CFLAGS += -fomit-frame-pointer -fstrict-aliasing -ffast-math
PLATFORM_DEFINES := -FRONTEND_SUPPORTS_ARGB888

# Lightweight PS3 Homebrew SDK
else ifneq (,$(filter $(platform), ps3 psl1ght))
ENDIANNESS_DEFINES = -DMSB_FIRST
EXTERNAL_ZLIB = 1
STATIC_LINKING = 1
PLATFORM_DEFINES += -D__PS3__
PLATFORM_DEFINES := -DFRONTEND_SUPPORTS_ARGB888 -D__PS3__

ifeq ($(platform), psl1ght)
PLATFORM_DEFINES += -D__PSL1GHT__ -I$(PS3DEV)/ppu/include
Expand All @@ -278,7 +288,7 @@ else ifeq ($(platform), xenon)
TARGET := $(TARGET_NAME)_libretro_xenon360.a
CC = xenon-gcc$(EXE_EXT)
AR = xenon-ar$(EXE_EXT)
PLATFORM_DEFINES := -D__LIBXENON__
PLATFORM_DEFINES := -DFRONTEND_SUPPORTS_ARGB888 -D__LIBXENON__
ENDIANNESS_DEFINES += -DMSB_FIRST
STATIC_LINKING=1
EXTERNAL_ZLIB=1
Expand All @@ -288,7 +298,8 @@ else ifeq ($(platform), ngc)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
PLATFORM_DEFINES := -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float
PLATFORM_DEFINES := -DGEKKO -DPLATFORM_SUPPORTS_RGB565
PLATFORM_DEFINES += -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float
PLATFORM_DEFINES += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
ENDIANNESS_DEFINES += -DMSB_FIRST
STATIC_LINKING=1
Expand All @@ -299,7 +310,8 @@ else ifeq ($(platform), wii)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
PLATFORM_DEFINES := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
PLATFORM_DEFINES := -DGEKKO -DPLATFORM_SUPPORTS_ARGB888
PLATFORM_DEFINES += -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
PLATFORM_DEFINES += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
ENDIANNESS_DEFINES += -DMSB_FIRST
STATIC_LINKING=1
Expand All @@ -311,7 +323,8 @@ else ifeq ($(platform), wiiu)
TARGET := $(TARGET_NAME)_libretro_$(platform).a
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
PLATFORM_DEFINES := -DGEKKO -DHW_RVL -mcpu=750 -meabi -mhard-float
PLATFORM_DEFINES := -DGEKKO -DPLATFORM_SUPPORTS_ARGB888
PLATFORM_DEFINES += -DHW_RVL -mcpu=750 -meabi -mhard-float
PLATFORM_DEFINES += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int
ENDIANNESS_DEFINES += -DMSB_FIRST
STATIC_LINKING=1
Expand All @@ -332,13 +345,13 @@ else ifeq ($(platform), libnx)
EXT=a
TARGET := $(TARGET_NAME)_libretro_$(platform).$(EXT)
DEFINES := -DSWITCH=1 -U__linux__ -U__linux -DRARCH_INTERNAL
CFLAGS := $(DEFINES) -g \
-O2 \
-fPIE -I$(LIBNX)/include/ -ffunction-sections -fdata-sections -ftls-model=local-exec -Wl,--allow-multiple-definition -specs=$(LIBNX)/switch.specs
CFLAGS += $(INCDIRS)
CFLAGS += $(INCLUDE) -D__SWITCH__ -DHAVE_LIBNX
CXXFLAGS := $(ASFLAGS) $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
CFLAGS += -std=gnu11
PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_ARGB888
CFLAGS := $(DEFINES) -g -O2 \
-fPIE -I$(LIBNX)/include/ -ffunction-sections -fdata-sections -ftls-model=local-exec -Wl,--allow-multiple-definition -specs=$(LIBNX)/switch.specs
CFLAGS += $(INCDIRS)
CFLAGS += $(INCLUDE)-D__SWITCH__ -DHAVE_LIBNX
CFLAGS += -std=gnu11
CXXFLAGS := $(ASFLAGS) $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
PLATFORM_DEFINES += -DARM -march=armv8-a -mtune=cortex-a57 -mtp=soft
STATIC_LINKING = 1

Expand All @@ -352,6 +365,7 @@ else ifeq ($(platform), classic_armv7_a7)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=$(LINK_T) -Wl,-no-undefined
PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_ARGB888
CFLAGS += -Ofast \
-flto=4 -fwhole-program -fuse-linker-plugin \
-fdata-sections -ffunction-sections -Wl,--gc-sections \
Expand Down Expand Up @@ -383,6 +397,7 @@ else ifeq ($(platform), classic_armv8_a35)
TARGET := $(TARGET_NAME)_libretro.so
fpic := -fPIC
SHARED := -shared -Wl,--version-script=$(LINK_T) -Wl,-no-undefined
PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_ARGB888
CFLAGS += -Ofast \
-flto=4 -fwhole-program -fuse-linker-plugin \
-fdata-sections -ffunction-sections -Wl,--gc-sections \
Expand All @@ -407,6 +422,7 @@ else ifneq (,$(findstring armv,$(platform)))
TARGET := $(TARGET_NAME)_libretro.so
SHARED := -shared -Wl,--version-script=$(LINK_T) -Wl,-no-undefined
fpic := -fPIC
PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_ARGB888
ifneq (,$(findstring cortexa5,$(platform)))
PLATFORM_DEFINES += -marm -mcpu=cortex-a5
else ifneq (,$(findstring cortexa8,$(platform)))
Expand All @@ -428,6 +444,7 @@ else ifneq (,$(findstring armv,$(platform)))
# emscripten
else ifeq ($(platform), emscripten)
TARGET := $(TARGET_NAME)_libretro_$(platform).bc
PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_ARGB888
STATIC_LINKING=1
EXTERNAL_ZLIB=1

Expand All @@ -439,6 +456,7 @@ else ifeq ($(platform), gcw0)
AR = /opt/gcw0-toolchain/usr/bin/mipsel-linux-ar
fpic := -fPIC
SHARED := -shared -Wl,--version-script=$(LINK_T) -Wl,-no-undefined
PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_RGB565
PLATFORM_DEFINES += -ffast-math -march=mips32 -mtune=mips32r2 -mhard-float -fomit-frame-pointer
EXTERNAL_ZLIB = 1

Expand All @@ -450,6 +468,7 @@ else ifeq ($(platform), retrofw)
AR = /opt/retrofw-toolchain/usr/bin/mipsel-linux-ar
fpic := -fPIC
SHARED := -shared -Wl,--version-script=$(LINK_T) -Wl,-no-undefined
PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_RGB565
PLATFORM_DEFINES += -ffast-math -march=mips32 -mtune=mips32 -mhard-float -fomit-frame-pointer
EXTERNAL_ZLIB = 1

Expand All @@ -461,6 +480,7 @@ else ifeq ($(platform), miyoo)
AR = /opt/miyoo/usr/bin/arm-linux-ar
fpic := -fPIC
SHARED := -shared -Wl,--version-script=$(LINK_T) -Wl,-no-undefined
PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_RGB565
PLATFORM_DEFINES += -fomit-frame-pointer -ffast-math -mcpu=arm926ej-s
EXTERNAL_ZLIB = 1

Expand All @@ -482,6 +502,7 @@ else ifneq (,$(findstring windows_msvc2017,$(platform)))
LIBS += WindowsApp.lib
endif

PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_ARGB888
CFLAGS += $(MSVC2017CompileFlags)
CXXFLAGS += $(MSVC2017CompileFlags)

Expand Down Expand Up @@ -558,6 +579,7 @@ else ifeq ($(platform), windows_msvc2010_x64)
CC = cl.exe
CXX = cl.exe

PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_ARGB888
PATH := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/bin/amd64"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../IDE")
LIB := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/lib/amd64")
Expand All @@ -581,6 +603,7 @@ else ifeq ($(platform), windows_msvc2010_x86)
CC = cl.exe
CXX = cl.exe

PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_ARGB888
PATH := $(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../../VC/bin"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS100COMNTOOLS)../IDE")
LIB := $(shell IFS=$$'\n'; cygpath -w "$(VS100COMNTOOLS)../../VC/lib")
Expand All @@ -606,6 +629,7 @@ CC = CL.exe
CXX = CL.exe
LD = lib.exe

PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_ARGB888
export INCLUDE := $(XDK)\xbox\include
export LIB := $(XDK)\xbox\lib
PATH := $(call unixcygpath,$(XDK)/xbox/bin/vc71):$(PATH)
Expand All @@ -621,6 +645,7 @@ CC = cl.exe
CXX = cl.exe
LD = lib.exe

PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_ARGB888
export INCLUDE := $(XEDK)/include/xbox
export LIB := $(XEDK)/lib/xbox
PATH := $(call unixcygpath,$(XEDK)/bin/win32):$(PATH)
Expand All @@ -635,6 +660,7 @@ else ifeq ($(platform), windows_msvc2008_x86)
CC = cl.exe
CXX = cl.exe

PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_ARGB888
PATH := $(shell IFS=$$'\n'; cygpath "$(VS90COMNTOOLS)../../VC/bin"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS90COMNTOOLS)../IDE")
INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS90COMNTOOLS)../../VC/include")
Expand All @@ -654,6 +680,7 @@ else ifeq ($(platform), windows_msvc2005_x86)
CC = cl.exe
CXX = cl.exe

PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_ARGB888
PATH := $(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../../VC/bin"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../IDE")
INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS80COMNTOOLS)../../VC/include")
Expand All @@ -680,6 +707,7 @@ else ifeq ($(platform), windows_msvc2003_x86)
CC = cl.exe
CXX = cl.exe

PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_ARGB888
PATH := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/bin"):$(PATH)
PATH := $(PATH):$(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../IDE")
INCLUDE := $(shell IFS=$$'\n'; cygpath "$(VS71COMNTOOLS)../../Vc7/include")
Expand All @@ -698,6 +726,7 @@ CFLAGS += -D_CRT_SECURE_NO_DEPRECATE
else
TARGET := $(TARGET_NAME)_libretro.dll
CC ?= gcc
PLATFORM_DEFINES := -DPLATFORM_SUPPORTS_ARGB888
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=$(LINK_T)
endif

Expand Down

0 comments on commit 0058231

Please sign in to comment.