aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/ps2/Makefile.ps2
blob: 3631c653f64cf29567ae2d45ba78f260df6c4578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# SCUMMVM-PS2 MakeFile


# Use only this section to modify how the makefile behaves ------------

# Scummvm engine config: choose which engines are enabled
ENABLE_AGI = $(ENABLED)
ENABLE_AGOS = $(ENABLED)
ENABLE_AGOS2 = 1 
# ENABLE_AVALANCHE = $(ENABLED)
ENABLE_CGE = $(ENABLED)
ENABLE_CINE = $(ENABLED)
ENABLE_COMPOSER = $(ENABLED)
ENABLE_CRUISE = $(ENABLED)
ENABLE_DRACI = $(ENABLED)
ENABLE_DRASCULA = $(ENABLED)
ENABLE_DREAMWEB = $(ENABLED)
# ENABLE_FULLPIPE = $(ENABLED)
ENABLE_GOB = $(ENABLED)
ENABLE_GROOVIE = $(ENABLED)
# ENABLE_GROOVIE2 = $(ENABLED)
# ENABLE_HOPKINS = $(ENABLED)
ENABLE_HUGO = $(ENABLED)
ENABLE_KYRA = $(ENABLED)
ENABLE_LOL = 1
ENABLE_EOB = 1
# ENABLE_LASTEXPRESS = $(ENABLED)
ENABLE_LURE = $(ENABLED)
ENABLE_MADE = $(ENABLED)
ENABLE_MOHAWK = $(ENABLED)
# ENABLE_CSTIME = $(ENABLED)
# ENABLE_RIVEN = $(ENABLED)
# ENABLE_MYST = $(ENABLED)
ENABLE_MORTEVIELLE = $(ENABLED)
ENABLE_NEVERHOOD = $(ENABLED)
ENABLE_PARALLACTION = $(ENABLED)
# ENABLE_PEGASUS = $(ENABLED)
ENABLE_QUEEN = $(ENABLED)
ENABLE_SAGA = $(ENABLED)
ENABLE_IHNM = 1
# ENABLE_SAGA2 = $(ENABLED)
ENABLE_SCI = $(ENABLED)
# ENABLE_SCI32 = $(ENABLED)
ENABLE_SCUMM = $(ENABLED)
ENABLE_SCUMM_7_8 = 1
ENABLE_HE = 1
ENABLE_SKY = $(ENABLED)
ENABLE_SWORD1 = $(ENABLED)
ENABLE_SWORD2 = $(ENABLED)
# ENABLE_SWORD25 = $(ENABLED)
ENABLE_TEENAGENT = $(ENABLED)
# ENABLE_TESTBED = $(ENABLED)
ENABLE_TINSEL = $(ENABLED)
ENABLE_TOLTECS = $(ENABLED)
# ENABLE_TONY = $(ENABLED)
ENABLE_TOON = $(ENABLED)
ENABLE_TOUCHE = $(ENABLED)
ENABLE_TSAGE = $(ENABLED)
ENABLE_TUCKER = $(ENABLED)
# ENABLE_WINTERMUTE = $(ENABLED)
# ENABLE_ZVISION = $(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

# ---------------------------------------------------------------------


# General variables
srcdir = ../../..
VPATH = $(srcdir)
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__ -D__NEW_PS2SDK__ -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
# DEFINES += -DLOGORRHEIC

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)
DEFINES += -D__PS2_DEBUG__
FLAGS += -G2 -g
LIBS += -lps2gdbStub -lps2ip -ldebug
else
DEFINES += -DRELEASE_BUILD
FLAGS += -G2 -O2 -s -Wuninitialized
# LDFLAGS += -s
endif

# Test for profiling
ifeq ($(ENABLE_PROFILING),1)
DEFINES += -DENABLE_PROFILING
FLAGS += -G2 -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

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
endif

all: $(TARGET)

$(TARGET): $(OBJS)
	$(LD) $(PRE_OBJS_FLAGS) $(OBJS) $(POST_OBJS_FLAGS) $(LDFLAGS) $(LIBS) -o $@