RetroArch/Makefile.wii
2013-07-07 19:43:22 +02:00

110 lines
2.7 KiB
Makefile

RARCH_VERSION = "0.9.9.3"
DEBUG = 0
HAVE_LOGGER = 0
HAVE_FILE_LOGGER = 0
PERF_TEST = 0
WHOLE_ARCHIVE_LINK = 0
BIG_STACK = 0
CUSTOM_LIBOGC = 0
PC_DEVELOPMENT_IP_ADDRESS = "192.168.1.6"
PC_DEVELOPMENT_UDP_PORT = 3490
# system platform
system_platform = unix
ifeq ($(shell uname -a),)
EXE_EXT = .exe
system_platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
system_platform = osx
else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
endif
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
LD = $(DEVKITPPC)/bin/powerpc-eabi-ld$(EXE_EXT)
ELF2DOL = $(DEVKITPPC)/bin/elf2dol$(EXE_EXT)
DOL_TARGET := retroarch_wii.dol
ELF_TARGET := retroarch_wii.elf
INCLUDE := -I. -I$(DEVKITPRO)/libogc/include -I$(DEVKITPRO)/libogc/include/ogc
LIBDIRS := -L$(DEVKITPRO)/libogc/lib/wii -L.
ifeq ($(CUSTOM_LIBOGC), 1)
CFLAGS += -DHAVE_MINIOGC
endif
MACHDEP := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE)
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
endif
LDFLAGS := $(MACHDEP) -Wl,-Map,$(notdir $(ELF_TARGET)).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,strdup,-wrap,strndup,-wrap,malloc_usable_size
ifeq ($(BIG_STACK), 1)
LDFLAGS += -T gx/ld/rvl.ld
endif
LIBS := -lfat $(WHOLE_START) -lretro_wii $(WHOLE_END) -logc -lwiiuse -lbte
APP_BOOTER_DIR = wii/app_booter
OBJ = griffin/griffin.o $(APP_BOOTER_DIR)/app_booter.binobj
ifeq ($(PERF_TEST), 1)
CFLAGS += -DPERF_TEST
endif
ifeq ($(HAVE_LOGGER), 1)
CFLAGS += -DHAVE_LOGGER
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
CFLAGS += -Iconsole/logger
endif
ifeq ($(HAVE_FILE_LOGGER), 1)
CFLAGS += -DHAVE_FILE_LOGGER
CFLAGS += -Iconsole/logger
endif
CFLAGS += -std=gnu99 -DSINC_LOWER_QUALITY -DHAVE_RGUI -DRARCH_CONSOLE -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RARCH_EXEC -DGEKKO -DHAVE_ZLIB -DWANT_MINIZ -DHAVE_RARCH_MAIN_WRAP -DHAVE_RARCH_MAIN_IMPLEMENTATION -DHAVE_GRIFFIN=1 -DHAVE_SCREENSHOTS -Wno-char-subscripts
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g -DDEBUG
else
CFLAGS += -O3
endif
all: $(DOL_TARGET)
%.dol: %.elf
$(ELF2DOL) $< $@
$(ELF_TARGET): $(OBJ)
$(CXX) -o $@ $(LDFLAGS) $(LIBDIRS) $(OBJ) $(LIBS)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
%.bmpobj: %.bmp
$(LD) -r -b binary -o $@ $<
%.binobj: %.bin
$(LD) -r -b binary -o $@ $<
$(APP_BOOTER_DIR)/app_booter.bin:
$(MAKE) -C $(APP_BOOTER_DIR)
pkg: all
cp -r $(DOL_TARGET) wii/pkg/CORE.dol
clean:
rm -f $(DOL_TARGET)
rm -f $(ELF_TARGET)
rm -f $(OBJ)
$(MAKE) -C $(APP_BOOTER_DIR) clean
.PHONY: clean