comparison gbamakefile @ 1:38c62fded078

initial builds (linux and lj.nds)
author paulo@localhost
date Fri, 13 Mar 2009 01:10:13 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:2f250027ea1a
1 # Makefile for Game Boy Advance version of LOCKJAW
2 #
3 # Copr. 2006-2007 Damian Yerrick
4 #
5 # This work is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19
20 srcdir := src
21 objdir := obj/gba
22 EXE := $(objdir)/lj.elf
23 ASSETSFILE := $(objdir)/assets.s
24 INCGBA := -I$(DEVKITPRO)/libgba/include
25 LIBGBA := -L$(DEVKITPRO)/libgba/lib -lgba
26 THUMB_CFLAGS := -mthumb -Wall -O2 -std=gnu99 -mcpu=arm7tdmi \
27 -DFONTDRAW_SPLIT_COMPILE -DNO_DATETIME -DDEBRIEF_SHORT
28 ARM_CFLAGS := -marm -Wall -O2 -std=gnu99 -mcpu=arm7tdmi \
29 -DFONTDRAW_SPLIT_COMPILE
30 CC := arm-eabi-gcc -mthumb-interwork
31 LD := arm-eabi-gcc -mthumb-interwork
32 LDFLAGS := -mthumb -Wall -specs=gba_mb.specs
33
34 MUSICOBJS := $(objdir)/gbasound.o $(objdir)/gbanotefreq.o
35 MUSICLIBS :=
36
37 # The wintermute-approved way to ensure devkitARM is in the PATH
38 ifeq ($(strip $(DEVKITPRO)),)
39 $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
40 endif
41 ifeq ($(strip $(DEVKITARM)),)
42 $(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
43 endif
44 export PATH := $(DEVKITARM)/bin:$(PATH)
45
46 # Objects
47
48 LDLIBS := $(LIBGBA)
49 DEPOBJS := \
50 $(objdir)/ljgba.o $(objdir)/gbaopt.o $(objdir)/gbaisr.iwram.o \
51 $(objdir)/ljplay.o $(objdir)/lj.o $(objdir)/speed.o $(objdir)/gimmicks.o \
52 $(objdir)/options.o $(objdir)/wktables.o $(objdir)/fontdraw.o \
53 $(objdir)/fontdraw.iwram.o $(objdir)/macro.o $(objdir)/random.o \
54 $(objdir)/gba_asm.o $(objdir)/ljlocale.o $(objdir)/debrief.o \
55 $(objdir)/dsdebrief.o $(objdir)/gbamenus.o $(objdir)/dsjoy.o \
56 $(MUSICOBJS)
57 ASSETS := $(srcdir)/text.chr $(srcdir)/gbablk.chr $(objdir)/vwfont.bin
58 #deleted: ljpc pcjoy options debrief ljreplay ljmusic
59
60 OTHEROBJS := $(ASSETSFILE)
61
62 run: lj.gba
63 start $<
64
65 #ejector is at http://jimprice.com/jim-soft.shtml#eject
66 #and is not necessary for building the program
67 cf: lj.gba
68 cp lj.gba /h/gba/
69 ejector H:
70
71 $(EXE): $(DEPOBJS) $(OTHEROBJS)
72 $(LD) $(LDFLAGS) $^ $(MUSICLIBS) $(LDLIBS) -o $@
73
74 $(ASSETSFILE): $(ASSETS)
75 bin2s $^ > $@
76
77 # Compilation rules
78
79 %.gba: $(objdir)/%.elf
80 arm-eabi-objcopy -O binary $< $@
81 gbafix -tLOCKJAW $@
82
83 $(objdir)/%.iwram.o: $(srcdir)/%.iwram.c
84 $(CC) $(ARM_CFLAGS) -MMD -c -o $@ $< $(INCGBA)
85 @cp $(objdir)/$*.iwram.d $(objdir)/$*.iwram.P; \
86 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
87 -e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.iwram.d >> $(objdir)/$*.iwram.P; \
88 rm -f $(objdir)/$*.iwram.d
89
90 $(objdir)/%.o: $(srcdir)/%.c
91 $(CC) $(THUMB_CFLAGS) -MMD -c -o $@ $< $(INCGBA)
92 @cp $(objdir)/$*.d $(objdir)/$*.P; \
93 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
94 -e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
95 rm -f $(objdir)/$*.d
96
97 $(objdir)/%.o: $(srcdir)/%.s
98 $(CC) -MMD -c -o $@ $< $(INCGBA)
99 @cp $(objdir)/$*.d $(objdir)/$*.P; \
100 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
101 -e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
102 rm -f $(objdir)/$*.d
103
104 $(objdir)/%.o: $(objdir)/%.s
105 $(CC) -c -o $@ $<
106
107 # The master copy of the variable width font library is in another folder
108
109 src/fontdraw%: /e/games/ac/double/rac/src/fontdraw%
110 cp $< $@
111
112 src/font.bmp: /e/games/ac/double/rac/src/font.bmp
113 cp $< $@
114
115 $(objdir)/vwfont.bin: tools/fontconv.exe $(srcdir)/font.bmp
116 $^ $@
117
118 tools/fontconv.exe: tools/fontconv.o
119 gcc -Wall -s $^ -lalleg -o $@
120
121 tools/%.o: tools/%.c
122 gcc -Wall -O2 -std=gnu99 -c $< -o $@
123
124 # Header dependencies
125
126 -include $(DEPOBJS:%.o=%.P)
127
128
129 # Cleanup rules
130 .PHONY: clean run cf
131
132 clean:
133 -rm $(objdir)/*.s
134 -rm $(objdir)/*.o
135 -rm $(objdir)/*.P