RetroArch/Makefile.wiiu

323 lines
8.7 KiB
Makefile
Raw Normal View History

2016-10-27 00:34:10 +00:00
TARGET := retroarch_wiiu
2017-12-31 13:07:14 +00:00
BUILD_HBL_ELF = 1
BUILD_RPX = 1
DEBUG = 0
GRIFFIN_BUILD = 0
SALAMANDER_BUILD = 0
WHOLE_ARCHIVE_LINK = 0
2018-02-06 07:21:00 +00:00
WIIU_HID = 1
2018-04-08 05:15:59 +00:00
HAVE_RUNAHEAD = 1
WIIU_LOG_RPX = 0
2017-12-31 13:07:14 +00:00
BUILD_DIR = objs/wiiu
PC_DEVELOPMENT_IP_ADDRESS ?=
PC_DEVELOPMENT_TCP_PORT ?=
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 13:07:14 +00:00
endif
ifeq ($(DEBUG),1)
BUILD_DIR := $(BUILD_DIR)-debug
endif
2016-10-27 00:34:10 +00:00
ifneq ($(V), 1)
Q := @
endif
OBJ :=
OBJ += wiiu/input/wpad_driver.o
OBJ += wiiu/input/kpad_driver.o
OBJ += wiiu/input/pad_functions.o
OBJ += wiiu/system/memory.o
OBJ += wiiu/system/atomic.o
OBJ += wiiu/system/exception_handler.o
OBJ += wiiu/fs/sd_fat_devoptab.o
OBJ += wiiu/fs/fs_utils.o
OBJ += wiiu/hbl.o
2016-10-27 00:34:10 +00:00
DEFINES :=
ifeq ($(WIIU_LOG_RPX),1)
defines += -DWIIU_LOG_RPX
endif
ifeq ($(WIIU_HID),1)
DEFINES += -DWIIU_HID
OBJ += wiiu/input/hidpad_driver.o
OBJ += wiiu/input/wiiu_hid.o
OBJ += input/connect/joypad_connection.o \
2018-02-06 07:21:00 +00:00
input/common/hid/hid_device_driver.o \
input/common/hid/device_wiiu_gca.o \
input/common/hid/device_ds3.o \
input/common/hid/device_ds4.o \
input/common/hid/device_null.o
endif
2017-12-31 13:07:14 +00: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 += frontend/drivers/platform_null.o
OBJ += libretro-common/encodings/encoding_utf.o
OBJ += libretro-common/compat/compat_strcasestr.o
OBJ += libretro-common/file/file_path.o
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/file/config_file.o
OBJ += libretro-common/streams/file_stream.o
OBJ += libretro-common/vfs/vfs_implementation.o
OBJ += libretro-common/hash/rhash.o
OBJ += file_path_str.o
OBJ += verbosity.o
2016-10-27 00:34:10 +00:00
else
2017-12-31 13:07:14 +00:00
DEFINES += -DRARCH_INTERNAL
DEFINES += -DHAVE_KEYMAPPER
DEFINES += -DHAVE_UPDATE_ASSETS
DEFINES += -DHAVE_FILTERS_BUILTIN
DEFINES += -DHAVE_SLANG
DEFINES += -DHAVE_SHADERPIPELINE
2017-12-31 13:07:14 +00:00
2018-04-08 05:15:59 +00:00
ifeq ($(HAVE_RUNAHEAD),1)
DEFINES += -DHAVE_RUNAHEAD
endif
2017-12-31 13:07:14 +00:00
OBJ += wiiu/system/missing_libc_functions.o
2018-01-04 16:38:04 +00: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
OBJ += gfx/drivers_shader/slang_preprocess.o
OBJ += gfx/drivers_shader/glslang_util.o
2017-12-31 13:07:14 +00:00
ifeq ($(GRIFFIN_BUILD), 1)
OBJ += griffin/griffin.o
DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI -DHAVE_LIBRETRODB
DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_CC_RESAMPLER
DEFINES += -DHAVE_STB_FONT -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DHAVE_LIBRETRODB -DHAVE_NETWORKING
# DEFINES += -DWANT_IFADDRS
# DEFINES += -DHAVE_FREETYPE
DEFINES += -DHAVE_XMB -DHAVE_MATERIALUI
else
HAVE_MENU_COMMON = 1
HAVE_RTGA = 1
HAVE_RPNG = 1
HAVE_RJPEG = 1
HAVE_RBMP = 1
HAVE_RGUI = 1
HAVE_ZLIB = 1
HAVE_7ZIP = 1
HAVE_BUILTINZLIB = 1
HAVE_LIBRETRODB = 1
HAVE_ZARCH = 0
HAVE_MATERIALUI = 1
HAVE_XMB = 1
HAVE_STB_FONT = 1
# HAVE_FREETYPE = 1
HAVE_LANGEXTRA = 1
HAVE_LIBRETRODB = 1
HAVE_NETWORKING = 1
HAVE_CHEEVOS = 1
# WANT_IFADDRS = 1
HAVE_OVERLAY = 1
HAVE_STATIC_VIDEO_FILTERS = 1
HAVE_STATIC_AUDIO_FILTERS = 1
WANT_LIBFAT = 1
WANT_IOSUHAX = 1
include Makefile.common
BLACKLIST := $(LIBRETRO_COMM_DIR)/net/net_ifinfo.o
OBJ := $(filter-out $(BLACKLIST),$(OBJ))
OBJ += gfx/drivers/gx2_gfx.o
2017-12-31 13:07:14 +00:00
OBJ += gfx/drivers_font/wiiu_font.o
OBJ += menu/drivers_display/menu_display_wiiu.o
OBJ += input/drivers/wiiu_input.o
OBJ += input/drivers_joypad/wiiu_joypad.o
OBJ += audio/drivers/wiiu_audio.o
OBJ += frontend/drivers/platform_wiiu.o
endif
endif
OBJ := $(addprefix $(BUILD_DIR)/,$(OBJ))
#todo: remove -DWIIU and use the built-in macros instead (HW_WUP or __wiiu__).
DEFINES += -DWIIU -DMSB_FIRST -D__WUT__
#DEFINES += -D_GNU_SOURCE
DEFINES += -DHAVE_MAIN
DEFINES += -DRARCH_CONSOLE
ifneq ($(PC_DEVELOPMENT_IP_ADDRESS),)
DEFINES += -DPC_DEVELOPMENT_IP_ADDRESS='"$(PC_DEVELOPMENT_IP_ADDRESS)"'
2016-10-27 00:34:10 +00:00
endif
2017-12-31 13:07:14 +00:00
ifneq ($(PC_DEVELOPMENT_TCP_PORT),)
DEFINES += -DPC_DEVELOPMENT_TCP_PORT=$(PC_DEVELOPMENT_TCP_PORT)
endif
2016-10-27 00:34:10 +00:00
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
2016-11-02 21:06:15 +00:00
export PATH := $(PATH):$(DEVKITPPC)/bin
2016-10-27 00:34:10 +00:00
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
2016-10-27 00:34:10 +00:00
2017-01-23 14:59:44 +00:00
ifneq ($(findstring Linux,$(shell uname -a)),)
else ifneq ($(findstring Darwin,$(shell uname -a)),)
else
ELF2RPL := $(ELF2RPL).exe
endif
2017-11-06 04:23:53 +00:00
INCDIRS := -I. -Ideps -Ideps/stb -Ideps/libz -Ideps/7zip -Ilibretro-common/include -Iwiiu -Iwiiu/include -I$(DEVKITPRO)/portlibs/ppc/include
2016-12-17 17:42:04 +00:00
LIBDIRS := -L. -L$(DEVKITPRO)/portlibs/ppc/lib
2016-10-27 00:34:10 +00:00
2017-01-23 14:59:44 +00:00
CFLAGS := -mwup -mcpu=750 -meabi -mhard-float
2016-10-27 00:34:10 +00:00
LDFLAGS :=
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
2016-10-27 00:34:10 +00:00
else
CFLAGS += -O3
2016-10-27 00:34:10 +00:00
endif
2017-12-31 13:07:14 +00:00
2016-10-27 18:53:27 +00:00
LDFLAGS := $(CFLAGS)
2016-10-27 00:34:10 +00:00
ASFLAGS := $(CFLAGS) -mregnames
2016-10-27 00:34:10 +00:00
CFLAGS += -ffast-math -Werror=implicit-function-declaration
#CFLAGS += -fomit-frame-pointer -mword-relocations
#CFLAGS += -Wall
2017-01-23 14:59:44 +00:00
2016-10-27 00:34:10 +00:00
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
endif
2017-12-31 13:07:14 +00:00
CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions
2016-10-27 00:34:10 +00:00
2016-11-16 17:25:23 +00:00
LDFLAGS += -Wl,--gc-sections
2016-10-27 00:34:10 +00:00
2017-12-19 21:12:58 +00:00
LIBS := $(WHOLE_START) -lretro_wiiu $(WHOLE_END) -lm
ifneq ($(WANT_LIBFAT), 1)
LIBS += -lfat
endif
ifneq ($(WANT_IOSUHAX), 1)
LIBS += -liosuhax
endif
2016-10-27 00:34:10 +00:00
2017-12-31 13:07:14 +00:00
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
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
TARGETS :=
ifeq ($(BUILD_RPX), 1)
TARGETS += $(TARGET).rpx
endif
2016-10-27 00:34:10 +00:00
ifeq ($(BUILD_HBL_ELF), 1)
TARGETS += $(TARGET).elf
endif
2017-12-31 13:07:14 +00:00
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.depend
all: $(TARGETS)
2017-12-31 13:07:14 +00:00
%: $(BUILD_DIR)/%
cp $< $@
$(BUILD_DIR)/%.o: %.cpp %.depend
@$(if $(Q), echo CXX $<,)
2017-12-31 13:07:14 +00:00
@mkdir -p $(dir $@)
$(Q)$(CXX) -c -o $@ $< $(CXXFLAGS) $(DEFINES) $(INCDIRS) $(DEPFLAGS)
2016-10-27 00:34:10 +00:00
2017-12-31 13:07:14 +00:00
$(BUILD_DIR)/%.o: %.c %.depend
@$(if $(Q), echo CC $<,)
2017-12-31 13:07:14 +00:00
@mkdir -p $(dir $@)
$(Q)$(CC) -c -o $@ $< $(CFLAGS) $(DEFINES) $(INCDIRS) $(DEPFLAGS)
2016-10-27 00:34:10 +00:00
2017-12-31 13:07:14 +00:00
$(BUILD_DIR)/%.o: %.S %.depend
@$(if $(Q), echo AS $<,)
2017-12-31 13:07:14 +00:00
@mkdir -p $(dir $@)
$(Q)$(CC) -c -o $@ $< $(ASFLAGS) $(DEFINES) $(INCDIRS) $(DEPFLAGS)
2016-10-27 00:34:10 +00:00
2017-12-31 13:07:14 +00:00
$(BUILD_DIR)/%.o: %.s %.depend
@$(if $(Q), echo AS $<,)
2017-12-31 13:07:14 +00:00
@mkdir -p $(dir $@)
$(Q)$(CC) -c -o $@ $< $(ASFLAGS) $(INCDIRS) $(DEPFLAGS)
2016-10-27 00:34:10 +00:00
%.a:
@$(if $(Q), echo AR $<,)
2017-12-31 13:07:14 +00:00
@mkdir -p $(dir $@)
$(Q)$(AR) -rc $@ $^
2016-10-27 00:34:10 +00:00
%.depend: ;
2017-12-31 13:07:14 +00:00
%.last: ;
$(ELF2RPL):
@$(if $(Q), echo MAKE $@,)
$(Q)$(MAKE) -C wiiu/wut/elf2rpl/
2017-12-31 13:07:14 +00: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 13:07:14 +00:00
@touch .$(TARGET).elf.last
$(Q)$(LD) $(OBJ) $(HBL_ELF_OBJ) $(LDFLAGS) $(HBL_ELF_LDFLAGS) $(LIBDIRS) $(LIBS) -o $@
2017-12-31 13:07:14 +00: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 $@
2017-12-31 13:07:14 +00:00
$(BUILD_DIR)/$(TARGET).rpx: $(BUILD_DIR)/$(TARGET).rpx.elf $(ELF2RPL) .$(TARGET).rpx.last
@$(if $(Q), echo ELF2RPL $@,)
2017-12-31 13:07:14 +00:00
@touch .$(TARGET).rpx.last
$(Q)-$(ELF2RPL) $< $@
2016-10-27 00:34:10 +00:00
clean:
rm -f $(OBJ) $(RPX_OBJ) $(HBL_ELF_OBJ) $(TARGET).elf $(TARGET).rpx.elf $(TARGET).rpx
2017-12-31 13:07:14 +00:00
rm -f $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).rpx.elf $(BUILD_DIR)/$(TARGET).rpx
rm -f .$(TARGET).elf.last .$(TARGET).rpx.elf.last .$(TARGET).rpx.last
rm -f $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)
2016-10-27 00:34:10 +00:00
.PHONY: clean all
2017-12-31 13:07:14 +00:00
.PRECIOUS: %.depend %.last
-include $(OBJ:.o=.depend) $(RPX_OBJ:.o=.depend) $(HBL_ELF_OBJ:.o=.depend)