aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/wii/Makefile
blob: c8325a0cc8da5d44181e612e5b20e2b263a19833 (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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# This toggle redirects stdout/err over a USB Gecko adapter in memcard slot b.
# It is safe to keep this enabled, even if no such adapter is present.
DEBUG_WII_USBGECKO = 1

# This toggle enables simple memory statistics. The amount of physical
# available memory will be printed to stderr when it shrinks.
# The buckets of the allocator are not taken into account.
DEBUG_WII_MEMSTATS = 0

# This toggle sets up the GDB stub. Upon a crash or a reset button press
# attach a remote GDB via `make debug` (requires a USB Gecko adapter).
DEBUG_WII_GDB = 0

# Builds a Gamecube version. Cleanup object files before flipping this!
GAMECUBE = 0

# Enable DVD ISO9660/Joliet support using libdi (included in libogc, but the
# ISO9660 support has not been commited to the official svn yet, requires the
# git repository for now).
# This requires a working DVDX install to function, not available on Gamecube.
ifeq ($(GAMECUBE),1)
USE_WII_DI = 0
else
USE_WII_DI = 1
endif

# Enable USB keyboard support through libwiikeyboard (included in libogc, but
# it has not been commited to the official svn yet, requires the git repository
# for now). Not available on Gamecube.
ifeq ($(GAMECUBE),1)
USE_WII_KBD = 0
else
USE_WII_KBD = 1
endif

# List of game engines to compile in. Comment a to disable the engine.
ENABLE_SCUMM = STATIC_PLUGIN
ENABLE_SCUMM_7_8 = STATIC_PLUGIN
ENABLE_HE = STATIC_PLUGIN
ENABLE_AGI = STATIC_PLUGIN
ENABLE_AGOS = STATIC_PLUGIN
ENABLE_CINE = STATIC_PLUGIN
ENABLE_CRUISE = STATIC_PLUGIN
ENABLE_DRASCULA = STATIC_PLUGIN
ENABLE_GOB = STATIC_PLUGIN
ENABLE_GROOVIE = STATIC_PLUGIN
ENABLE_IGOR = STATIC_PLUGIN
ENABLE_KYRA = STATIC_PLUGIN
ENABLE_LURE = STATIC_PLUGIN
ENABLE_M4 = STATIC_PLUGIN
ENABLE_MADE = STATIC_PLUGIN
ENABLE_PARALLACTION = STATIC_PLUGIN
ENABLE_QUEEN = STATIC_PLUGIN
ENABLE_SAGA = STATIC_PLUGIN
ENABLE_IHNM = STATIC_PLUGIN
ENABLE_SAGA2 = STATIC_PLUGIN
ENABLE_SKY = STATIC_PLUGIN
ENABLE_SWORD1 = STATIC_PLUGIN
ENABLE_SWORD2 = STATIC_PLUGIN
ENABLE_TINSEL = STATIC_PLUGIN
ENABLE_TOUCHE = STATIC_PLUGIN
ENABLE_TUCKER = STATIC_PLUGIN

# Scalers are currently not supported by this port.
DISABLE_HQ_SCALERS = 1
DISABLE_SCALERS = 1

# MT32 emulation, included in ScummVM. The Gamecube does not have enough
# memory to use it.
ifeq ($(GAMECUBE),1)
USE_MT32EMU = 0
else
USE_MT32EMU = 1
endif

# Additional features to compile in. zLib and MAD are inluded in libogc, the
# others require installed headers and crosscompiled static libraries.
USE_ZLIB = 1
USE_MAD = 1
USE_TREMOR = 1
USE_FLAC = 1
#USE_MPEG2 = 1

#
# Don't change anything below this line unless you know what you are doing.
#

srcdir = ../../..
VPATH = $(srcdir)
HAVE_GCC3 = 1

DISTPATH = $(srcdir)/dists/wii

ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif

PREFIX  = $(DEVKITPPC)/bin/powerpc-gekko-
CXX     = $(PREFIX)g++
AS      = $(PREFIX)gcc
LD      = $(PREFIX)gcc
AR      = $(PREFIX)ar cru
RANLIB  = $(PREFIX)ranlib
STRIP   = $(PREFIX)strip -g
GDB     = $(PREFIX)gdb
MKDIR   = mkdir -p
RM      = rm -f
RM_REC  = rm -rf
CP      = cp -f

ifeq ($(GAMECUBE),1)
TARGET  = scummvm-gc
MACHDEP  = -DGEKKO -DGAMECUBE -mogc -mcpu=750 -meabi -mhard-float \
			-ffunction-sections -fdata-sections -fmodulo-sched
LIBDIR   = $(DEVKITPRO)/libogc/lib/cube
LIBS      = -lstdc++ -lfat -logc -lm
else
TARGET  = scummvm-wii
MACHDEP  = -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float \
			-ffunction-sections -fdata-sections -fmodulo-sched
LIBDIR   = $(DEVKITPRO)/libogc/lib/wii
LIBS      = -lstdc++ -ldi -lfat -lwiiuse -lbte -logc -lwiikeyboard -lm
endif

INCDIR   = $(srcdir) . $(srcdir)/engines/ $(DEVKITPRO)/libogc/include

CXXFLAGS = -g -Os -Wall $(MACHDEP) -D__WII__ -Wno-multichar -Wno-long-long \
			-Wno-unknown-pragmas -Wno-reorder -fno-exceptions -fno-rtti

CXXFLAGS += $(addprefix -I,$(INCDIR))
LDFLAGS   = -g $(MACHDEP) -Wl,-Map,$(TARGET).elf.map
LDFLAGS  += $(addprefix -L,$(LIBDIR))

CXXFLAGS += -I$(DEVKITPRO)/3rd/wii/include
LDFLAGS  += -L$(DEVKITPRO)/3rd/wii/lib

CXXFLAGS += -DENABLE_VKEYBD -DENABLE_KEYMAPPER

ifeq ($(DEBUG_WII_USBGECKO),1)
CXXFLAGS += -DDEBUG_WII_USBGECKO
endif

ifeq ($(DEBUG_WII_MEMSTATS),1)
CXXFLAGS += -DDEBUG_WII_MEMSTATS
endif

ifeq ($(DEBUG_WII_GDB),1)
CXXFLAGS += -DDEBUG_WII_GDB
LIBS     += -ldb
endif

ifeq ($(USE_WII_DI),1)
CXXFLAGS += -DUSE_WII_DI
endif

ifeq ($(USE_WII_KBD),1)
CXXFLAGS += -DUSE_WII_KBD
endif

ifeq ($(USE_ZLIB),1)
CXXFLAGS += -DUSE_ZLIB
LIBS     += -lz
endif

ifeq ($(USE_MAD),1)
CXXFLAGS += -DUSE_MAD -I$(DEVKITPRO)/libogc/include/mad
LIBS     += -lmad
endif

ifeq ($(USE_TREMOR),1)
CXXFLAGS += -DUSE_VORBIS -DUSE_TREMOR
LIBS     += -lvorbisidec
endif

ifeq ($(USE_FLAC),1)
CXXFLAGS += -DUSE_FLAC
LIBS     += -lFLAC
endif

ifeq ($(USE_MPEG2),1)
CXXFLAGS += -DUSE_MPEG2
LIBS     += -lmpeg2
endif

ifeq ($(USE_MT32EMU),1)
CXXFLAGS += -DUSE_MT32EMU
endif

OBJS := backends/platform/wii/main.o \
		backends/platform/wii/gx_supp.o \
		backends/platform/wii/osystem.o \
		backends/platform/wii/osystem_gfx.o \
		backends/platform/wii/osystem_sfx.o \
		backends/platform/wii/osystem_events.o

include $(srcdir)/Makefile.common

.PHONY: clean-wii distclean-wii upload dist

all: $(TARGET).dol

$(TARGET).dol: $(TARGET).elf
	$(DEVKITPPC)/bin/elf2dol $< $@

$(TARGET).elf: $(OBJS)
	$(LD) $^ $(LDFLAGS) $(LIBS) -o $@

clean: clean-wii

clean-wii:
	@$(RM) $(TARGET).elf $(TARGET).elf.map $(TARGET).dol

distclean: distclean-wii

distclean-wii:
	@$(RM_REC) dist

upload: $(TARGET).dol
ifeq ($(GAMECUBE),1)
	$(DEVKITPPC)/bin/geckoupload $(TARGET).dol
else
	$(DEVKITPPC)/bin/wiiload $(TARGET).dol
endif

gdb:
	$(GDB) -n $(TARGET).elf

debug:
	$(GDB) -n $(TARGET).elf -x gdb.txt

dist:
	$(MKDIR) dist/scummvm
ifeq ($(GAMECUBE),1)
	$(CP) $(TARGET).dol dist/scummvm/
else
	$(CP) $(TARGET).dol dist/scummvm/boot.dol
	$(CP) $(DISTPATH)/meta.xml dist/scummvm/
	$(CP) $(DISTPATH)/icon.png dist/scummvm/
endif
	$(CP) $(DISTPATH)/READMII dist/scummvm/
	$(CP) $(srcdir)/AUTHORS dist/scummvm/
	$(CP) $(srcdir)/COPYING dist/scummvm/
	$(CP) $(srcdir)/COPYRIGHT dist/scummvm/
	$(CP) $(srcdir)/NEWS dist/scummvm/
	$(CP) $(srcdir)/README dist/scummvm/
	$(CP) $(DIST_FILES_THEMES) dist/scummvm/
ifneq ($(DIST_FILES_ENGINEDATA),)
	$(CP) $(DIST_FILES_ENGINEDATA) dist/scummvm/
endif