forked from RSDKModding/RSDKv3-Decompilation
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile.3ds
128 lines (109 loc) · 4.01 KB
/
Makefile.3ds
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
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
TOPDIR ?= $(CURDIR)
include $(DEVKITARM)/3ds_rules
BUILDDIR=objects_3ds
LIBS_ALL = -lSDL_mixer -lSDL -lmikmod -lmad -ltheoradec -lvorbisidec -logg -lcitro2d -lcitro3d -lctru -lm
LIBDIRS = $(CTRULIB) $(PORTLIBS)
export LIBPATHS = $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
export COMMIT = $(shell git rev-parse --short HEAD)
ARCH = -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
CFLAGS_ALL = $(INCLUDE) $(ARCH) -DARM_ASM_CLIP15=1 -O2 -g -DARM11 -D_3DS -D__3DS__ -DCOMMIT=\"$(COMMIT)\" -DFORCE_CASE_INSENSITIVE
CXXFLAGS_ALL = $(CFLAGS_ALL) $(LIBS_ALL) -fno-rtti -std=gnu++17 -Idependencies/all/theoraplay
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LDFLAGS_ALL = $(LDFLAGS)
TARGET = SonicCD
APP_TITLE := Sonic CD
APP_DESCRIPTION := Sonic CD (2011)
APP_AUTHOR := Rubberduckycooly, SaturnSH2x2
APP_ICON := resources/48x48.png
export INCLUDE = $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
export LD = $(CXX)
SOURCES = dependencies/all/theoraplay/theoraplay.c \
RSDKv3/3ds/debug_3ds.cpp \
RSDKv3/3ds/audio_3ds.cpp \
RSDKv3/3ds/render_3ds.cpp \
RSDKv3/3ds/video_3ds.cpp \
RSDKv3/3ds/3ds-theoraplayer/source/video.c \
RSDKv3/3ds/3ds-theoraplayer/source/frame.c \
RSDKv3/fcaseopen.c \
RSDKv3/Animation.cpp \
RSDKv3/Audio.cpp \
RSDKv3/Collision.cpp \
RSDKv3/Debug.cpp \
RSDKv3/Drawing.cpp \
RSDKv3/Ini.cpp \
RSDKv3/Input.cpp \
RSDKv3/main.cpp \
RSDKv3/Math.cpp \
RSDKv3/Object.cpp \
RSDKv3/Palette.cpp \
RSDKv3/Player.cpp \
RSDKv3/Reader.cpp \
RSDKv3/RetroEngine.cpp \
RSDKv3/Scene.cpp \
RSDKv3/Scene3D.cpp \
RSDKv3/Script.cpp \
RSDKv3/Sprite.cpp \
RSDKv3/String.cpp \
RSDKv3/Text.cpp \
RSDKv3/Userdata.cpp \
RSDKv3/Video.cpp
OBJS = $(BUILDDIR)/dependencies/all/theoraplay/theoraplay.c.o \
$(BUILDDIR)/RSDKv3/3ds/debug_3ds.cpp.o \
$(BUILDDIR)/RSDKv3/3ds/audio_3ds.cpp.o \
$(BUILDDIR)/RSDKv3/3ds/render_3ds.cpp.o \
$(BUILDDIR)/RSDKv3/3ds/video_3ds.cpp.o \
$(BUILDDIR)/RSDKv3/3ds/3ds-theoraplayer/source/video.c.o \
$(BUILDDIR)/RSDKv3/3ds/3ds-theoraplayer/source/frame.c.o \
$(BUILDDIR)/RSDKv3/fcaseopen.c.o \
$(BUILDDIR)/RSDKv3/Animation.cpp.o \
$(BUILDDIR)/RSDKv3/Audio.cpp.o \
$(BUILDDIR)/RSDKv3/Collision.cpp.o \
$(BUILDDIR)/RSDKv3/Debug.cpp.o \
$(BUILDDIR)/RSDKv3/Drawing.cpp.o \
$(BUILDDIR)/RSDKv3/Ini.cpp.o \
$(BUILDDIR)/RSDKv3/Input.cpp.o \
$(BUILDDIR)/RSDKv3/main.cpp.o \
$(BUILDDIR)/RSDKv3/Math.cpp.o \
$(BUILDDIR)/RSDKv3/Object.cpp.o \
$(BUILDDIR)/RSDKv3/Palette.cpp.o \
$(BUILDDIR)/RSDKv3/Player.cpp.o \
$(BUILDDIR)/RSDKv3/Reader.cpp.o \
$(BUILDDIR)/RSDKv3/RetroEngine.cpp.o \
$(BUILDDIR)/RSDKv3/Scene.cpp.o \
$(BUILDDIR)/RSDKv3/Scene3D.cpp.o \
$(BUILDDIR)/RSDKv3/Script.cpp.o \
$(BUILDDIR)/RSDKv3/Sprite.cpp.o \
$(BUILDDIR)/RSDKv3/String.cpp.o \
$(BUILDDIR)/RSDKv3/Text.cpp.o \
$(BUILDDIR)/RSDKv3/Userdata.cpp.o \
$(BUILDDIR)/RSDKv3/Video.cpp.o
export _3DSXDEPS := $(if $(NO_SMDH),,$(TARGET).smdh)
ifeq ($(strip $(NO_SMDH)),)
export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh
endif
ifneq ($(ROMFS),)
export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS)
endif
$(BUILDDIR)/%.o: %
mkdir -p $(@D)
$(CXX) $(CXXFLAGS_ALL) $^ -o $@ -c
$(TARGET).3dsx: $(TARGET).elf $(_3DSXDEPS)
$(TARGET).elf: $(SOURCES:%=objects_3ds/%.o)
$(SILENTMSG) linking $(notdir $@)
$(LD) $(LDFLAGS) $(OBJS) $(LIBPATHS) $(LIBS_ALL) -o $@
clean:
@echo "cleaning..."
@rm -rf objects_3ds
@rm -f SonicCD.3dsx
@rm -f SonicCD.smdh
@rm -f SonicCD.elf
@rm -f SonicCD.cia
cia: $(TARGET).elf
@bannertool makebanner -i resources/banner.png -a resources/jingle.wav -o "$(BUILDDIR)/banner.bnr"
@bannertool makesmdh -s "$(APP_TITLE)" -l "$(APP_DESCRIPTION)" -p "$(APP_AUTHOR)" -i "$(APP_ICON)" -o "$(BUILDDIR)/icon.icn"
@makerom -f cia -o "$(TARGET).cia" -DAPP_ENCRYPTED=false -elf "$(TARGET).elf" -rsf resources/SonicCD.rsf -exefslogo -target t -icon "$(BUILDDIR)/icon.icn" -banner "$(BUILDDIR)/banner.bnr"
@echo "built cia"