-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
389 lines (314 loc) · 7.92 KB
/
Makefile
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
#------------------------------------------------------------------------------
#
# CPS1/CPS2/NEOGEO/NEOGEO CDZ Emulator for PSP Makefile
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Configuration
#------------------------------------------------------------------------------
#BUILD_CPS1PSP = 1
BUILD_CPS2PSP = 1
#BUILD_MVSPSP = 1
#BUILD_NCDZPSP = 1
PSP_SLIM = 1
#KERNEL_MODE = 1
COMMAND_LIST = 1
ADHOC = 1
SAVE_STATE = 1
UI_32BPP = 1
#RELEASE = 1
#------------------------------------------------------------------------------
# Version
#------------------------------------------------------------------------------
VERSION_MAJOR = 2
VERSION_MINOR = 3
VERSION_BUILD = 5
#------------------------------------------------------------------------------
# Defines
#------------------------------------------------------------------------------
OS = psp
ifdef PSP_SLIM
PSP_FW_VERSION = 371
KERNEL_MODE =
else
PSP_FW_VERSION = 150
endif
ifdef BUILD_CPS1PSP
BUILD_CPS2PSP=
BUILD_MVSPSP=
BUILD_NCDZPSP=
TARGET = CPS1PSP
endif
ifdef BUILD_CPS2PSP
BUILD_MVSPSP=
BUILD_NCDZPSP=
TARGET = CPS2PSP
endif
ifdef BUILD_MVSPSP
BUILD_NCDZPSP=
TARGET = MVSPSP
endif
ifdef BUILD_NCDZPSP
TARGET = NCDZPSP
ADHOC =
endif
PBPNAME_STR = $(TARGET)
ifeq ($(VERSION_BUILD), 0)
VERSION_STR = $(VERSION_MAJOR).$(VERSION_MINOR)
else
VERSION_STR = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_BUILD)
endif
ifdef BUILD_CPS1PSP
ifdef PSP_SLIM
EXTRA_TARGETS = maketree SLIM/CPS1/EBOOT.PBP delelf
else
EXTRA_TARGETS = maketree 3XX/CPS1/EBOOT.PBP delelf
endif
endif
ifdef BUILD_CPS2PSP
ifdef PSP_SLIM
EXTRA_TARGETS = maketree SLIM/CPS2/EBOOT.PBP delelf
else
EXTRA_TARGETS = maketree 3XX/CPS2/EBOOT.PBP delelf
endif
endif
ifdef BUILD_MVSPSP
ifdef PSP_SLIM
EXTRA_TARGETS = maketree SLIM/MVS/EBOOT.PBP delelf
else
EXTRA_TARGETS = maketree 3XX/MVS/EBOOT.PBP delelf
endif
endif
ifdef BUILD_NCDZPSP
ifdef PSP_SLIM
EXTRA_TARGETS = maketree SLIM/NCDZ/EBOOT.PBP delelf
else
EXTRA_TARGETS = maketree 3XX/NCDZ/EBOOT.PBP delelf
endif
endif
#------------------------------------------------------------------------------
# Utilities
#------------------------------------------------------------------------------
ifeq ($(PSPDEV),)
MD = -mkdir
RM = -rm
else
MD = -mkdir.exe
RM = -rm.exe
endif
#------------------------------------------------------------------------------
# File include path
#------------------------------------------------------------------------------
INCDIR = \
src \
src/zip \
src/zlib \
src/libmad
ifdef PSP_SLIM
INCDIR += src/SDK/include
endif
#------------------------------------------------------------------------------
# Object Directory
#------------------------------------------------------------------------------
OBJDIRS = \
$(OBJ) \
$(OBJ)/cpu \
$(OBJ)/common \
$(OBJ)/sound \
$(OBJ)/zip \
$(OBJ)/zlib \
$(OBJ)/libmad \
$(OBJ)/$(OS) \
$(OBJ)/$(OS)/font \
$(OBJ)/$(OS)/icon
#------------------------------------------------------------------------------
# Object Files (common)
#------------------------------------------------------------------------------
MAINOBJS = \
$(OBJ)/emumain.o \
$(OBJ)/zip/zfile.o \
$(OBJ)/zip/unzip.o \
$(OBJ)/sound/sndintrf.o \
$(OBJ)/common/cache.o \
$(OBJ)/common/loadrom.o
ifdef ADHOC
MAINOBJS += $(OBJ)/common/adhoc.o
endif
ifdef COMMAND_LIST
MAINOBJS += $(OBJ)/common/cmdlist.o
endif
ifdef SAVE_STATE
MAINOBJS += $(OBJ)/common/state.o
endif
FONTOBJS = \
$(OBJ)/$(OS)/font/graphic.o \
$(OBJ)/$(OS)/font/ascii_14p.o \
$(OBJ)/$(OS)/font/font_s.o \
$(OBJ)/$(OS)/font/bshadow.o \
$(OBJ)/$(OS)/font/command.o \
$(OBJ)/$(OS)/font/ascii_14.o \
$(OBJ)/$(OS)/font/latin1_14.o \
$(OBJ)/$(OS)/font/gbk_s14.o \
$(OBJ)/$(OS)/font/gbk_tbl.o
OSOBJS = \
$(OBJ)/$(OS)/$(OS).o \
$(OBJ)/$(OS)/config.o \
$(OBJ)/$(OS)/filer.o \
$(OBJ)/$(OS)/input.o \
$(OBJ)/$(OS)/ticker.o \
$(OBJ)/$(OS)/ui.o \
$(OBJ)/$(OS)/ui_draw.o \
$(OBJ)/$(OS)/ui_menu.o \
$(OBJ)/$(OS)/ui_text.o \
$(OBJ)/$(OS)/video.o \
$(OBJ)/$(OS)/sound.o \
$(OBJ)/$(OS)/png.o \
ifdef ADHOC
OSOBJS += $(OBJ)/$(OS)/adhoc.o
endif
OSOBJS += $(OBJ)/$(OS)/SystemButtons.o
ifdef UI_32BPP
OSOBJS += $(OBJ)/$(OS)/wallpaper.o
endif
ZLIB = \
$(OBJ)/zlib/adler32.o \
$(OBJ)/zlib/compress.o \
$(OBJ)/zlib/uncompr.o \
$(OBJ)/zlib/crc32.o \
$(OBJ)/zlib/deflate.o \
$(OBJ)/zlib/inflate.o \
$(OBJ)/zlib/inftrees.o \
$(OBJ)/zlib/inffast.o \
$(OBJ)/zlib/trees.o \
$(OBJ)/zlib/zutil.o
# $(OBJ)/zlib/gzclose.o \
# $(OBJ)/zlib/gzlib.o \
# $(OBJ)/zlib/gzread.o \
# $(OBJ)/zlib/gzwrite.o \
# $(OBJ)/zlib/infback.o \
#------------------------------------------------------------------------------
# Include makefiles
#------------------------------------------------------------------------------
include src/makefiles/$(TARGET).mak
#------------------------------------------------------------------------------
# Compiler Flags
#------------------------------------------------------------------------------
CFLAGS = \
-O2 \
-fomit-frame-pointer \
-fstrict-aliasing \
-falign-functions=32 \
-falign-loops \
-falign-labels \
-falign-jumps \
-Wall \
-Wundef \
-Wpointer-arith \
-Wbad-function-cast \
-Wwrite-strings \
-Wmissing-prototypes \
-Wsign-compare \
-Werror \
-DZLIB_CONST
#------------------------------------------------------------------------------
# Compiler Defines
#------------------------------------------------------------------------------
CDEFS = -DINLINE='static __inline' \
-Dinline=__inline \
-D__inline__=__inline \
-DBUILD_$(TARGET)=1 \
-DPBPNAME_STR='"$(PBPNAME_STR)"' \
-DVERSION_STR='"$(VERSION_STR)"' \
-DVERSION_MAJOR=$(VERSION_MAJOR) \
-DVERSION_MINOR=$(VERSION_MINOR) \
-DVERSION_BUILD=$(VERSION_BUILD) \
-DPSP
ifdef PSP_SLIM
CDEFS += -DPSP_SLIM=1
endif
ifdef KERNEL_MODE
CDEFS += -DKERNEL_MODE=1
endif
ifdef ADHOC
CDEFS += -DADHOC=1
SAVE_STATE = 1
endif
ifdef SAVE_STATE
CDEFS += -DSAVE_STATE=1
endif
ifdef COMMAND_LIST
CFLAGS += -DCOMMAND_LIST=1
endif
ifdef UI_32BPP
CFLAGS += -DPSP_VIDEO_32BPP=1
else
CFLAGS += -DPSP_VIDEO_32BPP=0
endif
ifdef RELEASE
CDEFS += -DRELEASE=1
else
CDEFS += -DRELEASE=0
endif
#------------------------------------------------------------------------------
# Linker Flags
#------------------------------------------------------------------------------
ifdef PSP_SLIM
LIBDIR = src/SDK/lib
else
LIBDIR =
endif
LDFLAGS =
#------------------------------------------------------------------------------
# Library
#------------------------------------------------------------------------------
USE_PSPSDK_LIBC = 1
LIBS = -lm -lc -lpspaudio -lpspgu -lpsppower -lpsprtc
ifdef PSP_SLIM
LIBS += -lpspkubridge
endif
ifdef ADHOC
LIBS += -lpspwlan -lpspnet_adhoc -lpspnet_adhocctl -lpspnet_adhocmatching
endif
ifdef BUILD_NCDZPSP
LIBS += src/libmad/libmad.a
endif
#------------------------------------------------------------------------------
# Rules to make libraries
#------------------------------------------------------------------------------
OBJS = $(MAINOBJS) $(COREOBJS) $(OSOBJS) $(FONTOBJS) $(ICONOBJS) $(ZLIB)
include src/makefiles/build.mak
#------------------------------------------------------------------------------
# Rules to manage files
#------------------------------------------------------------------------------
$(OBJ)/%.o: src/%.c
@echo Compiling $<...
@$(CC) $(CDEFS) $(CFLAGS) -c $< -o$@
ifdef KERNEL_MODE
$(OBJ)/psp/adhoc.o: src/psp/adhoc.c
@echo Compiling [-G0] $<...
@$(CC) -G0 $(CDEFS) $(CFLAGS) -c $< -o$@
endif
$(OBJ)/%.o: src/%.S
@echo Assembling $<...
@$(CC) $(CDEFS) $(CFLAGS) -c $< -o$@
$(OBJ)/%.o: src/%.s
@echo Assembling $<...
@$(AS) $(ASDEFS) $(ASFLAGS) -c $< -o$@
$(OBJ)/%.a:
@echo Archiving $@...
@$(AR) -r $@ $^
delelf:
@$(RM) -f $(PSP_EBOOT_SFO)
@$(RM) -f $(TARGET).elf
maketree:
@$(MD) 3xx
@$(MD) 3xx/cps1
@$(MD) 3xx/cps2
@$(MD) 3xx/mvs
@$(MD) 3xx/ncdz
@$(MD) slim
@$(MD) slim/cps1
@$(MD) slim/cps2
@$(MD) slim/mvs
@$(MD) slim/ncdz
@$(MD) -p $(subst //,\,$(sort $(OBJDIRS)))