aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Lingua2014-01-11 21:13:04 -0500
committerMax Lingua2014-01-18 13:48:20 -0500
commitfb69d8eddcb2a29bace9a2fa7723068e2eb1b6fe (patch)
tree151bc4720804afdf716d12202824c78bbe207b19
parenta960ec7adf0547e4a872f29cb645b5f02dc7558c (diff)
downloadscummvm-rg350-fb69d8eddcb2a29bace9a2fa7723068e2eb1b6fe.tar.gz
scummvm-rg350-fb69d8eddcb2a29bace9a2fa7723068e2eb1b6fe.tar.bz2
scummvm-rg350-fb69d8eddcb2a29bace9a2fa7723068e2eb1b6fe.zip
PS2: enhanced Makefile.ps2 (incl. modules & debug)
-rw-r--r--backends/platform/ps2/Makefile.gdb104
-rw-r--r--backends/platform/ps2/Makefile.ps2204
-rw-r--r--backends/platform/ps2/module.mk20
3 files changed, 155 insertions, 173 deletions
diff --git a/backends/platform/ps2/Makefile.gdb b/backends/platform/ps2/Makefile.gdb
deleted file mode 100644
index 8ca47cd9f1..0000000000
--- a/backends/platform/ps2/Makefile.gdb
+++ /dev/null
@@ -1,104 +0,0 @@
-# $Header: Exp $
- include $(PS2SDK)/Defs.make
-
-PS2_EXTRA = /works/devel/ps2/sdk-extra
-PS2_EXTRA_INCS = /zlib/include /libmad/ee/include /SjPcm/ee/src /tremor
-PS2_EXTRA_LIBS = /zlib/lib /libmad/ee/lib /SjPcm/ee/lib /tremor/tremor
-
-ENABLED=STATIC_PLUGIN
-
-ENABLE_SCUMM = $(ENABLED)
-ENABLE_SCUMM_7_8 = $(ENABLED)
-# ENABLE_HE = $(ENABLED)
-# ENABLE_AGI = $(ENABLED)
-# ENABLE_AGOS = $(ENABLED)
-# ENABLE_AGOS2 = $(ENABLED)
-# ENABLE_CINE = $(ENABLED)
-# ENABLE_CRUISE = $(ENABLED)
-# ENABLE_DRACI = $(ENABLED)
-# ENABLE_DRASCULA = $(ENABLED)
-# ENABLE_GOB = $(ENABLED)
-# ENABLE_GROOVIE = $(ENABLED)
-## ENABLE_GROOVIE2 = $(ENABLED)
-# ENABLE_HUGO = $(ENABLED)
-# ENABLE_IHNM = $(ENABLED)
-# ENABLE_KYRA = $(ENABLED)
-## ENABLE_LOL = $(ENABLED)
-# ENABLE_LURE = $(ENABLED)
-## ENABLE_M4 = $(ENABLED)
-# ENABLE_MADE = $(ENABLED)
-# ENABLE_MOHAWK = $(ENABLED)
-# ENABLE_PARALLACTION = $(ENABLED)
-# ENABLE_QUEEN = $(ENABLED)
-# ENABLE_SAGA = $(ENABLED)
-# ENABLE_SAGA2 = $(ENABLED)
-# ENABLE_SCI = $(ENABLED)
-## ENABLE_SCI32 = $(ENABLED)
-# ENABLE_SKY = $(ENABLED)
-# ENABLE_SWORD1 = $(ENABLED)
-# ENABLE_SWORD2 = $(ENABLED)
-# ENABLE_TEENAGENT = $(ENABLED)
-# ENABLE_TINSEL = $(ENABLED)
-# ENABLE_TOON = $(ENABLED)
-# ENABLE_TOUCHE = $(ENABLED)
-# ENABLE_TUCKER = $(ENABLED)
-
-
-HAVE_GCC3 = true
-
-CC = ee-gcc
-CXX = ee-g++
-AS = ee-gcc
-LD = ee-gcc
-AR = ee-ar cru
-RANLIB = ee-ranlib
-STRIP = ee-strip
-MKDIR = mkdir -p
-RM = rm -f
-
-srcdir = ../../..
-VPATH = $(srcdir)
-INCDIR = ../../../
-# DEPDIR = .deps
-
-DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -DDISABLE_SAVEGAME_SORTING -D_EE -D__PLAYSTATION2__ -D__PS2_DEBUG__ -g -Wall -Wno-multichar -fno-rtti -fno-exceptions # -DNO_ADAPTOR
-# for release builds:
-#DEFINES += -DRELEASE_BUILD
-
-INCLUDES = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS))
-INCLUDES += -I $(PS2GDB)/ee -I $(PS2SDK)/ee/include -I $(PS2SDK)/common/include -I ./common -I . -I $(srcdir) -I $(srcdir)/engines
-
-CXX_UPDATE_DEP_FLAG = -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP
-
-TARGET = elf/scummvm.elf
-
-OBJS := $(srcdir)/backends/platform/ps2/DmaPipe.o \
- $(srcdir)/backends/platform/ps2/Gs2dScreen.o \
- $(srcdir)/backends/platform/ps2/irxboot.o \
- $(srcdir)/backends/platform/ps2/ps2input.o \
- $(srcdir)/backends/platform/ps2/ps2pad.o \
- $(srcdir)/backends/platform/ps2/savefilemgr.o \
- $(srcdir)/backends/platform/ps2/fileio.o \
- $(srcdir)/backends/platform/ps2/asyncfio.o \
- $(srcdir)/backends/platform/ps2/icon.o \
- $(srcdir)/backends/platform/ps2/cd.o \
- $(srcdir)/backends/platform/ps2/eecodyvdfs.o \
- $(srcdir)/backends/platform/ps2/rpckbd.o \
- $(srcdir)/backends/platform/ps2/systemps2.o \
- $(srcdir)/backends/platform/ps2/ps2mutex.o \
- $(srcdir)/backends/platform/ps2/ps2time.o \
- $(srcdir)/backends/platform/ps2/ps2debug.o
-
-MODULE_DIRS += .
-
-include $(srcdir)/Makefile.common
-
-LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile
-LDFLAGS += -L $(PS2GDB)/lib -L $(PS2SDK)/ee/lib -L .
-LDFLAGS += $(addprefix -L$(PS2_EXTRA),$(PS2_EXTRA_LIBS))
-LDFLAGS += -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lmad -ltremor -lz -lm -lc -lfileXio -lps2gdbStub -lps2ip -ldebug -lkernel -lstdc++
-
-all: $(TARGET)
-
-$(TARGET): $(OBJS)
- $(LD) $^ $(LDFLAGS) -o $@
diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2
index d6ce08ae84..f1a99b39a6 100644
--- a/backends/platform/ps2/Makefile.ps2
+++ b/backends/platform/ps2/Makefile.ps2
@@ -1,12 +1,9 @@
-# $Header: Exp $
- include $(PS2SDK)/Defs.make
+# SCUMMVM-PS2 MakeFile
-PS2_EXTRA = /works/devel/ps2/sdk-extra
-PS2_EXTRA_INCS = /zlib/include /libmad/ee/include /SjPcm/ee/src /tremor
-PS2_EXTRA_LIBS = /zlib/lib /libmad/ee/lib /SjPcm/ee/lib /tremor/tremor
-ENABLED=STATIC_PLUGIN
+# Use only this section to modify how the makefile behaves ------------
+# Scummvm engine config: choose which engines are enabled
ENABLE_SCUMM = $(ENABLED)
ENABLE_SCUMM_7_8 = $(ENABLED)
ENABLE_HE = $(ENABLED)
@@ -19,89 +16,178 @@ ENABLE_DRACI = $(ENABLED)
ENABLE_DRASCULA = $(ENABLED)
ENABLE_GOB = $(ENABLED)
ENABLE_GROOVIE = $(ENABLED)
-# ENABLE_GROOVIE2 = $(ENABLED)
-ENABLE_HUGO = $(ENABLED)
+ENABLE_GROOVIE2 = $(ENABLED)
ENABLE_IHNM = $(ENABLED)
ENABLE_KYRA = $(ENABLED)
-# ENABLE_LOL = $(ENABLED)
+ENABLE_LOL = $(ENABLED)
ENABLE_LURE = $(ENABLED)
-# ENABLE_M4 = $(ENABLED)
+ENABLE_M4 = $(ENABLED)
ENABLE_MADE = $(ENABLED)
-ENABLE_MOHAWK = $(ENABLED)
ENABLE_PARALLACTION = $(ENABLED)
ENABLE_QUEEN = $(ENABLED)
ENABLE_SAGA = $(ENABLED)
-# ENABLE_SAGA2 = $(ENABLED)
+ENABLE_SAGA2 = $(ENABLED)
ENABLE_SCI = $(ENABLED)
-# ENABLE_SCI32 = $(ENABLED)
+ENABLE_SCI32 = $(ENABLED)
ENABLE_SKY = $(ENABLED)
ENABLE_SWORD1 = $(ENABLED)
ENABLE_SWORD2 = $(ENABLED)
ENABLE_TEENAGENT = $(ENABLED)
ENABLE_TINSEL = $(ENABLED)
-ENABLE_TOON = $(ENABLED)
ENABLE_TOUCHE = $(ENABLED)
ENABLE_TUCKER = $(ENABLED)
+# Set to 1 to enable seeing the commands to gcc
+VERBOSE_BUILD=0
+# Set to 1 to enable, 0 to disable dynamic modules
+DYNAMIC_MODULES = 1
+# Set to 1 to enable debugging
+ENABLE_DEBUG = 0
+# Set to 1 to enable profiling
+ENABLE_PROFILING = 0
+# Set to 1 to disable HDD+NET
+DISABLE_NETWORK = 0
+# Set to 1 to enable, 0 to disable libmad and libogg
+USE_LIBMAD = 1
+USE_LIBOGG = 1
-HAVE_GCC3 = true
+# ---------------------------------------------------------------------
-CC = ee-gcc
-CXX = ee-g++
-AS = ee-gcc
-LD = ee-gcc
-AR = ee-ar cru
-RANLIB = ee-ranlib
-STRIP = ee-strip
-MKDIR = mkdir -p
-RM = rm -f
+# General variables
srcdir = ../../..
VPATH = $(srcdir)
-INCDIR = ../../../
-# DEPDIR = .deps
-
-DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -DDISABLE_SAVEGAME_SORTING -D_EE -D__PLAYSTATION2__ -G2 -O2 -Wall -Wno-multichar -fno-rtti -fno-exceptions # -DNO_ADAPTOR
-# for release builds:
-#DEFINES += -DRELEASE_BUILD
-
-INCLUDES = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS))
-INCLUDES += -I $(PS2SDK)/ee/include -I $(PS2SDK)/common/include -I ./common -I . -I $(srcdir) -I $(srcdir)/engines
-
-CXX_UPDATE_DEP_FLAG = -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP
-
-TARGET = elf/scummvm.elf
+TARGET = scummvm.elf
+# PS2 SDK location variables
+# PS2SDK = /works/tools/devel/ps2/sdk
+
+# Check PS2SDK presence
+ifeq ($(PS2SDK),)
+$(error $$(PS2SDK) needs to be set.)
+endif
+
+# Variables for common Scummvm makefile
+CC = ee-gcc
+CXX = ee-g++
+FLAGS = -pedantic -Wall -W
+FLAGS += -Wcast-qual -Wconversion -Wpointer-arith -Wshadow -Wwrite-strings
+FLAGS += -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-unused-parameter
+CFLAGS = $(FLAGS) -std=c99
+CXXFLAGS = $(FLAGS) -Wnon-virtual-dtor -Wno-reorder -fno-exceptions -fno-rtti
+
+DEFINES = -D_EE -D__PLAYSTATION2__ -DUSE_ZLIB -DFORCE_RTL -DDATA_PATH=\"host:data\"
+DEFINES += -DDISABLE_SAVEGAME_SORTING -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DDISABLE_DOSBOX_OPL -DDISABLE_SID -DDISABLE_NES_APU
+
+INCDIR := $(PS2SDK)/ee/include $(PS2SDK)/common/include $(PS2SDK)/ports/include . $(srcdir) $(srcdir)/engines
+INCLUDES := $(addprefix -I, $(INCDIR))
+DEPDIR = .deps
+MODULE_DIRS += ./
+MKDIR = mkdir -p
+RM = rm -f
+RM_REC = rm -rf
+AR = ee-ar cru
+RANLIB = ee-ranlib
+STRIP = ee-strip
+AS = ee-gcc
+LD = ee-gcc
+HAVE_GCC3 = true
+CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP
+
+# Variables for dynamic plugin building
+PLUGIN_PREFIX =
+PLUGIN_SUFFIX = .plg
+PLUGIN_EXTRA_DEPS = $(TARGET)
+PLUGIN_LDFLAGS = -nostartfiles $(srcdir)/backends/plugins/elf/version.o -Wl,-q,--just-symbols,$(TARGET),--retain-symbols-file,$(srcdir)/backends/plugins/elf/plugin.syms
+PLUGIN_LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -Wl,-T$(srcdir)/backends/plugins/ps2/plugin.ld -lstdc++ -lc
+
+# Test for adding different libs
+ifeq ($(USE_LIBMAD),1)
+DEFINES += -DUSE_MAD
+LIBS += -lmad
+endif
+ifeq ($(USE_LIBOGG), 1)
+DEFINES += -DUSE_VORBIS -DUSE_TREMOR
+LIBS += -ltremor
+endif
+
+# Test for dynamic plugins
+ifeq ($(DYNAMIC_MODULES),1)
+ENABLED = DYNAMIC_PLUGIN
+DEFINES += -DDYNAMIC_MODULES -DUSE_ELF_LOADER -DMIPS_TARGET -DUNCACHED_PLUGINS -DPLUGIN_DIRECTORY=\"host:plugins\"
+PRE_OBJS_FLAGS = -Wl,--whole-archive
+POST_OBJS_FLAGS = -Wl,--no-whole-archive
+else
+ENABLED = STATIC_PLUGIN
+endif
+
+# Test for debug
+ifeq ($(ENABLE_DEBUG),1)
+FLAGS += -G2 -g
+DEFINES += -D__PS2_DEBUG__
+LIBS += -lps2gdbStub -lps2ip -ldebug
+else
+FLAGS += -G2 -O2 -s -Wuninitialized
+DEFINES += -DRELEASE_BUILD
+# LDFLAGS += -s
+endif
+
+# Test for profiling
+ifeq ($(ENABLE_PROFILING),1)
+DEFINES += -DENABLE_PROFILING
+CXXFLAGS += -pg -g
+LDFLAGS += -pg
+endif
+
+# Test for net support
+ifeq ($(DISABLE_NETWORK),1)
+DEFINES += -DNO_ADAPTOR
+endif
+
+# PS2 LIBS
+PS2LIBS = -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lz -lm -lc -lfileXio -lkernel -lstdc++
+
+# Add in PS2SDK includes and libraries.
+LIBS += $(PS2LIBS)
OBJS := $(srcdir)/backends/platform/ps2/DmaPipe.o \
- $(srcdir)/backends/platform/ps2/Gs2dScreen.o \
- $(srcdir)/backends/platform/ps2/irxboot.o \
- $(srcdir)/backends/platform/ps2/ps2input.o \
- $(srcdir)/backends/platform/ps2/ps2pad.o \
- $(srcdir)/backends/platform/ps2/savefilemgr.o \
- $(srcdir)/backends/platform/ps2/fileio.o \
- $(srcdir)/backends/platform/ps2/asyncfio.o \
- $(srcdir)/backends/platform/ps2/icon.o \
- $(srcdir)/backends/platform/ps2/cd.o \
- $(srcdir)/backends/platform/ps2/eecodyvdfs.o \
- $(srcdir)/backends/platform/ps2/rpckbd.o \
- $(srcdir)/backends/platform/ps2/systemps2.o \
- $(srcdir)/backends/platform/ps2/ps2mutex.o \
- $(srcdir)/backends/platform/ps2/ps2time.o \
- $(srcdir)/backends/platform/ps2/ps2debug.o
-
-MODULE_DIRS += .
+ $(srcdir)/backends/platform/ps2/Gs2dScreen.o \
+ $(srcdir)/backends/platform/ps2/irxboot.o \
+ $(srcdir)/backends/platform/ps2/ps2input.o \
+ $(srcdir)/backends/platform/ps2/ps2pad.o \
+ $(srcdir)/backends/platform/ps2/savefilemgr.o \
+ $(srcdir)/backends/platform/ps2/fileio.o \
+ $(srcdir)/backends/platform/ps2/asyncfio.o \
+ $(srcdir)/backends/platform/ps2/icon.o \
+ $(srcdir)/backends/platform/ps2/cd.o \
+ $(srcdir)/backends/platform/ps2/eecodyvdfs.o \
+ $(srcdir)/backends/platform/ps2/rpckbd.o \
+ $(srcdir)/backends/platform/ps2/systemps2.o \
+ $(srcdir)/backends/platform/ps2/ps2mutex.o \
+ $(srcdir)/backends/platform/ps2/ps2time.o \
+ $(srcdir)/backends/platform/ps2/ps2debug.o
+
+ifeq ($(DYNAMIC_MODULES),1)
+OBJS += $(srcdir)/backends/plugins/elf/elf-loader.o \
+ $(srcdir)/backends/plugins/elf/elf-provider.o \
+ $(srcdir)/backends/plugins/elf/shorts-segment-manager.o \
+ $(srcdir)/backends/plugins/elf/memory-manager.o \
+ $(srcdir)/backends/plugins/elf/mips-loader.o \
+ $(srcdir)/backends/plugins/elf/version.o
+endif
BACKEND := ps2
+# Include common Scummvm makefile
include $(srcdir)/Makefile.common
+LDFLAGS += -L$(PS2SDK)/ee/lib -L$(PS2SDK)/ports/lib
+ifeq ($(DYNAMIC_MODULES),1)
+LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -Wl,-T$(srcdir)/backends/plugins/ps2/main_prog.ld
+else
LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile
-LDFLAGS += -L $(PS2SDK)/ee/lib -L .
-LDFLAGS += $(addprefix -L$(PS2_EXTRA),$(PS2_EXTRA_LIBS))
-LDFLAGS += -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lmad -ltremor -lz -lm -lc -lfileXio -lkernel -lstdc++
-LDFLAGS += -s
+endif
all: $(TARGET)
$(TARGET): $(OBJS)
- $(LD) $^ $(LDFLAGS) -o $@
+ $(LD) $(PRE_OBJS_FLAGS) $(OBJS) $(POST_OBJS_FLAGS) $(LDFLAGS) $(LIBS) -o $@
diff --git a/backends/platform/ps2/module.mk b/backends/platform/ps2/module.mk
index bf95a5501d..7bcc60e58d 100644
--- a/backends/platform/ps2/module.mk
+++ b/backends/platform/ps2/module.mk
@@ -2,20 +2,20 @@ MODULE := backends/platform/ps2
MODULE_OBJS := \
DmaPipe.o \
- Gs2dScreen.o \
- irxboot.o \
+ Gs2dScreen.o \
+ irxboot.o \
ps2input.o \
ps2pad.o \
savefilemgr.o \
- fileio.o \
- asyncfio.o \
+ fileio.o \
+ asyncfio.o \
icon.o \
- cd.o \
- eecodyvdfs.o \
- rpckbd.o \
- systemps2.o \
- ps2mutex.o \
- ps2time.o \
+ cd.o \
+ eecodyvdfs.o \
+ rpckbd.o \
+ systemps2.o \
+ ps2mutex.o \
+ ps2time.o \
ps2debug.o
# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.