annotate gbamakefile @ 1:38c62fded078

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