Skip to content

Commit 5063895

Browse files
committed
Initial commit
1 parent 2569b66 commit 5063895

204 files changed

Lines changed: 104328 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
#---------------------------------------------------------------------------------
2+
.SUFFIXES:
3+
#---------------------------------------------------------------------------------
4+
5+
ifeq ($(strip $(DEVKITARM)),)
6+
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
7+
endif
8+
9+
TOPDIR ?= $(CURDIR)
10+
include $(DEVKITARM)/3ds_rules
11+
12+
#---------------------------------------------------------------------------------
13+
# TARGET is the name of the output
14+
# BUILD is the directory where object files & intermediate files will be placed
15+
# SOURCES is a list of directories containing source code
16+
# DATA is a list of directories containing data files
17+
# INCLUDES is a list of directories containing header files
18+
#
19+
# NO_SMDH: if set to anything, no SMDH file is generated.
20+
# APP_TITLE is the name of the app stored in the SMDH file (Optional)
21+
# APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional)
22+
# APP_AUTHOR is the author of the app stored in the SMDH file (Optional)
23+
# ICON is the filename of the icon (.png), relative to the project folder.
24+
# If not set, it attempts to use one of the following (in this order):
25+
# - <Project name>.png
26+
# - icon.png
27+
# - <libctru folder>/default_icon.png
28+
#---------------------------------------------------------------------------------
29+
TARGET := ctrQuake
30+
BUILD := build
31+
SOURCES := source
32+
APP_AUTHOR := MasterFeizz
33+
APP_TITLE := ctrQuake
34+
35+
DATA := data
36+
INCLUDES := include
37+
38+
#---------------------------------------------------------------------------------
39+
# options for code generation
40+
#---------------------------------------------------------------------------------
41+
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard
42+
43+
CFLAGS := -g -Wall -O2 -mword-relocations \
44+
-fomit-frame-pointer -ffast-math \
45+
$(ARCH)
46+
47+
CFLAGS += $(INCLUDE) -DARM11 -D_3DS -DGAME_HARD_LINKED -DREF_HARD_LINKED -DQW_HACK
48+
49+
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
50+
51+
ASFLAGS := -g $(ARCH)
52+
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
53+
54+
LIBS := -lctru -lm
55+
56+
#---------------------------------------------------------------------------------
57+
# list of directories containing libraries, this must be the top level containing
58+
# include and lib
59+
#---------------------------------------------------------------------------------
60+
LIBDIRS := $(CTRULIB)
61+
62+
63+
#---------------------------------------------------------------------------------
64+
# no real need to edit anything past this point unless you need to add additional
65+
# rules for different file extensions
66+
#---------------------------------------------------------------------------------
67+
ifneq ($(BUILD),$(notdir $(CURDIR)))
68+
#---------------------------------------------------------------------------------
69+
70+
export OUTPUT := $(CURDIR)/$(TARGET)
71+
export TOPDIR := $(CURDIR)
72+
73+
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
74+
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
75+
76+
export DEPSDIR := $(CURDIR)/$(BUILD)
77+
78+
COMMON_OBJS = chase.o \
79+
cl_demo.o \
80+
cl_input.o \
81+
cl_main.o \
82+
cl_parse.o \
83+
cl_tent.o \
84+
cmd.o \
85+
common.o \
86+
console.o \
87+
crc.o \
88+
cvar.o \
89+
host.o \
90+
host_cmd.o \
91+
keys.o \
92+
mathlib.o \
93+
menu.o \
94+
net_dgrm.o \
95+
net_loop.o \
96+
net_main.o \
97+
net_vcr.o \
98+
pr_cmds.o \
99+
pr_edict.o \
100+
pr_exec.o \
101+
r_part.o \
102+
sbar.o \
103+
sv_main.o \
104+
sv_move.o \
105+
sv_phys.o \
106+
sv_user.o \
107+
view.o \
108+
wad.o \
109+
world.o \
110+
zone.o \
111+
sys_ctr.o \
112+
d_edge.o \
113+
d_fill.o \
114+
d_init.o \
115+
d_modech.o \
116+
d_part.o \
117+
d_polyse.o \
118+
d_scan.o \
119+
d_sky.o \
120+
d_sprite.o \
121+
d_surf.o \
122+
d_vars.o \
123+
d_zpoint.o \
124+
draw.o \
125+
model.o \
126+
nonintel.o \
127+
r_aclip.o \
128+
r_alias.o \
129+
r_bsp.o \
130+
r_draw.o \
131+
r_edge.o \
132+
r_efrag.o \
133+
r_light.o \
134+
r_main.o \
135+
r_misc.o \
136+
r_sky.o \
137+
r_sprite.o \
138+
r_surf.o \
139+
r_vars.o \
140+
screen.o \
141+
snd_dma.o \
142+
snd_mix.o \
143+
snd_mem.o \
144+
snd_ctr.o \
145+
vid_ctr.o \
146+
net_none.o \
147+
in_ctr.o \
148+
cd_null.o
149+
150+
151+
CFILES := $(COMMON_OBJS)
152+
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
153+
SFILES :=
154+
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
155+
156+
#---------------------------------------------------------------------------------
157+
# use CXX for linking C++ projects, CC for standard C
158+
#---------------------------------------------------------------------------------
159+
ifeq ($(strip $(CPPFILES)),)
160+
#---------------------------------------------------------------------------------
161+
export LD := $(CC)
162+
#---------------------------------------------------------------------------------
163+
else
164+
#---------------------------------------------------------------------------------
165+
export LD := $(CXX)
166+
#---------------------------------------------------------------------------------
167+
endif
168+
#---------------------------------------------------------------------------------
169+
170+
export OFILES := $(addsuffix .o,$(BINFILES)) \
171+
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
172+
173+
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
174+
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
175+
-I$(CURDIR)/$(BUILD)
176+
177+
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
178+
179+
ifeq ($(strip $(ICON)),)
180+
icons := $(wildcard *.png)
181+
ifneq (,$(findstring $(TARGET).png,$(icons)))
182+
export APP_ICON := $(TOPDIR)/$(TARGET).png
183+
else
184+
ifneq (,$(findstring icon.png,$(icons)))
185+
export APP_ICON := $(TOPDIR)/icon.png
186+
endif
187+
endif
188+
else
189+
export APP_ICON := $(TOPDIR)/$(ICON)
190+
endif
191+
192+
ifeq ($(strip $(NO_SMDH)),)
193+
export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh
194+
endif
195+
196+
.PHONY: $(BUILD) clean all
197+
198+
#---------------------------------------------------------------------------------
199+
all: $(BUILD)
200+
201+
$(BUILD):
202+
@[ -d $@ ] || mkdir -p $@
203+
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
204+
205+
#---------------------------------------------------------------------------------
206+
clean:
207+
@echo clean ...
208+
@rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf
209+
210+
211+
#---------------------------------------------------------------------------------
212+
else
213+
214+
DEPENDS := $(OFILES:.o=.d)
215+
216+
#---------------------------------------------------------------------------------
217+
# main targets
218+
#---------------------------------------------------------------------------------
219+
ifeq ($(strip $(NO_SMDH)),)
220+
$(OUTPUT).3dsx : $(OUTPUT).elf $(OUTPUT).smdh
221+
else
222+
$(OUTPUT).3dsx : $(OUTPUT).elf
223+
endif
224+
$(OUTPUT).elf : $(OFILES)
225+
226+
#---------------------------------------------------------------------------------
227+
# you need a rule like this for each extension you use as binary data
228+
#---------------------------------------------------------------------------------
229+
%.bin.o : %.bin
230+
#---------------------------------------------------------------------------------
231+
@echo $(notdir $<)
232+
@$(bin2o)
233+
234+
# WARNING: This is not the right way to do this! TODO: Do it right!
235+
#---------------------------------------------------------------------------------
236+
%.vsh.o : %.vsh
237+
#---------------------------------------------------------------------------------
238+
@echo $(notdir $<)
239+
@python $(AEMSTRO)/aemstro_as.py $< ../$(notdir $<).shbin
240+
@bin2s ../$(notdir $<).shbin | $(PREFIX)as -o $@
241+
@echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h
242+
@echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h
243+
@echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h
244+
@rm ../$(notdir $<).shbin
245+
246+
-include $(DEPENDS)
247+
248+
#---------------------------------------------------------------------------------------
249+
endif
250+
#---------------------------------------------------------------------------------------

icon.png

1.4 KB
Loading

0 commit comments

Comments
 (0)