-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.ctr
419 lines (361 loc) · 12.5 KB
/
Makefile.ctr
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
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
TARGET := retroarch_3ds
LIBRETRO =
DEVKITARM = /c/devkitPro/devkitARM_r45
CTRULIB = /c/devkitPro/ctrulib_1.1_mod
AEMSTRO = /c/devkitPro/aemstro
DEBUG = 0
GRIFFIN_BUILD = 1
WHOLE_ARCHIVE_LINK = 0
BUILD_3DSX = 0
BUILD_3DS = 0
BUILD_CIA = 1
LIBCTRU_NO_DEPRECATION = 1
APP_TITLE = Retroarch 3DS PSOne
APP_DESCRIPTION = Retroarch 3DS PSOne
APP_AUTHOR = Team Libretro
APP_PRODUCT_CODE = PS1-P-BASE
APP_UNIQUE_ID = 0x1234
APP_ICON = ctr/assets/default.png
APP_BANNER = ctr/assets/libretro_banner.png
APP_AUDIO = ctr/tools/neogeo.wav
APP_RSF = ctr/tools/template.rsf
APP_SYSTEM_MODE = 64MB
APP_SYSTEM_MODE_EXT = 124MB
APP_BIG_TEXT_SECTION = 0
include ctr/Makefile.cores
OBJS :=
OBJS += gfx/drivers/ctr_sprite.o
OBJS += ctr/ctr_system.o
OBJS += ctr/ctr_memory.o
OBJS += ctr/ctr_linear.o
OBJS += ctr/ctr_svchax.o
ifeq ($(GRIFFIN_BUILD), 1)
OBJS += griffin/griffin.o
else
OBJS += libretro-common/file/file_extract.o
OBJS += verbosity.o
OBJS += performance.o
OBJS += libretro-common/compat/compat_getopt.o
OBJS += libretro-common/compat/compat_strcasestr.o
OBJS += libretro-common/compat/compat_strl.o
OBJS += libretro-common/compat/compat_fnmatch.o
OBJS += libretro-common/memmap/memalign.o
OBJS += libretro-common/file/config_file.o
OBJS += libretro-common/file/config_file_userdata.o
OBJS += core_options.o
OBJS += cheats.o
OBJS += libretro-common/hash/rhash.o
OBJS += gfx/video_context_driver.o
OBJS += gfx/drivers_context/gfx_null_ctx.o
OBJS += gfx/image/image.o
OBJS += libretro-common/formats/tga/rtga.o
OBJS += libretro-common/formats/png/rpng.o
OBJS += libretro-common/formats/png/rpng_encode.o
OBJS += libretro-common/formats/bmp/rbmp_encode.o
OBJS += libretro-common/gfx/math/matrix_4x4.o
OBJS += libretro-common/gfx/math/matrix_3x3.o
OBJS += gfx/drivers/ctr_gfx.o
OBJS += gfx/drivers/nullgfx.o
OBJS += gfx/font_driver.o
OBJS += gfx/drivers_font_renderer/bitmapfont.o
OBJS += input/input_autodetect.o
OBJS += input/input_joypad_driver.o
OBJS += input/input_hid_driver.o
OBJS += input/input_config.o
OBJS += input/input_keymaps.o
OBJS += input/input_remapping.o
OBJS += input/input_keyboard.o
OBJS += input/drivers/ctr_input.o
OBJS += input/drivers_joypad/ctr_joypad.o
OBJS += input/autoconf/builtin_ctr.o
OBJS += input/drivers/nullinput.o
OBJS += input/drivers_joypad/null_joypad.o
OBJS += input/drivers_joypad/hid_joypad.o
OBJS += input/drivers_hid/null_hid.o
OBJS += gfx/video_state_tracker.o
OBJS += libretro-common/queues/fifo_buffer.o
OBJS += audio/audio_resampler_driver.o
OBJS += audio/drivers_resampler/sinc.o
OBJS += audio/drivers_resampler/nearest.o
OBJS += audio/drivers_resampler/cc_resampler.o
OBJS += camera/drivers/nullcamera.o
OBJS += location/drivers/nulllocation.o
OBJS += audio/drivers/ctr_csnd_audio.o
OBJS += audio/drivers/ctr_dsp_audio.o
OBJS += audio/drivers/nullaudio.o
OBJS += gfx/video_driver.o
OBJS += gfx/video_common.o
OBJS += input/input_driver.o
OBJS += audio/audio_driver.o
OBJS += camera/camera_driver.o
OBJS += location/location_driver.o
OBJS += driver.o
OBJS += libretro-common/gfx/scaler/scaler_filter.o
OBJS += libretro-common/gfx/scaler/pixconv.o
OBJS += libretro-common/gfx/scaler/scaler.o
OBJS += libretro-common/gfx/scaler/scaler_int.o
OBJS += gfx/video_filters/2xsai.o
OBJS += gfx/video_filters/super2xsai.o
OBJS += gfx/video_filters/supereagle.o
OBJS += gfx/video_filters/2xbr.o
OBJS += gfx/video_filters/darken.o
OBJS += gfx/video_filters/epx.o
OBJS += gfx/video_filters/scale2x.o
OBJS += gfx/video_filters/blargg_ntsc_snes.o
OBJS += gfx/video_filters/lq2x.o
OBJS += gfx/video_filters/phosphor2x.o
OBJS += audio/audio_filters/echo.o
OBJS += audio/audio_filters/eq.o
OBJS += audio/audio_filters/chorus.o
OBJS += audio/audio_filters/iir.o
OBJS += audio/audio_filters/panning.o
OBJS += audio/audio_filters/phaser.o
OBJS += audio/audio_filters/reverb.o
OBJS += audio/audio_filters/wahwah.o
OBJS += libretro-common/dynamic/dylib.o
OBJS += dynamic.o
OBJS += gfx/video_filter.o
OBJS += audio/audio_dsp_filter.o
OBJS += cores/dynamic_dummy.o
OBJS += content.o
OBJS += libretro-common/file/file_path.o
OBJS += file_path_special.o
OBJS += libretro-common/file/dir_list.o
OBJS += libretro-common/file/retro_dirent.o
OBJS += libretro-common/file/retro_file.o
OBJS += libretro-common/file/retro_stat.o
OBJS += dir_list_special.o
OBJS += string_list_special.o
OBJS += libretro-common/string/string_list.o
OBJS += libretro-common/string/stdstring.o
OBJS += file_ops.o
OBJS += libretro-common/file/nbio/nbio_stdio.o
OBJS += libretro-common/file/file_list.o
OBJS += libretro-common/queues/message_queue.o
OBJS += patch.o
OBJS += configuration.o
OBJS += rewind.o
OBJS += frontend/frontend_driver.o
OBJS += frontend/drivers/platform_ctr.o
OBJS += frontend/drivers/platform_null.o
OBJS += core_info.o
OBJS += ui/ui_companion_driver.o
OBJS += ui/drivers/ui_null.o
OBJS += frontend/frontend.o
OBJS += libretro_version_1.o
OBJS += retroarch.o
OBJS += runloop.o
OBJS += tasks/tasks.o
OBJS += msg_hash.o
OBJS += intl/msg_hash_de.o
OBJS += intl/msg_hash_es.o
OBJS += intl/msg_hash_eo.o
OBJS += intl/msg_hash_fr.o
OBJS += intl/msg_hash_it.o
OBJS += intl/msg_hash_nl.o
OBJS += intl/msg_hash_pt.o
OBJS += intl/msg_hash_pl.o
OBJS += intl/msg_hash_us.o
OBJS += movie.o
OBJS += record/record_driver.o
OBJS += record/drivers/record_null.o
OBJS += tasks/task_decompress.o
OBJS += tasks/task_file_transfer.o
OBJS += screenshot.o
OBJS += playlist.o
OBJS += menu/menu_driver.o
OBJS += menu/menu_hash.o
OBJS += menu/menu_input.o
OBJS += menu/menu_entry.o
OBJS += menu/menu_entries.o
OBJS += menu/menu_setting.o
OBJS += menu/menu_cbs.o
OBJS += menu/cbs/menu_cbs_ok.o
OBJS += menu/cbs/menu_cbs_cancel.o
OBJS += menu/cbs/menu_cbs_select.o
OBJS += menu/cbs/menu_cbs_start.o
OBJS += menu/cbs/menu_cbs_info.o
OBJS += menu/cbs/menu_cbs_refresh.o
OBJS += menu/cbs/menu_cbs_left.o
OBJS += menu/cbs/menu_cbs_right.o
OBJS += menu/cbs/menu_cbs_title.o
OBJS += menu/cbs/menu_cbs_deferred_push.o
OBJS += menu/cbs/menu_cbs_scan.o
OBJS += menu/cbs/menu_cbs_get_value.o
OBJS += menu/cbs/menu_cbs_up.o
OBJS += menu/cbs/menu_cbs_down.o
OBJS += menu/cbs/menu_cbs_contentlist_switch.o
OBJS += menu/menu_shader.o
OBJS += menu/menu_navigation.o
OBJS += menu/menu_display.o
OBJS += menu/menu_displaylist.o
OBJS += menu/menu_animation.o
OBJS += menu/intl/menu_hash_de.o
OBJS += menu/intl/menu_hash_es.o
OBJS += menu/intl/menu_hash_eo.o
OBJS += menu/intl/menu_hash_fr.o
OBJS += menu/intl/menu_hash_it.o
OBJS += menu/intl/menu_hash_nl.o
OBJS += menu/intl/menu_hash_pl.o
OBJS += menu/intl/menu_hash_pt.o
OBJS += menu/intl/menu_hash_us.o
OBJS += menu/drivers/null.o
OBJS += menu/drivers/menu_generic.o
OBJS += menu/drivers_display/menu_display_null.o
OBJS += menu/drivers/rgui.o
OBJS += command_event.o
OBJS += deps/zlib/adler32.o
OBJS += deps/zlib/compress.o
OBJS += deps/zlib/crc32.o
OBJS += deps/zlib/deflate.o
OBJS += deps/zlib/gzclose.o
OBJS += deps/zlib/gzlib.o
OBJS += deps/zlib/gzread.o
OBJS += deps/zlib/gzwrite.o
OBJS += deps/zlib/inffast.o
OBJS += deps/zlib/inflate.o
OBJS += deps/zlib/inftrees.o
OBJS += deps/zlib/trees.o
OBJS += deps/zlib/uncompr.o
OBJS += deps/zlib/zutil.o
OBJS += deps/zlib/ioapi.o
OBJS += deps/zlib/unzip.o
OBJS += audio/audio_utils.o
endif
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
ifeq ($(strip $(CTRULIB)),)
$(error "Please set CTRULIB in your environment. export CTRULIB=<path to>ctrulib")
endif
ifeq ($(strip $(AEMSTRO)),)
$(error "Please set AEMSTRO in your environment. export AEMSTRO=<path to>aemstro")
endif
APP_TITLE := $(shell echo "$(APP_TITLE)" | cut -c1-128)
APP_DESCRIPTION := $(shell echo "$(APP_DESCRIPTION)" | cut -c1-256)
APP_AUTHOR := $(shell echo "$(APP_AUTHOR)" | cut -c1-128)
APP_PRODUCT_CODE := $(shell echo $(APP_PRODUCT_CODE) | cut -c1-16)
APP_UNIQUE_ID := $(shell echo $(APP_UNIQUE_ID) | cut -c1-7)
ROMFS := romfs
export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS)
MAKEROM_ARGS_COMMON = -rsf $(APP_RSF) -exefslogo -romfs romfs.bin -elf $(TARGET).elf -icon icon.icn -banner banner.bnr -DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(APP_PRODUCT_CODE)" -DAPP_UNIQUE_ID=$(APP_UNIQUE_ID) -DAPP_SYSTEM_MODE=$(APP_SYSTEM_MODE) -DAPP_SYSTEM_MODE_EXT=$(APP_SYSTEM_MODE_EXT)
INCDIRS := -I$(CTRULIB)/include
LIBDIRS := -L. -L$(CTRULIB)/lib
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft
CFLAGS += -mword-relocations \
-fomit-frame-pointer -ffast-math \
-Werror=implicit-function-declaration \
$(ARCH)
#CFLAGS += -Wall
CFLAGS += -DARM11 -D_3DS
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -g
else
CFLAGS += -O3
endif
ifeq ($(LIBCTRU_NO_DEPRECATION), 1)
CFLAGS += -DLIBCTRU_NO_DEPRECATION
endif
ifeq ($(WHOLE_ARCHIVE_LINK), 1)
WHOLE_START := -Wl,--whole-archive
WHOLE_END := -Wl,--no-whole-archive
endif
CFLAGS += -I. -Ideps/zlib -Ideps/7zip -Ilibretro-common/include
CFLAGS += -DRARCH_INTERNAL -DRARCH_CONSOLE -DSINC_LOWEST_QUALITY
CFLAGS += -DHAVE_GRIFFIN=1 -DHAVE_FILTERS_BUILTIN -DHAVE_MENU -DHAVE_RGUI
CFLAGS += -DHAVE_ZLIB -DHAVE_RPNG -DWANT_ZLIB -DHAVE_BUILTIN_AUTOCONFIG
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
ASFLAGS := -g $(ARCH) -O3
LDFLAGS = -specs=ctr/3dsx_custom.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
CFLAGS += -std=gnu99 -ffast-math
LIBS := $(WHOLE_START) -lretro_ctr $(WHOLE_END) -lctru -lm
ifeq ($(BUILD_3DSX), 1)
TARGET_3DSX := $(TARGET).3dsx $(TARGET).smdh
endif
ifeq ($(BUILD_3DS), 1)
TARGET_3DS := $(TARGET).3ds
endif
ifeq ($(BUILD_CIA), 1)
TARGET_CIA := $(TARGET).cia
endif
.PHONY: $(BUILD) clean all
all: $(TARGET)
$(TARGET): $(TARGET_3DSX) $(TARGET_3DS) $(TARGET_CIA)
$(TARGET).3dsx: $(TARGET).elf
$(TARGET).elf: $(OBJS) libretro_ctr.a
ctr_sprite_shader_shbin.h: gfx/drivers/ctr_sprite.o
gfx/drivers/ctr_gfx.c: ctr_sprite_shader_shbin.h
griffin/griffin.o: gfx/drivers/ctr_gfx.c
PREFIX := $(DEVKITARM)/bin/arm-none-eabi-
CC := $(PREFIX)gcc.exe
CXX := $(PREFIX)g++.exe
AS := $(PREFIX)as.exe
AR := $(PREFIX)ar.exe
OBJCOPY := $(PREFIX)objcopy.exe
STRIP := $(PREFIX)strip.exe
NM := $(PREFIX)nm.exe
LD := $(CXX)
ifneq ($(findstring Linux,$(shell uname -a)),)
MAKEROM = ctr/tools/makerom-linux
BANNERTOOL = ctr/tools/bannertool-linux
3DSTOOL = ctr/tools/3dstool.exe
else ifneq ($(findstring Darwin,$(shell uname -a)),)
MAKEROM = ctr/tools/makerom-mac
BANNERTOOL = ctr/tools/bannertool-mac
else
MAKEROM = ctr/tools/makerom.exe
BANNERTOOL = ctr/tools/bannertool.exe
endif
%.o: %.shader
python $(AEMSTRO)/aemstro_as.py $< $(notdir $<).shbin
$(DEVKITARM)/bin/bin2s $(notdir $<).shbin | $(PREFIX)as.exe -o $@
echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h
echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h
echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h
rm $(notdir $<).shbin
%.o: %.cpp
$(CXX) -c -o $@ $< $(CXXFLAGS) $(INCDIRS)
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS) $(INCDIRS)
%.o: %.s
$(CC) -c -o $@ $< $(ASFLAGS)
%.o: %.S
$(CC) -c -o $@ $< $(ASFLAGS)
%.a:
$(AR) -rc $@ $^
%.vsh:
$(TARGET).smdh: $(APP_ICON)
smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@
$(TARGET).3dsx: $(TARGET).elf
ifeq ($(APP_BIG_TEXT_SECTION), 1)
cp ctr/big_text_section.xml $(TARGET).xml
else
rm -f $(TARGET).xml
endif
-3dsxtool $< $@ $(_3DSXFLAGS)
$(TARGET).elf: ctr/3dsx_custom_crt0.o
$(LD) $(LDFLAGS) $(OBJS) $(LIBDIRS) $(LIBS) -o $@
$(NM) -CSn $@ > $(notdir $*.lst)
$(TARGET).3ds: $(TARGET).elf $(APP_RSF)
$(MAKEROM) -f cci -o $@ $(MAKEROM_ARGS_COMMON) -r-DAPP_ENCRYPTED=true
$(TARGET).cia: $(TARGET).elf $(APP_RSF)
$(MAKEROM) -f cia -o $@ $(MAKEROM_ARGS_COMMON) -DAPP_ENCRYPTED=false
romfs_cia:
rm -f $(TARGET).cia
rm -f romfs.bin
./ctr/tools/3dstool.exe -c --romfs-dir romfs/ -f romfs.bin --type romfs
$(MAKEROM) -f cia -o $(TARGET).cia $(MAKEROM_ARGS_COMMON) -DAPP_ENCRYPTED=false
.PHONY: romfs_cia
clean:
rm -f $(OBJS)
rm -f $(TARGET).3dsx
rm -f $(TARGET).elf
rm -f $(TARGET).3ds
rm -f $(TARGET).cia
rm -f $(TARGET).smdh
rm -f *_shader_shbin.h
rm -f ctr/ctr_config_*.o
rm -f ctr/3dsx_custom_crt0.o
rm -f romfs.bin
./ctr/tools/3dstool.exe -c --romfs-dir romfs/ -f romfs.bin --type romfs
.PHONY: clean