forked from libretro/vba-next
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.ps3
252 lines (200 loc) · 8.22 KB
/
Makefile.ps3
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
251
252
#options, set 1 to enable
DEBUG = 0
CELL_DEBUG_CONSOLE = 0
CELL_DEBUG_FPS = 0
ORIGINAL_BRANCHES = 0
MULTIMAN_SUPPORT = 0
SDK_340 = 1
DOWNLOAD_SHADERS = 1
# specify build tools
CELL_BUILD_TOOLS = GCC
#explicitly set some cell sdk defaults
CELL_SDK ?= /usr/local/cell
# CELL_GPU_TYPE (currently RSX is only one option)
CELL_GPU_TYPE = RSX
#CELL_PSGL_VERSION is debug, dpm or opt
CELL_PSGL_VERSION = opt
ifeq ($(shell uname), Linux)
CELL_HOST_PATH = $(CELL_SDK)/host-linux
else
CELL_HOST_PATH = $(CELL_SDK)/host-win32
endif
#Python binary - only useful for PSL1ght scripts
PYTHONBIN = python2.7
# set path to important executables
MAKE_FSELF = $(CELL_HOST_PATH)/bin/make_fself
MAKE_FSELF_NPDRM = $(CELL_HOST_PATH)/bin/make_fself_npdrm
MAKE_PACKAGE_NPDRM = $(CELL_HOST_PATH)/bin/make_package_npdrm
# Geohot CFW defines
MKSELF_GEOHOT = make_self_npdrm
MKPKG_PSLIGHT = ps3/buildtools/PS3Py/pkg.py
PKG_FINALIZE = package_finalize
STRIP = $(CELL_HOST_PATH)/ppu/bin/ppu-lv2-strip
ifeq ($(CELL_BUILD_TOOLS),SNC)
C = $(CELL_HOST_PATH)/sn/bin/ps3ppusnc
CC = $(CELL_HOST_PATH)/sn/bin/ps3ppusnc
else
C = $(CELL_HOST_PATH)/ppu/bin/ppu-lv2-gcc
CC = $(CELL_HOST_PATH)/ppu/bin/ppu-lv2-g++
endif
# set path to all relevants directories
SRC_DIR = ./ps3
CELL_FRAMEWORK_DIR = ./ps3/cellframework
CELL_FRAMEWORK2_DIR = ./ps3/cellframework2
VBA_API_DIR = ./src
BUILD_DIR = ./objs
# build src lists and object file lists
VBA_CPPSRCS += $(SRC_DIR)/ps3video.cpp \
$(SRC_DIR)/emu-ps3.cpp \
$(VBA_API_DIR)/sound.cpp \
$(VBA_API_DIR)/memory.cpp \
$(SRC_DIR)/menu.cpp \
$(VBA_API_DIR)/gba.cpp
VBA_CPPOBJS = $(VBA_CPPSRCS:.cpp=.ppu.o)
VBA_CSRCS += $(SRC_DIR)/ps3input.c \
$(CELL_FRAMEWORK2_DIR)/fileio/file_browser.c \
$(SRC_DIR)/conf/config_file.c \
$(CELL_FRAMEWORK2_DIR)/audio/audioport.c \
$(CELL_FRAMEWORK2_DIR)/audio/librsound.c \
$(CELL_FRAMEWORK2_DIR)/audio/rsound.c \
$(CELL_FRAMEWORK2_DIR)/input/pad_input.c \
$(CELL_FRAMEWORK2_DIR)/input/mouse_input.c \
$(CELL_FRAMEWORK2_DIR)/utility/oskutil.c
VBA_COBJS = $(VBA_CSRCS:.c=.ppu.o)
PPU_CPPOBJS = $(VBA_CPPOBJS:%=$(BUILD_DIR)/%)
PPU_COBJS = $(VBA_COBJS:%=$(BUILD_DIR)/%)
# Output file
PPU_TARGET = vba.ppu.elf
ifeq ($(CELL_BUILD_TOOLS),GCC)
DEFINES = -W -Wall -Wuninitialized -Wcomment -Wchar-subscripts -Wdeprecated-declarations -Wendif-labels -Wformat=2 -Wformat-extra-args -Wimplicit -Wimport -Winline -Wmissing-braces -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wshadow -Wsign-compare -Wswitch -Wunknown-pragmas -Wunused -Wwrite-strings
OPT_FLAGS += -ffast-math --param inline-unit-growth=200 --param large-function-growth=200 --param max-inline-insns-single=450
endif
DEFINES += -DBLARGG_BIG_ENDIAN=1 -D__CELLOS_LV2__ -DBRANCHLESS_GBA_GFX -D__ppc__ -DSPEEDHAX -D__POWERPC__ -DWORDS_BIGENDIAN -DUSE_CACHE_PREFETCH=1 -DGEKKO -DPSGL -DPATH_MAX=1024 -DHAVE_INTTYPES_H -D_HAVE_STDINT_H -DINLINE=inline
INCDIRS_FLAGS += -I. -I$(VBA_API_DIR)
ifeq ($(DEBUG),1)
PPU_LV2_OPTIMIZE := -O0 -g
else
PPU_LV2_OPTIMIZE := -O3 -DNDEBUG -g
endif
PPU_CXXFLAGS = -std=c++98 $(DEFINES) $(INCDIRS_FLAGS) $(OPT_FLAGS) $(PPU_LV2_OPTIMIZE) -fno-rtti -fno-exceptions
PPU_CFLAGS = -std=gnu99 $(DEFINES) $(INCDIRS_FLAGS) $(OPT_FLAGS) $(PPU_LV2_OPTIMIZE)
# compiler optimizations
EMULATOR_VERSION = 1.03
# VBA optimization flags
ifeq ($(ORIGINAL_BRANCHES),1)
PPU_CFLAGS += -DORIGINAL_BRANCHES=1
PPU_CXXFLAGS += -DORIGINAL_BRANCHES=1
endif
ifeq ($(CELL_DEBUG_CONSOLE),1)
PPU_CFLAGS += -DCELL_DEBUG_CONSOLE
PPU_CXXFLAGS += -DCELL_DEBUG_CONSOLE
L_CONTROL_CONSOLE_LDLIBS = -lcontrol_console_ppu
L_NET_CTL_LDLIBS = -lnetctl_stub
endif
ifeq ($(CELL_DEBUG_FPS),1)
PPU_CFLAGS += -DCELL_DEBUG_FPS
PPU_CXXFLAGS += -DCELL_DEBUG_FPS
endif
ifeq ($(MULTIMAN_SUPPORT),1)
PPU_CFLAGS += -DMULTIMAN_SUPPORT=1
PPU_CXXFLAGS += -DMULTIMAN_SUPPORT=1
ifeq ($(shell uname), Linux)
MKFSELF_WC= $(HOME)/bin/make_self_wc
else
MKFSELF_WC = $(CELL_SDK)/../bin/make_self_wc
endif
endif
ifeq ($(SDK_340),1)
L_SYSUTIL_SCREENSHOT = -lsysutil_screenshot_stub
else
L_SYSUTIL_SCREENSHOT =
endif
# libs, order matters!
PPU_LDLIBS += -L. -L$(CELL_SDK)/target/ppu/lib/PSGL/RSX/opt -ldbgfont -lPSGL -lPSGLcgc -lcgc -lgcm_cmd -lgcm_sys_stub -lresc_stub -lm -lio_stub -lfs_stub -lsysutil_stub -lsysutil_game_stub $(L_SYSUTIL_SCREENSHOT) $(L_CONTROL_CONSOLE_LDLIBS) -lpngdec_stub -ljpgdec_stub -lsysmodule_stub -laudio_stub -lpthread -lnet_stub $(L_NET_CTL_LDLIBS)
# RULE: ALL
all: $(PPU_TARGET) $(PPU_TARGET:%.elf=%.self)
# RULE: All cpp files, can differentiate for vba dir
$(BUILD_DIR)/%.ppu.o: %.cpp
@mkdir -p $(@D)
$(if $(findstring $@,$(VBA_CPPOBJS:%=$(BUILD_DIR)/%)),\
$(CC) $(PPU_CXXFLAGS) -o $@ -c $<,\
$(CC) $(PPU_CXXFLAGS) -o $@ -c $<)
# RULE: All c files, can differentiate for vba dir
$(BUILD_DIR)/%.ppu.o: %.c
@mkdir -p $(@D)
$(if $(findstring $@,$(VBA_COBJS:%=$(BUILD_DIR)/%)),\
$(C) $(PPU_CFLAGS) -o $@ -c $<,\
$(C) $(PPU_CFLAGS) -o $@ -c $<)
# RULE: build the elf file
$(PPU_TARGET): $(PPU_CPPOBJS) $(PPU_COBJS)
$(CC) $(PPU_CXXFLAGS) $(PPU_LDLIBS) -o $(PPU_TARGET) $(PPU_CPPOBJS) $(PPU_COBJS)
# RULE: build the self file
$(PPU_TARGET:%.elf=%.self): $(PPU_TARGET)
$(MAKE_FSELF) $(PPU_TARGET) $(PPU_TARGET:%.elf=%.self)
# RULE: generates the compiler and linker flags for profile-arcs
genProfile: set_genProfile_flags all
set_genProfile_flags: $(BUILD_DIR)/$(CELL_FRAMEWORK_DIR)/network-stdio/net_stdio.ppu.o
touch ./src/VbaPs3.cpp
$(eval PPU_CXXFLAGS += -DPS3_PROFILING -DPS3_PROFILING_IP=\"192.168.1.101\" -DPS3_PROFILING_PORT=9001)
$(eval PPU_CFLAGS += -DPS3_PROFILING -DPS3_PROFILING_IP=\"192.168.1.101\" -DPS3_PROFILING_PORT=9001)
$(eval PPU_CXXVBAFLAGS = $(PPU_CXXFLAGS) -fprofile-generate -fprofile-arcs)
$(eval PPU_CVBAFLAGS = $(PPU_CFLAGS) -fprofile-generate -fprofile-arcs)
$(eval PPU_LDLIBS += -lgcov)
$(eval PPU_LDLIBS += -Wl,-wrap,fopen -Wl,-wrap,fclose -Wl,-wrap,fwrite -Wl,-wrap,fread -Wl,-wrap,fseek -Wl,-wrap,ftell -Wl,-wrap,fflush -Wl,-wrap,rewind -Wl,-wrap,fgetpos -Wl,-wrap,fsetpos -Wl,-wrap,setbuf -Wl,-wrap,setvbuf -Wl,-wrap,ungetc -Wl,-wrap,feof)
# RULE: use a generated profile (gcda files)
useProfile: set_useProfile_flags all
set_useProfile_flags:
touch ./src/VbaPs3.cpp
$(eval PPU_CXXVBAFLAGS = $(PPU_CXXFLAGS) -fprofile-use)
$(eval PPU_CVBAFLAGS = $(PPU_CFLAGS) -fprofile-use)
$(eval PPU_LDLIBS += -fprofile-use)
# RULE: build the package
pkg: $(PPU_TARGET)
$(STRIP) $(PPU_TARGET)
ifeq ($(MULTIMAN_SUPPORT),1)
$(MKFSELF_WC) $(PPU_TARGET) ps3/pkg/USRDIR/RELOAD.SELF
else
$(MAKE_FSELF_NPDRM) $(PPU_TARGET) ps3/pkg/USRDIR/EBOOT.BIN
endif
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_PACKAGE_NPDRM) ps3/pkg/package.conf ps3/pkg
# RULE: testing...
echo:
echo $(PPU_CPPOBJS)
echo $(BUILD_DIR)/$(CELL_FRAMEWORK_DIR)/network-stdio/net_stdio.ppu.o
# RULE - clean vba or ps3 or utils or all
clean_vba:
@rm $(VBA_CPPOBJS:%=$(BUILD_DIR)/%) -f
@rm $(VBA_CPPOBJS:%.o=$(BUILD_DIR)/%.d) -f
@rm $(VBA_COBJS:%=$(BUILD_DIR)/%) -f
@rm $(VBA_COBJS:%.o=$(BUILD_DIR)/%.d) -f
clean: clean_vba
@rm $(PPU_TARGET) $(PPU_TARGET:%.elf=%.self) -f
#massively reduced filesize using MKSELF_GEOHOT - use this for normal jailbreak builds
pkg-signed: $(PPU_TARGET)
ifeq ($(MULTIMAN_SUPPORT),1)
$(MKFSELF_WC) $(PPU_TARGET) ps3/pkg/USRDIR/RELOAD.SELF
else
$(MKSELF_GEOHOT) $(PPU_TARGET) ps3/pkg/USRDIR/EBOOT.BIN VBAM900000
endif
ifeq ($(DOWNLOAD_SHADERS),1)
rm -rf ps3/pkg/USRDIR/shaders
git clone git://github.com/twinaphex/common-shaders.git ps3/pkg/USRDIR/shaders
endif
$(PYTHONBIN) $(MKPKG_PSLIGHT) --contentid IV0002-VBAM90000_00-SAMPLE0000000001 ps3/pkg/ vbanext-ps3-v$(EMULATOR_VERSION)-fw3.41.pkg
#use this to create a PKG for use with CFW 3.55
pkg-signed-cfw: $(PPU_TARGET)
ifeq ($(MULTIMAN_SUPPORT),1)
$(MKFSELF_WC) $(PPU_TARGET) ps3/pkg/USRDIR/RELOAD.SELF
else
$(MKSELF_GEOHOT) $(PPU_TARGET) ps3/pkg/USRDIR/EBOOT.BIN VBAM900000
endif
ifeq ($(DOWNLOAD_SHADERS),1)
rm -rf ps3/pkg/USRDIR/shaders
git clone git://github.com/twinaphex/common-shaders.git ps3/pkg/USRDIR/shaders
endif
$(PYTHONBIN) $(MKPKG_PSLIGHT) --contentid IV0002-VBAM90000_00-SAMPLE0000000001 ps3/pkg/ vbanext-ps3-v$(EMULATOR_VERSION)-cfw3.55.pkg
$(PKG_FINALIZE) vbanext-ps3-v$(EMULATOR_VERSION)-cfw3.55.pkg