paulo@0: # Makefile for Game Boy Advance version of LOCKJAW paulo@0: # paulo@0: # Copr. 2006-2007 Damian Yerrick paulo@0: # paulo@0: # This work is free software; you can redistribute it and/or modify paulo@0: # it under the terms of the GNU General Public License as published by paulo@0: # the Free Software Foundation; either version 2 of the License, or paulo@0: # (at your option) any later version. paulo@0: # paulo@0: # This program is distributed in the hope that it will be useful, paulo@0: # but WITHOUT ANY WARRANTY; without even the implied warranty of paulo@0: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the paulo@0: # GNU General Public License for more details. paulo@0: # paulo@0: # You should have received a copy of the GNU General Public License paulo@0: # along with this program; if not, write to the Free Software paulo@0: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA paulo@0: paulo@0: paulo@0: srcdir := src paulo@0: objdir := obj/gba paulo@0: EXE := $(objdir)/lj.elf paulo@0: ASSETSFILE := $(objdir)/assets.s paulo@0: INCGBA := -I$(DEVKITPRO)/libgba/include paulo@0: LIBGBA := -L$(DEVKITPRO)/libgba/lib -lgba paulo@0: THUMB_CFLAGS := -mthumb -Wall -O2 -std=gnu99 -mcpu=arm7tdmi \ paulo@0: -DFONTDRAW_SPLIT_COMPILE -DNO_DATETIME -DDEBRIEF_SHORT paulo@0: ARM_CFLAGS := -marm -Wall -O2 -std=gnu99 -mcpu=arm7tdmi \ paulo@0: -DFONTDRAW_SPLIT_COMPILE paulo@0: CC := arm-eabi-gcc -mthumb-interwork paulo@0: LD := arm-eabi-gcc -mthumb-interwork paulo@0: LDFLAGS := -mthumb -Wall -specs=gba_mb.specs paulo@0: paulo@0: MUSICOBJS := $(objdir)/gbasound.o $(objdir)/gbanotefreq.o paulo@0: MUSICLIBS := paulo@0: paulo@0: # The wintermute-approved way to ensure devkitARM is in the PATH paulo@0: ifeq ($(strip $(DEVKITPRO)),) paulo@0: $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPro) paulo@0: endif paulo@0: ifeq ($(strip $(DEVKITARM)),) paulo@0: $(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM) paulo@0: endif paulo@0: export PATH := $(DEVKITARM)/bin:$(PATH) paulo@0: paulo@0: # Objects paulo@0: paulo@0: LDLIBS := $(LIBGBA) paulo@0: DEPOBJS := \ paulo@0: $(objdir)/ljgba.o $(objdir)/gbaopt.o $(objdir)/gbaisr.iwram.o \ paulo@0: $(objdir)/ljplay.o $(objdir)/lj.o $(objdir)/speed.o $(objdir)/gimmicks.o \ paulo@0: $(objdir)/options.o $(objdir)/wktables.o $(objdir)/fontdraw.o \ paulo@0: $(objdir)/fontdraw.iwram.o $(objdir)/macro.o $(objdir)/random.o \ paulo@0: $(objdir)/gba_asm.o $(objdir)/ljlocale.o $(objdir)/debrief.o \ paulo@0: $(objdir)/dsdebrief.o $(objdir)/gbamenus.o $(objdir)/dsjoy.o \ paulo@0: $(MUSICOBJS) paulo@0: ASSETS := $(srcdir)/text.chr $(srcdir)/gbablk.chr $(objdir)/vwfont.bin paulo@0: #deleted: ljpc pcjoy options debrief ljreplay ljmusic paulo@0: paulo@0: OTHEROBJS := $(ASSETSFILE) paulo@0: paulo@0: run: lj.gba paulo@0: start $< paulo@0: paulo@0: #ejector is at http://jimprice.com/jim-soft.shtml#eject paulo@0: #and is not necessary for building the program paulo@0: cf: lj.gba paulo@0: cp lj.gba /h/gba/ paulo@0: ejector H: paulo@0: paulo@0: $(EXE): $(DEPOBJS) $(OTHEROBJS) paulo@0: $(LD) $(LDFLAGS) $^ $(MUSICLIBS) $(LDLIBS) -o $@ paulo@0: paulo@0: $(ASSETSFILE): $(ASSETS) paulo@0: bin2s $^ > $@ paulo@0: paulo@0: # Compilation rules paulo@0: paulo@0: %.gba: $(objdir)/%.elf paulo@0: arm-eabi-objcopy -O binary $< $@ paulo@0: gbafix -tLOCKJAW $@ paulo@0: paulo@0: $(objdir)/%.iwram.o: $(srcdir)/%.iwram.c paulo@0: $(CC) $(ARM_CFLAGS) -MMD -c -o $@ $< $(INCGBA) paulo@0: @cp $(objdir)/$*.iwram.d $(objdir)/$*.iwram.P; \ paulo@0: sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ paulo@0: -e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.iwram.d >> $(objdir)/$*.iwram.P; \ paulo@0: rm -f $(objdir)/$*.iwram.d paulo@0: paulo@0: $(objdir)/%.o: $(srcdir)/%.c paulo@0: $(CC) $(THUMB_CFLAGS) -MMD -c -o $@ $< $(INCGBA) paulo@0: @cp $(objdir)/$*.d $(objdir)/$*.P; \ paulo@0: sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ paulo@0: -e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \ paulo@0: rm -f $(objdir)/$*.d paulo@0: paulo@0: $(objdir)/%.o: $(srcdir)/%.s paulo@0: $(CC) -MMD -c -o $@ $< $(INCGBA) paulo@0: @cp $(objdir)/$*.d $(objdir)/$*.P; \ paulo@0: sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ paulo@0: -e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \ paulo@0: rm -f $(objdir)/$*.d paulo@0: paulo@0: $(objdir)/%.o: $(objdir)/%.s paulo@0: $(CC) -c -o $@ $< paulo@0: paulo@0: # The master copy of the variable width font library is in another folder paulo@0: paulo@0: src/fontdraw%: /e/games/ac/double/rac/src/fontdraw% paulo@0: cp $< $@ paulo@0: paulo@0: src/font.bmp: /e/games/ac/double/rac/src/font.bmp paulo@0: cp $< $@ paulo@0: paulo@0: $(objdir)/vwfont.bin: tools/fontconv.exe $(srcdir)/font.bmp paulo@0: $^ $@ paulo@0: paulo@0: tools/fontconv.exe: tools/fontconv.o paulo@0: gcc -Wall -s $^ -lalleg -o $@ paulo@0: paulo@0: tools/%.o: tools/%.c paulo@0: gcc -Wall -O2 -std=gnu99 -c $< -o $@ paulo@0: paulo@0: # Header dependencies paulo@0: paulo@0: -include $(DEPOBJS:%.o=%.P) paulo@0: paulo@0: paulo@0: # Cleanup rules paulo@0: .PHONY: clean run cf paulo@0: paulo@0: clean: paulo@0: -rm $(objdir)/*.s paulo@0: -rm $(objdir)/*.o paulo@0: -rm $(objdir)/*.P