RetroArch/Makefile.ps3
2012-02-25 14:38:28 +01:00

97 lines
2.9 KiB
Makefile

# Makefile for SSNES PS3. Somewhat generic and avoids using the odd SDK examples.
DEBUG = 0
CELL_BUILD_TOOLS = GCC
DOWNLOAD_SHADERS = 1
STRIPPING_ENABLE = 0
HAVE_SSNES_GL = 0
ifeq ($(shell uname), Linux)
platform := linux
CELL_HOST_PATH = $(CELL_SDK)/host-linux
else
platform := win
CELL_HOST_PATH = $(CELL_SDK)/host-win32
endif
ifeq ($(platform),win)
HOST_DIR := host-win32
CELL_SDK := /c/usr/local/cell/
else
HOST_DIR := host-linux
CELL_SDK := /usr/local/cell
endif
ifeq ($(CELL_BUILD_TOOLS),SNC)
CC = $(CELL_SDK)/$(HOST_DIR)/sn/bin/ps3ppusnc
CXX = $(CC)
LD = $(CELL_SDK)/$(HOST_DIR)/sn/bin/ps3ppuld
else
CC = $(CELL_SDK)/$(HOST_DIR)/ppu/bin/ppu-lv2-gcc
CXX = $(CELL_SDK)/$(HOST_DIR)/ppu/bin/ppu-lv2-g++
LD = $(CELL_SDK)/$(HOST_DIR)/ppu/bin/ppu-lv2-g++
endif
STRIP = $(CELL_SDK)/$(HOST_DIR)/ppu/bin/ppu-lv2-strip
PPU_TARGET := ssnes.elf
LDDIRS = -L. -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/ultra-opt
INCDIRS = -I. -Icommon
MAKE_FSELF_NPDRM = $(CELL_HOST_PATH)/bin/make_fself_npdrm
MAKE_PACKAGE_NPDRM = $(CELL_HOST_PATH)/bin/make_package_npdrm
OBJ = fifo_buffer.o ps3/cellframework2/fileio/file_browser.o ps3/ps3_audio.o ps3/menu.o console/main_wrap.o console/rom_ext.o ps3/ps3_input.o ps3/cellframework2/input/pad_input.o getopt.o ssnes.o driver.o file.o settings.o message.o rewind.o movie.o netplay.o netplay_compat.o gfx/gfx_common.o ps3/ps3_video_psgl.o gfx/shader_cg.o gfx/snes_state.o ups.o bps.o strl.o audio/hermite.o dynamic.o ps3/main.o audio/utils.o conf/config_file.o ps3/image.o
ifeq ($(HAVE_SSNES_GL), 1)
DEFINES = -DHAVE_SSNES_GL
GL_LIBS := -lSSNESGL -lSSNESGLcgc
else
GL_LIBS := -lPSGL -lPSGLcgc
endif
LIBS = -ldbgfont $(GL_LIBS) -lcgc -lgcm_cmd -lgcm_sys_stub -lsnes -lresc_stub -lm -lio_stub -lfs_stub -lsysutil_stub -lsysutil_game_stub -lsysutil_screenshot_stub -lpngdec_stub -ljpgdec_stub -lsysmodule_stub -laudio_stub -lnet_stub -lpthread
DEFINES += -DSSNES_CONSOLE -DHAVE_OPENGL=1 -DHAVE_CG=1 -DHAVE_FBO=1 -D__CELLOS_LV2__ -DHAVE_CONFIGFILE=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DPACKAGE_VERSION=\"0.9.4.1\" -DHAVE_SCREENSHOTS_BUILTIN=1 -Dmain=ssnes_main
ifeq ($(DEBUG), 1)
PPU_OPTIMIZE_LV := -O0 -g
else
PPU_OPTIMIZE_LV := -O3 -g
endif
## Use this for new SDK!
CFLAGS = $(PPU_OPTIMIZE_LV) $(DEFINES)
CXXFLAGS = $(PPU_OPTIMIZE_LV) $(DEFINES)
all: pkg
$(PPU_TARGET): $(OBJ)
$(LD) -o $@ $(OBJ) $(LDFLAGS) $(LDDIRS) $(LIBS)
ifeq ($(STRIPPING_ENABLE),1)
$(STRIP) $(PPU_TARGET)
endif
%.o: %.c config.h
$(CC) $(INCDIRS) $(CFLAGS) -c -o $@ $<
%.o: %.cpp config.h
$(CXX) $(INCDIRS) $(CXXFLAGS) -c -o $@ $<
pkg: $(PPU_TARGET)
ifeq ($(DOWNLOAD_SHADERS),1)
rm -rf ps3/pkg/USRDIR/shaders
git clone git://github.com/twinaphex/common-shaders.git ps3/pkg/USRDIR/shaders
endif
$(MAKE_FSELF_NPDRM) $(PPU_TARGET) ps3/pkg/USRDIR/EBOOT.BIN
$(MAKE_PACKAGE_NPDRM) ps3/pkg/package.conf ps3/pkg
clean:
rm -f $(PPU_TARGET)
rm -f $(OBJ)
rm -f *.pkg
.PHONY: all clean pkg