RetroArch/Makefile.orbis
2022-08-01 07:51:02 +02:00

212 lines
5.8 KiB
Makefile

TARGET := retroarch_orbis
DEBUG ?= 0
GRIFFIN_BUILD = 0
WHOLE_ARCHIVE_LINK = 0
HAVE_STATIC_DUMMY ?= 0
HAVE_GLES3 ?= 0
HAVE_MOUSE ?= 0
HAVE_KEYBOARD ?= 0
PS4_TITLE_ID := RETROARCH
PS4_TITLE_NAME := RetroArch
PC_DEVELOPMENT_IP_ADDRESS = 192.168.1.137
PC_DEVELOPMENT_UDP_PORT = 18194
AUTH_INFO = 000000000000000000000000001C004000FF000000000080000000000000000000000000000000000000008000400040000000000000008000000000000000080040FFFF000000F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
OBJ += deps/xxHash/xxhash.o \
# input/drivers/ps4_input.o \
# input/drivers_joypad/ps4_joypad.o \
# audio/drivers/psp_audio.o \
# gfx/drivers_context/orbis_ctx.o \
# frontend/drivers/platform_orbis.o
ifeq ($(HAVE_GLES3),1)
DEFINES += -DHAVE_OPENGLES3
endif
ifeq ($(HAVE_STATIC_DUMMY),1)
DEFINES += -DHAVE_STATIC_DUMMY
endif
ifeq ($(GRIFFIN_BUILD), 1)
OBJ += griffin/griffin.o
DEFINES += -DHAVE_GRIFFIN=1
DEFINES += -DHAVE_MENU -DHAVE_LIBRETRODB -DHAVE_CONFIGFILE
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DHAVE_CC_RESAMPLER
DEFINES += -DHAVE_CORE_INFO_CACHE
ifeq ($(DEBUG), 1)
DEFINES += -DHAVE_NETLOGGER
endif
else
HAVE_FILTERS_BUILTIN := 1
HAVE_LANGEXTRA := 1
HAVE_IMAGEVIEWER := 1
HAVE_RPNG := 1
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_ZLIB := 1
HAVE_BUILTINZLIB := 1
HAVE_OVERLAY := 1
HAVE_VIDEO_LAYOUT := 1
HAVE_7ZIP := 1
HAVE_EGL := 1
HAVE_GFX_WIDGETS := 1
HAVE_GLSL := 1
HAVE_SHADERPIPELINE := 1
HAVE_OPENGL := 1
HAVE_OPENGLES := 1
HAVE_OPENGLES2 := 1
HAVE_NETWORKING := 0
HAVE_IFINFO := 0
HAVE_SOCKET_LEGACY := 1
HAVE_MENU := 1
HAVE_MENU_COMMON := 1
HAVE_RGUI := 1
HAVE_STB_FONT := 1
HAVE_STB_VORBIS := 1
HAVE_DR_FLAC := 1
HAVE_DR_MP3 := 1
HAVE_MATERIALUI := 1
HAVE_XMB := 1
HAVE_OZONE := 1
HAVE_RGUI := 1
HAVE_THREADS := 1
HAVE_THREAD_ATTR := 1
HAVE_LIBRETRODB := 1
HAVE_CC_RESAMPLER := 1
HAVE_CHEEVOS := 1
HAVE_RUNAHEAD := 1
RARCH_CONSOLE := 1
HAVE_MAIN := 1
HAVE_ONLINE_UPDATER := 1
HAVE_COMPRESSION := 1
HAVE_UPDATE_ASSETS := 1
HAVE_UPDATE_CORES := 1
HAVE_CONFIGFILE := 1
HAVE_CHD := 1
HAVE_STATIC_VIDEO_FILTERS = 1
HAVE_STATIC_AUDIO_FILTERS = 1
HAVE_CORE_INFO_CACHE := 1
ifeq ($(DEBUG), 1)
HAVE_NETLOGGER = 1
endif
include Makefile.common
CFLAGS += $(DEF_FLAGS)
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
endif
ifeq ($(strip $(ORBISDEV)),)
$(error "Please set ORBISDEV in your environment. export ORBISDEV=<path to>orbisdev")
endif
PREFIX := orbis-
CC := clang
CXX := clang++
AS := $(PREFIX)as
AR := $(PREFIX)ar
OBJCOPY := $(PREFIX)objcopy
STRIP := $(PREFIX)strip
NM := $(PREFIX)nm
LD := clang
LIBDIRS += -L. -Lcores -Lbuild -L$(ORBISDEV)/usr/lib
INCDIRS += -I. -Idefines -Ideps -Ideps/7zip -Ideps/libz -Ilibretro-common/include -Ideps/stb \
-Ilibretro-common/include/compat/zlib -Ideps/rcheevos/include -I$(ORBISDEV)/usr/include -I$(ORBISDEV)/usr/include/c++/v1 -I$(ORBISDEV)/usr/include/orbis
ARCHFLAGS += --target=x86_64-scei-ps4 -DORBIS -D__ORBIS__ -D__PS4__ -D_BSD_SOURCE
DEFINES += -DRARCH_INTERNAL -DRARCH_CONSOLE -DHAVE_FILTERS_BUILTIN \
-DHAVE_XMB -DHAVE_RGUI -DHAVE_OZONE \
-DHAVE_ONLINE_UPDATER -DHAVE_UPDATE_CORES -DHAVE_UPDATE_ASSETS \
# Compiling with -Werror and disabling some warnings
DEFINES += -Werror -Wno-macro-redefined -Wno-typedef-redefinition -Wno-non-literal-null-conversion -Wno-void-pointer-to-int-cast \
-Wno-format -Wno-tautological-constant-out-of-range-compare -Wno-implicit-function-declaration
ifeq ($(HAVE_KEYBOARD), 1)
DEFINES += -DHAVE_KEYBOARD
PS4_LIBS += -lSceDbgKeyboard_stub
endif
ifeq ($(HAVE_MOUSE),1)
DEFINES += -DHAVE_MOUSE
PS4_LIBS += -lSceMouse_stub
endif
ifneq ($(PC_DEVELOPMENT_IP_ADDRESS),)
DEFINES += -DPC_DEVELOPMENT_IP_ADDRESS='"$(PC_DEVELOPMENT_IP_ADDRESS)"'
endif
ifneq ($(PC_DEVELOPMENT_UDP_PORT),)
DEFINES += -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
endif
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := --whole-archive
WHOLE_END := --no-whole-archive
endif
PS4_LIBS += -luser_mem_sys -lkernel_stub -lSceLibcInternal_stub -lunwind -lc++ -lc++abi -lc++experimental \
-lorbisLink -lkernelUtil -ldebugnet -lorbisNfs -lSceSysmodule_stub -lSceSystemService_stub -lSceNet_stub \
-lSceUserService_stub -lScePigletv2VSH_stub -lSceVideoOut_stub -lSceGnmDriver_stub -lorbisPad \
-lScePad_stub -lSceAudioOut_stub -lSceIme_stub -lSceNetCtl_stub -lSQLite
ifeq ($(HAVE_STATIC_DUMMY),1)
LIBS := $(PS4_LIBS)
else
LIBS := $(WHOLE_START) -lretro_orbis $(WHOLE_END) $(PS4_LIBS)
endif
CFLAGS := $(ARCHFLAGS) $(INCDIRS) $(DEFINES)
CXXFLAGS := $(ARCHFLAGS) $(INCDIRS) $(DEFINES)
LDFLAGS := $(LIBDIRS) -Wl,--gc-sections -Wl,-z -Wl,max-page-size=0x4000 -Wl,--dynamic-linker="/libexec/ld-elf.so.1" -Wl,-pie -Wl,--eh-frame-hdr -target x86_64-scei-ps4-elf -T $(ORBISDEV)/usr/lib/linker.x
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -fno-inline
CXXFLAGS += -O0 -fno-inline
else
CFLAGS += -O3
CXXFLAGS += -O3
endif
TARGETS := $(TARGET).elf
all: $(TARGETS)
OBJOUT = -o
%.o: %.c
$(CC) $(CFLAGS) -c $(OBJOUT)$@ $<
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $(OBJOUT)$@ $<
%.o: %.S
$(CC) $(CFLAGS) -c $(OBJOUT)$@ $<
%.o: %.s
$(CC) -c $(OBJOUT)$@ $<
$(TARGET).elf: $(OBJ)
$(LD) $(ORBISDEV)/usr/lib/crt0.o $(OBJ) $(LDFLAGS) $(LIBS) -o $(TARGET).elf
install:
@cp homebrew.self $(SELF_PATH_INSTALL)
@echo "Installed!"
oelf:
@orbis-elf-create $(TARGET).elf homebrew.oelf
eboot:
python $(ORBISDEV)/bin/make_fself.py --auth-info $(AUTH_INFO) homebrew.oelf homebrew.self
clean:
rm -f $(OBJ) $(TARGET).elf $(TARGET).oelf
.PHONY: clean all