-
Notifications
You must be signed in to change notification settings - Fork 2
/
dsmakefile
89 lines (74 loc) · 3.08 KB
/
dsmakefile
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
# Makefile for Nintendo DS version of LOCKJAW
#
# Copr. 2006-2007 Damian Yerrick
#
# This work is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
srcdir := src
objdir := obj/ds
EXE := $(objdir)/ljds.elf
EXE7 := $(objdir)/ljds7.elf
ASSETSFILE := $(objdir)/assets.s
ASSETS := $(srcdir)/text.chr $(srcdir)/gbablk.chr
ARMGCC=arm-eabi-gcc
ARMOBJ=arm-eabi-objcopy
CFLAGS7=-std=gnu99 -Wall -O2 -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork
CFLAGS9=-std=gnu99 -Wall -O2 -mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork
NDSLIB_INCLUDE=$(DEVKITPRO)/libnds/include
NDSLIB_LIB=$(DEVKITPRO)/libnds/lib
DEPOBJS := $(objdir)/ljds.o $(objdir)/ljplay.o $(objdir)/lj.o $(objdir)/gimmicks.o $(objdir)/wktables.o $(objdir)/macro.o $(objdir)/gbaopt.o
OBJS := $(DEPOBJS) $(ASSETSFILE)
EMU := /e/ds/dualis/dualis
GAMEICON := docs/dsicon.bmp
.PHONY: run clean cf
run: lj.nds
$(EMU) $<
lj.nds: $(objdir)/ljds.bin $(objdir)/ljds7.bin $(GAMEICON)
ndstool -c $@ -9 $(objdir)/ljds.bin -7 $(objdir)/ljds7.bin -b $(GAMEICON) "LOCKJAW DS;The Soviet Mind Game"
%.nds.gba: %.nds
dsbuild $< -o $@
%.bin: %.elf
$(ARMOBJ) -O binary $< $@
$(EXE): $(OBJS)
$(ARMGCC) -g -mthumb-interwork -mno-fpu -specs=ds_arm9.specs $^ -L$(NDSLIB_LIB) -lnds9 -o $@
$(objdir)/ljds7.elf: $(objdir)/dsarm7.o
$(ARMGCC) -g -mthumb-interwork -mno-fpu -specs=ds_arm7.specs $^ -L$(NDSLIB_LIB) -lnds7 -o $@
$(objdir)/%7.o: $(srcdir)/%7.c
$(ARMGCC) $(CFLAGS7) -I$(NDSLIB_INCLUDE) -MMD -DARM7 -c $< -o $@
@cp $(objdir)/$*.d $(objdir)/$*.P; \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
rm -f $(objdir)/$*.d
$(objdir)/%.o: $(srcdir)/%.c $(srcdir)/ljds.h
$(ARMGCC) $(CFLAGS9) -I$(NDSLIB_INCLUDE) -MMD -DARM9 -c $< -o $@
@cp $(objdir)/$*.d $(objdir)/$*.P; \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
rm -f $(objdir)/$*.d
%.o: %.s
$(ARMGCC) $(CFLAGS9) -I$(NDSLIB_INCLUDE) -MMD -DARM9 -c $< -o $@
@cp $(objdir)/$*.d $(objdir)/$*.P; \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
rm -f $(objdir)/$*.d
$(ASSETSFILE): $(ASSETS)
bin2s $^ > $@
cf: lj.nds
cp lj.nds /h/
ejector H:
clean:
-rm $(objdir)/*.s
-rm $(objdir)/*.o
-rm $(objdir)/*.P
-include $(DEPOBJS:%.o=%.P)