aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/psp/Makefile
blob: c47924455183d1680fcddd89bb88cf0dca0e3da7 (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
# SCUMMVM-PSP MakeFile
# $URL$
# $Id$


#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)
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_IHNM = $(ENABLED)
ENABLE_KYRA = $(ENABLED)
ENABLE_LOL = $(ENABLED)
ENABLE_LURE = $(ENABLED)
ENABLE_M4 = $(ENABLED)
ENABLE_MADE = $(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_TOUCHE = $(ENABLED)
ENABLE_TUCKER = $(ENABLED)

# Set to 1 to enable seeing the commands to gcc
VERBOSE_BUILD=1
# Set to 1 to enable, 0 to disable dynamic modules
DYNAMIC_MODULES = 1
# Set to 1 to enable profiling
ENABLE_PROFILING = 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-psp
# PSP SDK location variables
PSPSDK := $(shell psp-config --pspsdk-path)
PSPBIN = $(PSPSDK)/../bin

#check PSPSDK presence
ifeq ($(PSPSDK),)
$(error $$(PSPSDK) cannot be obtained.)
endif


# Variables for common Scummvm makefile
CXX      = psp-g++
CXXFLAGS = -O3 -Wall -Wno-multichar -fno-exceptions -fno-rtti
DEFINES  = -D__PSP__ -DNONSTANDARD_PORT -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DUSE_ZLIB  -DDISABLE_DOSBOX_OPL -DUSE_RGB_COLOR

LDFLAGS  :=
INCDIR   := $(srcdir) . $(srcdir)/engines/ $(PSPSDK)/include
INCLUDES := $(addprefix -I, $(INCDIR))
DEPDIR = .deps
MODULE_DIRS += ./
MKDIR	= mkdir -p
RM	= rm -f
RM_REC	= rm -rf
AR      = psp-ar cru
RANLIB  = psp-ranlib
AS      = psp-gcc
LD      = psp-gcc
HAVE_GCC3 = true
CXX_UPDATE_DEP_FLAG = -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP

# Variables for dynamic plugin building
PLUGIN_PREFIX =
PLUGIN_SUFFIX = .plg
PLUGIN_EXTRA_DEPS = $(srcdir)/backends/plugins/plugin.syms scummvm-psp.elf
PLUGIN_LDFLAGS = -nostartfiles -Wl,-q,--just-symbols=scummvm-psp.org.elf,-T$(srcdir)/backends/plugins/psp/plugin.ld,--retain-symbols-file,$(srcdir)/backends/plugins/plugin.syms -lstdc++ -lc

# PSP-specific variables
STRIP   = psp-strip
MKSFO	= mksfoex -d MEMSIZE=1
PACK_PBP = pack-pbp
FIXUP	= psp-fixup-imports

# 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	+= -lvorbisidec
endif

# Test for dynamic plugins
ifeq ($(DYNAMIC_MODULES),1)
ENABLED = DYNAMIC_PLUGIN
DEFINES += -DDYNAMIC_MODULES
PRE_OBJS_FLAGS = -Wl,--whole-archive
POST_OBJS_FLAGS = -Wl,--no-whole-archive
else
ENABLED = STATIC_PLUGIN
endif

# Test for profiling
ifeq ($(ENABLE_PROFILING),1)
DEFINES += -DENABLE_PROFILING
CXXFLAGS += -pg -g
LDFLAGS += -pg
endif

# SDL Libs and Flags
SDLFLAGS := $(shell $(PSPBIN)/sdl-config --cflags)
SDLLIBS  := $(shell $(PSPBIN)/sdl-config --libs)
# PSP LIBS
PSPLIBS =  -lpspprof -lpspvfpu -lpspdebug -lpspgu -lpspge -lpspdisplay -lpspctrl -lpspsdk \
	-lpsputility -lpspuser -lpsppower -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lpspkernel

# Add in PSPSDK includes and libraries.
CXXFLAGS += $(SDLFLAGS)
LIBS     += -lpng -lSDL -lz $(findstring -lGL,$(SDLLIBS)) -lstdc++ -lc -lm $(filter -L%,$(SDLLIBS)) $(PSPLIBS)

OBJS := powerman.o \
	psp_main.o \
	osys_psp.o \
	psppixelformat.o \
	memory.o \
	display_manager.o \
	display_client.o \
	default_display_client.o \
	input.o \
	cursor.o \
	trace.o \
	psploader.o \
	pspkeyboard.o


# Include common Scummvm makefile
include $(srcdir)/Makefile.common

# Variables for PSP-specific rules
PSP_EBOOT_SFO = param.sfo
PSP_EBOOT_TITLE = ScummVM-PSP
PSP_EBOOT = EBOOT.PBP
PSP_EBOOT_ICON = icon0.png
PSP_EBOOT_ICON1 = NULL
PSP_EBOOT_PIC0 = pic0.png
PSP_EBOOT_PIC1 = pic1.png
PSP_EBOOT_SND0 = NULL
PSP_EBOOT_PSAR = NULL

LDFLAGS += -Wl,-Tmain_prog.ld

all: $(PSP_EBOOT)

$(TARGET).elf: $(OBJS)
	$(LD) $(PRE_OBJS_FLAGS) $(OBJS) $(POST_OBJS_FLAGS) $(LDFLAGS) $(LIBS) -o $@
	cp $(TARGET).elf $(TARGET).org.elf
	$(FIXUP) $@

$(PSP_EBOOT_SFO):
	$(MKSFO) '$(PSP_EBOOT_TITLE)' $@

$(PSP_EBOOT): $(TARGET).elf $(PSP_EBOOT_SFO)
	$(STRIP) $(TARGET).elf
	$(PACK_PBP) $@ $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON) $(PSP_EBOOT_ICON1) \
		$(PSP_EBOOT_PIC0) $(PSP_EBOOT_PIC1) $(PSP_EBOOT_SND0)  \
		$(TARGET).elf $(PSP_EBOOT_PSAR)

kxploit: $(TARGET).elf $(PSP_EBOOT_SFO)
	mkdir -p "$(TARGET)"
	$(STRIP) $(TARGET).elf -o $(TARGET)/$(PSP_EBOOT)
	mkdir -p "$(TARGET)%"
	$(PACK_PBP) "$(TARGET)%/$(PSP_EBOOT)" $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON)  \
		$(PSP_EBOOT_ICON1) $(PSP_EBOOT_PIC0) $(PSP_EBOOT_PIC1)  \
		$(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR)

SCEkxploit: $(TARGET).elf $(PSP_EBOOT_SFO)
	mkdir -p "__SCE__$(TARGET)"
	$(STRIP) $(TARGET).elf -o __SCE__$(TARGET)/$(PSP_EBOOT)
	mkdir -p "%__SCE__$(TARGET)"
	$(PACK_PBP) "%__SCE__$(TARGET)/$(PSP_EBOOT)" $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON)  \
		$(PSP_EBOOT_ICON1) $(PSP_EBOOT_PIC0) $(PSP_EBOOT_PIC1)  \
		$(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR)