paulo@0: # Makefile for Nintendo DS 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: srcdir := src paulo@0: objdir := obj/ds paulo@0: EXE := $(objdir)/ljds.elf paulo@0: EXE7 := $(objdir)/ljds7.elf paulo@0: ASSETSFILE := $(objdir)/assets.s paulo@0: ASSETS := $(srcdir)/text.chr $(srcdir)/gbablk.chr $(objdir)/vwfont.bin paulo@0: ARMGCC=arm-eabi-gcc paulo@0: ARMOBJ=arm-eabi-objcopy paulo@0: CFLAGS7=-std=gnu99 -Wall -O2 -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork paulo@0: CFLAGS9=-std=gnu99 -Wall -O2 -mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork -DDEBRIEF_SHORT -DHAS_FOPEN paulo@0: LDLIBS9=-lfat -lnds9 paulo@0: NDSLIB_INCLUDE=$(DEVKITPRO)/libnds/include paulo@0: NDSLIB_LIB=$(DEVKITPRO)/libnds/lib paulo@0: DEPOBJS := \ paulo@0: $(objdir)/ljds.o $(objdir)/ljplay.o $(objdir)/lj.o \ paulo@0: $(objdir)/gimmicks.o $(objdir)/wktables.o $(objdir)/macro.o \ paulo@0: $(objdir)/gbaopt.o $(objdir)/speed.o $(objdir)/options.o \ paulo@0: $(objdir)/fontdraw.o $(objdir)/dssleep.o $(objdir)/random.o \ paulo@0: $(objdir)/ljlocale.o $(objdir)/debrief.o $(objdir)/dsdebrief.o \ paulo@0: $(objdir)/gbamenus.o $(objdir)/ljpath.o $(objdir)/dsjoy.o paulo@0: OBJS := $(DEPOBJS) $(ASSETSFILE) paulo@0: EMU := start paulo@0: GAMEICON := docs/dsicon.bmp paulo@0: paulo@0: CC := gcc paulo@0: CFLAGS := 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: .PHONY: run clean cf paulo@0: paulo@0: run: lj.nds paulo@0: $(EMU) $< paulo@0: paulo@0: lj.nds: $(objdir)/ljds.bin $(objdir)/ljds7.bin $(GAMEICON) paulo@0: ndstool -c $@ -9 $(objdir)/ljds.bin -7 $(objdir)/ljds7.bin -b $(GAMEICON) "LOCKJAW DS;The Soviet Mind Game" paulo@0: paulo@0: %.nds.gba: %.nds paulo@0: dsbuild $< -o $@ paulo@0: paulo@0: %.bin: %.elf paulo@0: $(ARMOBJ) -O binary $< $@ paulo@0: paulo@0: $(EXE): $(OBJS) paulo@0: $(ARMGCC) -g -mthumb-interwork -mno-fpu -specs=ds_arm9.specs $^ -L$(NDSLIB_LIB) $(LDLIBS9) -o $@ paulo@0: paulo@0: $(objdir)/ljds7.elf: $(objdir)/dsarm7.o $(objdir)/lookup_tables7.o $(objdir)/dssound7.o paulo@0: $(ARMGCC) -g -mthumb-interwork -mno-fpu -specs=ds_arm7.specs $^ -L$(NDSLIB_LIB) -lnds7 -o $@ paulo@0: paulo@0: $(objdir)/%7.o: $(srcdir)/%7.c paulo@0: $(ARMGCC) $(CFLAGS7) -I$(NDSLIB_INCLUDE) -MMD -DARM7 -c $< -o $@ 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)/%.c $(srcdir)/ljds.h paulo@0: $(ARMGCC) $(CFLAGS9) -I$(NDSLIB_INCLUDE) -MMD -DARM9 -c $< -o $@ 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: %.o: %.s paulo@0: $(ARMGCC) $(CFLAGS9) -I$(NDSLIB_INCLUDE) -MMD -DARM9 -c $< -o $@ 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: $(ASSETSFILE): $(ASSETS) paulo@0: bin2s $^ > $@ paulo@0: paulo@0: # Handle header dependencies paulo@0: paulo@0: -include $(DEPOBJS:%.o=%.P) 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: #ejector is at http://jimprice.com/jim-soft.shtml#eject paulo@0: #and is not necessary for building the program paulo@0: cf: lj.nds paulo@0: cp lj.nds /h/ paulo@0: ejector H: paulo@0: paulo@0: # PC side rules paulo@0: paulo@0: tools/fontconv.exe: tools/fontconv.o paulo@0: gcc -Wall -s $^ -lalleg -o $@ paulo@0: paulo@0: tools/mktables.exe: tools/mktables.o paulo@0: gcc -Wall -s $^ -o $@ paulo@0: paulo@0: tools/%.o: tools/%.c paulo@0: gcc -Wall -O2 -std=gnu99 -c $< -o $@ paulo@0: paulo@0: $(objdir)/vwfont.bin: tools/fontconv.exe $(srcdir)/font.bmp paulo@0: $^ $@ paulo@0: paulo@0: $(objdir)/lookup_tables7.s: tools/mktables.exe paulo@0: $< paulo@0: paulo@0: # Cleanup rules paulo@0: paulo@0: clean: paulo@0: -rm $(objdir)/*.s paulo@0: -rm $(objdir)/*.o paulo@0: -rm $(objdir)/*.P paulo@0: