RetroArch/Makefile.wiiu

372 lines
10 KiB
Makefile
Raw Normal View History

TARGET := retroarch_wiiu
2017-12-31 08:07:14 -05:00
BUILD_HBL_ELF = 1
BUILD_RPX = 1
DEBUG = 0
GRIFFIN_BUILD = 0
SALAMANDER_BUILD = 0
2022-08-05 10:24:46 -04:00
HAVE_STATIC_DUMMY ?= 0
2017-12-31 08:07:14 -05:00
WHOLE_ARCHIVE_LINK = 0
2018-02-06 02:21:00 -05:00
WIIU_HID = 1
2021-09-25 13:41:06 -04:00
HAVE_HID = 1
2018-04-08 01:15:59 -04:00
HAVE_RUNAHEAD = 1
WIIU_LOG_RPX = 0
2017-12-31 08:07:14 -05:00
BUILD_DIR = objs/wiiu
PC_DEVELOPMENT_TCP_PORT ?=
LOAD_WITHOUT_CORE_INFO ?= 0
2017-12-31 08:07:14 -05:00
ifeq ($(SALAMANDER_BUILD),1)
BUILD_DIR := $(BUILD_DIR)-salamander
TARGET := $(TARGET)_salamander
else ifeq ($(GRIFFIN_BUILD),1)
BUILD_DIR := $(BUILD_DIR)-griffin
2017-12-31 08:07:14 -05:00
endif
ifeq ($(DEBUG),1)
BUILD_DIR := $(BUILD_DIR)-debug
endif
2016-10-26 20:34:10 -04:00
ifneq ($(V), 1)
Q := @
endif
DEFINES :=
OBJ :=
INCDIRS :=
#-----------------------------
# Features and object files
OBJ += wiiu/main.o
OBJ += wiiu/system/memory.o
OBJ += wiiu/system/atomic.o
OBJ += wiiu/system/exception_handler.o
OBJ += wiiu/system/missing_libc_functions.o
OBJ += wiiu/fs/sd_fat_devoptab.o
OBJ += wiiu/fs/fs_utils.o
OBJ += wiiu/hbl.o
RPX_OBJ = $(BUILD_DIR)/wiiu/system/stubs_rpl.o
HBL_ELF_OBJ = $(BUILD_DIR)/wiiu/system/dynamic.o \
$(BUILD_DIR)/wiiu/system/stubs_elf.o
2017-12-31 08:07:14 -05:00
ifeq ($(SALAMANDER_BUILD),1)
DEFINES += -DRARCH_CONSOLE -DIS_SALAMANDER
OBJ += frontend/frontend_salamander.o
OBJ += frontend/frontend_driver.o
OBJ += frontend/drivers/platform_wiiu.o
OBJ += libretro-common/encodings/encoding_utf.o
OBJ += libretro-common/compat/compat_strcasestr.o
2019-01-08 15:42:52 -05:00
OBJ += libretro-common/compat/fopen_utf8.o
2017-12-31 08:07:14 -05:00
OBJ += libretro-common/file/file_path.o
2020-01-09 19:16:25 -05:00
OBJ += libretro-common/file/file_path_io.o
2017-12-31 08:07:14 -05:00
OBJ += libretro-common/string/stdstring.o
OBJ += libretro-common/lists/string_list.o
OBJ += libretro-common/lists/dir_list.o
OBJ += libretro-common/file/retro_dirent.o
OBJ += libretro-common/compat/compat_strl.o
OBJ += libretro-common/compat/compat_strldup.o
2017-12-31 08:07:14 -05:00
OBJ += libretro-common/file/config_file.o
OBJ += libretro-common/streams/file_stream.o
OBJ += libretro-common/vfs/vfs_implementation.o
2020-12-28 14:24:55 -05:00
OBJ += libretro-common/hash/lrc_hash.o
2020-06-04 17:37:35 -04:00
OBJ += libretro-common/time/rtime.o
2017-12-31 08:07:14 -05:00
OBJ += verbosity.o
# $(SALAMANDER_BUILD),0
2016-10-26 20:34:10 -04:00
else
2017-12-31 08:07:14 -05:00
DEFINES += -DRARCH_INTERNAL
DEFINES += -DHAVE_SCREENSHOTS
2017-12-31 08:07:14 -05:00
DEFINES += -DHAVE_KEYMAPPER
2019-11-10 18:22:03 -05:00
DEFINES += -DHAVE_ONLINE_UPDATER
2017-12-31 08:07:14 -05:00
DEFINES += -DHAVE_UPDATE_ASSETS
DEFINES += -DHAVE_UPDATE_CORES
DEFINES += -DHAVE_UPDATE_CORE_INFO
2017-12-31 08:07:14 -05:00
DEFINES += -DHAVE_FILTERS_BUILTIN
DEFINES += -DHAVE_SLANG
DEFINES += -DHAVE_SHADERPIPELINE
2017-12-31 08:07:14 -05:00
2018-04-08 01:15:59 -04:00
ifeq ($(HAVE_RUNAHEAD),1)
DEFINES += -DHAVE_RUNAHEAD
2018-04-08 01:15:59 -04:00
endif
ifeq ($(LOAD_WITHOUT_CORE_INFO),1)
DEFINES += -DLOAD_WITHOUT_CORE_INFO
endif
2018-04-08 01:15:59 -04:00
2018-01-04 11:38:04 -05:00
OBJ += wiiu/shader_utils.o
OBJ += gfx/drivers/gx2_shaders/tex.o
OBJ += gfx/drivers/gx2_shaders/sprite.o
OBJ += gfx/drivers/gx2_shaders/frame.o
OBJ += gfx/drivers/gx2_shaders/ribbon.o
OBJ += gfx/drivers/gx2_shaders/ribbon_simple.o
OBJ += gfx/drivers/gx2_shaders/bokeh.o
OBJ += gfx/drivers/gx2_shaders/snow.o
OBJ += gfx/drivers/gx2_shaders/snow_simple.o
OBJ += gfx/drivers/gx2_shaders/snowflake.o
2017-12-31 08:07:14 -05:00
ifeq ($(GRIFFIN_BUILD), 1)
2020-05-10 08:30:30 -04:00
OBJ += griffin/griffin.o griffin/griffin_cpp.o
INCDIRS += -Ilibretro-common/include/compat/zlib
# for stb, libfat, iosuhax
INCDIRS += -Ideps -Ideps/libfat/include -Ideps/libiosuhax/include
# pad_functions uses wiiu/input.h
INCDIRS += -Iinput/include
INCDIRS += -Ideps/SPIRV-Cross
2019-07-11 05:51:06 -04:00
DEFINES += -DHAVE_AUDIOMIXER
2020-06-30 11:36:03 -04:00
DEFINES += -DHAVE_RWAV
2020-06-30 13:35:41 -04:00
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_GFX_WIDGETS -DHAVE_CONFIGFILE -DHAVE_PATCH -DHAVE_CHEATS -DHAVE_RGUI -DHAVE_LIBRETRODB
2020-07-01 15:04:05 -04:00
DEFINES += -DHAVE_REWIND
2019-07-25 02:07:24 -04:00
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DHAVE_CC_RESAMPLER
DEFINES += -DHAVE_SPIRV_CROSS -DHAVE_SLANG
2022-08-01 01:51:02 -04:00
DEFINES += -DHAVE_STB_FONT -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DHAVE_LIBRETRODB -DHAVE_NETWORKING -DHAVE_IFINFO -DHAVE_NETPLAYDISCOVERY
#DEFINES += -DWANT_IFADDRS
#DEFINES += -DHAVE_FREETYPE
DEFINES += -DHAVE_XMB -DHAVE_MATERIALUI
DEFINES += -DHAVE_HID
DEFINES += -DWANT_LIBFAT -DHAVE_LIBFAT -DWANT_IOSUHAX -DHAVE_IOSUHAX
DEFINES += -DHAVE_CORE_INFO_CACHE
DEFINES += -DSPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS
# $(GRIFFIN_BUILD),0
2017-12-31 08:07:14 -05:00
else
HAVE_SCREENSHOTS = 1
2019-07-11 05:51:06 -04:00
HAVE_AUDIOMIXER = 1
2020-06-30 11:36:03 -04:00
HAVE_RWAV = 1
HAVE_MENU_COMMON = 1
2020-05-10 09:13:23 -04:00
HAVE_GFX_WIDGETS = 1
HAVE_RTGA = 1
HAVE_RPNG = 1
HAVE_RJPEG = 1
HAVE_RBMP = 1
HAVE_CONFIGFILE = 1
HAVE_PATCH = 1
XDelta patch support (Take 2) (#15915) * Add xdelta in deps * Include <assert.h> in xdelta3.h - Otherwise the static_assert calls can fail * Build xdelta3 in Makefile.common * Add xdelta support to the softpatching infrastructure - The patching itself isn't fully implemented yet * Adjust how xdelta3.h checks the sizes of some types - Now checks max values instead of relying on autotools * Add some enums that were excluded by the cherry-pick * Remove stray whitespace * Adjust SIZE macros in xdelta3.h - Move them outside the XD3_USE_LARGEFILE64 block - Add more SIZE declarations - Make SIZEOF_UNSIGNED_LONG_LONG contingent on the presence of ULLONG_MAX * Reintegrate xdelta support * Enable support for xdelta's secondary compressors - Necessary for some patches * Fix some format specifiers * Remove unnecessary files from xdelta * Include xdelta3.h with a relative path * Add xdelta3 headers to HEADERS variable * Gate Xdelta support behind HAVE_XDELTA - HAVE_XDELTA is on by default - HAVE_PATCH is still required for HAVE_XDELTA to be meaningful - Support is mostly contingent on the availability of LZMA - Anything modern should be okay - Legacy platforms (e.g. DOS) may need to have Xdelta support disabled - At least until some other solution can be found * Disable HAVE_XDELTA on platforms where the build recently failed - These come from looking at the failed builds on GitHub - These are guesses, and may turn out to be wrong * Fix a potential memory leak - Whoops, looks like I need to call two cleanup functions - xd3_close_stream exists separately from xd3_free_stream * Split the --help printout for --xdelta into its own strlcat call - GCC was complaining about #ifdefs within macro arguments being non-portable * Fix some incorrect printf format specifiers * Modify Xdelta to adhere to C89 - It's mostly using RetroArch's INLINE macro instead of the inline keyword * Slight cleanups * Remove a stray comma that was hindering C89 builds * Add XDelta support to CHANGES.md * Change how the xdelta patch's name is computed - To be in line with other recent refactoring * Fix an incorrect merge - Whoops, this part was from before I figured out how to get the size of a patched file * Explain the song-and-dance behind computing a patched file's size * Define some XDelta3-related constants to 0 on 32-bit platforms * Adjust some Xdelta-related macro definitions - Exclude the encoder, since we're not making patches - Move some #defines to after inclusion of <stdint.h>, to fix undefined behavior - Remove _WIN32_WINNT overrides, since they were for code that we're not using * Fix Xdelta support * Wrap an encoder-only function in `#if XD3_ENCODER`
2023-11-23 23:19:07 -05:00
HAVE_XDELTA = 0 # disabled because <lzma.h> isn't available (or we haven't figured out how to install it)
2020-07-01 15:04:05 -04:00
HAVE_REWIND = 1
2020-06-30 13:35:41 -04:00
HAVE_CHEATS = 1
HAVE_MENU = 1
HAVE_RGUI = 1
HAVE_7ZIP = 1
HAVE_ZLIB = 1
HAVE_BUILTINZLIB = 0
HAVE_LIBRETRODB = 1
HAVE_MATERIALUI = 1
HAVE_XMB = 1
HAVE_STB_FONT = 1
#HAVE_FREETYPE = 1
HAVE_LANGEXTRA = 1
HAVE_LIBRETRODB = 1
HAVE_NETWORKING = 1
2022-08-01 01:51:02 -04:00
HAVE_IFINFO = 1
HAVE_NETPLAYDISCOVERY = 1
HAVE_CHEEVOS = 1
#WANT_IFADDRS = 1
HAVE_OVERLAY = 1
HAVE_SPIRV_CROSS = 1
HAVE_SLANG = 1
2020-07-01 20:13:04 -04:00
HAVE_DSP_FILTER = 1
2020-07-02 00:28:14 -04:00
HAVE_VIDEO_FILTER = 1
HAVE_STATIC_VIDEO_FILTERS = 1
HAVE_STATIC_AUDIO_FILTERS = 1
WANT_LIBFAT = 1
WANT_IOSUHAX = 1
HAVE_CORE_INFO_CACHE = 1
include Makefile.common
DEFINES += $(DEF_FLAGS)
INCDIRS += $(INCLUDE_DIRS)
2017-12-31 08:07:14 -05:00
endif
endif
OBJ := $(addprefix $(BUILD_DIR)/,$(OBJ))
#-----------------------------
# Compile flags
DEFINES += -DWIIU -D__WUT__ -DHW_WUP -D__wiiu__
2017-12-31 08:07:14 -05:00
DEFINES += -DHAVE_MAIN
DEFINES += -DRARCH_CONSOLE
ifeq ($(WIIU_LOG_RPX),1)
DEFINES += -DWIIU_LOG_RPX
2016-10-26 20:34:10 -04:00
endif
ifneq ($(PC_DEVELOPMENT_TCP_PORT),)
DEFINES += -DPC_DEVELOPMENT_TCP_PORT=$(PC_DEVELOPMENT_TCP_PORT)
2017-01-23 09:59:44 -05:00
endif
INCDIRS += -I.
INCDIRS += -Ilibretro-common/include
INCDIRS += -Iwiiu
INCDIRS += -Iwiiu/include
2016-10-26 20:34:10 -04:00
CFLAGS := -mcpu=750 -meabi -mhard-float
CFLAGS += -ffast-math -Werror=implicit-function-declaration
CFLAGS += -ffunction-sections -fdata-sections
#CFLAGS += -fomit-frame-pointer -mword-relocations
CFLAGS += -Wall
2016-10-26 20:34:10 -04:00
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
2016-10-26 20:34:10 -04:00
else
CFLAGS += -O3
2016-10-26 20:34:10 -04:00
endif
2017-12-31 08:07:14 -05:00
ASFLAGS := $(CFLAGS) -mregnames
2016-10-26 20:34:10 -04:00
#-----------------------------
# Linking/library flags
LIBDIRS := -L.
LDFLAGS := $(CFLAGS)
2017-01-23 09:59:44 -05:00
2016-10-26 20:34:10 -04:00
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
endif
2017-12-31 08:07:14 -05:00
2022-08-05 10:24:46 -04:00
LIB_CORE :=
ifeq ($(HAVE_STATIC_DUMMY),1)
DEFINES += -DHAVE_STATIC_DUMMY
else
LIB_CORE += -lretro_wiiu
endif
LIBS := $(WHOLE_START) $(LIB_CORE) $(WHOLE_END) -lm
2017-12-19 16:12:58 -05:00
# Use portlibs zlib if deps/ isn't being used
ifeq ($(HAVE_ZLIB),1)
ifeq ($(HAVE_BUILTINZLIB),0)
INCDIRS += -I$(DEVKITPRO)/portlibs/ppc/include
LIBDIRS += -L$(DEVKITPRO)/portlibs/ppc/lib
# Bonus: libpng for cores that need it
LIBS += -lpng -lz
endif
2017-12-19 16:12:58 -05:00
endif
2016-10-26 20:34:10 -04:00
LDFLAGS += -Wl,--gc-sections
RPX_LDFLAGS := -pie -fPIE
RPX_LDFLAGS += -z common-page-size=64 -z max-page-size=64
RPX_LDFLAGS += -T wiiu/link_rpl.ld
RPX_LDFLAGS += -nostartfiles
HBL_ELF_LDFLAGS := -T wiiu/link_elf.ld
#-----------------------------
# Compiler setup
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPRO")
endif
export PATH := $(PATH):$(DEVKITPPC)/bin
PREFIX := powerpc-eabi-
CC := $(PREFIX)gcc
CXX := $(PREFIX)g++
AS := $(PREFIX)as
AR := $(PREFIX)ar
OBJCOPY := $(PREFIX)objcopy
STRIP := $(PREFIX)strip
NM := $(PREFIX)nm
LD := $(CXX)
ELF2RPL := wiiu/wut/elf2rpl/elf2rpl
ifneq ($(findstring Linux,$(shell uname -a)),)
else ifneq ($(findstring Darwin,$(shell uname -a)),)
else
ELF2RPL := $(ELF2RPL).exe
endif
#-----------------------------
# Targets and build rules
TARGETS :=
ifeq ($(BUILD_RPX), 1)
TARGETS += $(TARGET).rpx
endif
2016-10-26 20:34:10 -04:00
ifeq ($(BUILD_HBL_ELF), 1)
TARGETS += $(TARGET).elf
endif
2017-12-31 08:07:14 -05:00
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.depend
all: $(TARGETS)
2017-12-31 08:07:14 -05:00
%: $(BUILD_DIR)/%
cp $< $@
$(BUILD_DIR)/%.o: %.cpp %.depend
@$(if $(Q), echo CXX $<,)
2017-12-31 08:07:14 -05:00
@mkdir -p $(dir $@)
$(Q)$(CXX) -c -o $@ $< $(CXXFLAGS) $(DEFINES) $(INCDIRS) $(DEPFLAGS)
2016-10-26 20:34:10 -04:00
2017-12-31 08:07:14 -05:00
$(BUILD_DIR)/%.o: %.c %.depend
@$(if $(Q), echo CC $<,)
2017-12-31 08:07:14 -05:00
@mkdir -p $(dir $@)
$(Q)$(CC) -c -o $@ $< $(CFLAGS) $(DEFINES) $(INCDIRS) $(DEPFLAGS)
2016-10-26 20:34:10 -04:00
2017-12-31 08:07:14 -05:00
$(BUILD_DIR)/%.o: %.S %.depend
@$(if $(Q), echo AS $<,)
2017-12-31 08:07:14 -05:00
@mkdir -p $(dir $@)
$(Q)$(CC) -c -o $@ $< $(ASFLAGS) $(DEFINES) $(INCDIRS) $(DEPFLAGS)
2016-10-26 20:34:10 -04:00
2017-12-31 08:07:14 -05:00
$(BUILD_DIR)/%.o: %.s %.depend
@$(if $(Q), echo AS $<,)
2017-12-31 08:07:14 -05:00
@mkdir -p $(dir $@)
$(Q)$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
2016-10-26 20:34:10 -04:00
%.a:
@$(if $(Q), echo AR $<,)
2017-12-31 08:07:14 -05:00
@mkdir -p $(dir $@)
$(Q)$(AR) -rc $@ $^
2016-10-26 20:34:10 -04:00
%.depend: ;
2017-12-31 08:07:14 -05:00
%.last: ;
$(ELF2RPL):
@$(if $(Q), echo MAKE $@,)
$(Q)$(MAKE) -C wiiu/wut/elf2rpl/
2017-12-31 08:07:14 -05:00
$(BUILD_DIR)/$(TARGET).elf: $(OBJ) $(HBL_ELF_OBJ) libretro_wiiu.a wiiu/link_elf.ld .$(TARGET).elf.last
@$(if $(Q), echo LD $@,)
2017-12-31 08:07:14 -05:00
@touch .$(TARGET).elf.last
$(Q)$(LD) $(OBJ) $(HBL_ELF_OBJ) $(LDFLAGS) $(HBL_ELF_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
2017-12-31 08:07:14 -05:00
$(BUILD_DIR)/$(TARGET).rpx.elf: $(OBJ) $(RPX_OBJ) libretro_wiiu.a wiiu/link_elf.ld
@$(if $(Q), echo LD $@,)
$(Q)$(LD) $(OBJ) $(RPX_OBJ) $(LDFLAGS) $(RPX_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
$(BUILD_DIR)/$(TARGET).large.rpx: $(BUILD_DIR)/$(TARGET).rpx.elf $(ELF2RPL) .$(TARGET).rpx.large.last
@$(if $(Q), echo ELF2RPL $@,)
@touch .$(TARGET).rpx.large.last
2017-12-31 08:07:14 -05:00
$(Q)-$(ELF2RPL) $< $@
2016-10-26 20:34:10 -04:00
$(BUILD_DIR)/$(TARGET).rpx: $(BUILD_DIR)/$(TARGET).large.rpx .$(TARGET).rpx.last
@$(if $(Q), echo COMPRESS $@,)
@touch .$(TARGET).rpx.large.last
$(Q)wiiurpxtool -c $< $@
2016-10-26 20:34:10 -04:00
clean:
@$(if $(Q), echo $@,)
$(Q)rm -f $(OBJ) $(RPX_OBJ) $(HBL_ELF_OBJ) $(TARGET).elf $(TARGET).rpx.elf $(TARGET).rpx
$(Q)rm -f $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).rpx.elf $(BUILD_DIR)/$(TARGET).large.rpx $(BUILD_DIR)/$(TARGET).rpx
$(Q)rm -f .$(TARGET).elf.last .$(TARGET).rpx.elf.last .$(TARGET).rpx.large.last .$(TARGET).rpx.last
$(Q)rm -f $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)
2021-07-30 20:25:54 -04:00
$(Q)$(MAKE) -C wiiu/wut/elf2rpl/ clean
2016-10-26 20:34:10 -04:00
.PHONY: clean all
2017-12-31 08:07:14 -05:00
.PRECIOUS: %.depend %.last
-include $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)