annotate dsmakefile @ 2:80a2761bd3a4

change DS keys (add alt. rotate)
author paulo@localhost
date Mon, 23 Mar 2009 01:19:12 -0700
parents c84446dfb3f5
children
rev   line source
paulo@0 1 # Makefile for Nintendo DS 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 srcdir := src
paulo@0 20 objdir := obj/ds
paulo@0 21 EXE := $(objdir)/ljds.elf
paulo@0 22 EXE7 := $(objdir)/ljds7.elf
paulo@0 23 ASSETSFILE := $(objdir)/assets.s
paulo@0 24 ASSETS := $(srcdir)/text.chr $(srcdir)/gbablk.chr $(objdir)/vwfont.bin
paulo@0 25 ARMGCC=arm-eabi-gcc
paulo@0 26 ARMOBJ=arm-eabi-objcopy
paulo@0 27 CFLAGS7=-std=gnu99 -Wall -O2 -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork
paulo@0 28 CFLAGS9=-std=gnu99 -Wall -O2 -mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork -DDEBRIEF_SHORT -DHAS_FOPEN
paulo@0 29 LDLIBS9=-lfat -lnds9
paulo@0 30 NDSLIB_INCLUDE=$(DEVKITPRO)/libnds/include
paulo@0 31 NDSLIB_LIB=$(DEVKITPRO)/libnds/lib
paulo@0 32 DEPOBJS := \
paulo@0 33 $(objdir)/ljds.o $(objdir)/ljplay.o $(objdir)/lj.o \
paulo@0 34 $(objdir)/gimmicks.o $(objdir)/wktables.o $(objdir)/macro.o \
paulo@0 35 $(objdir)/gbaopt.o $(objdir)/speed.o $(objdir)/options.o \
paulo@0 36 $(objdir)/fontdraw.o $(objdir)/dssleep.o $(objdir)/random.o \
paulo@0 37 $(objdir)/ljlocale.o $(objdir)/debrief.o $(objdir)/dsdebrief.o \
paulo@0 38 $(objdir)/gbamenus.o $(objdir)/ljpath.o $(objdir)/dsjoy.o
paulo@0 39 OBJS := $(DEPOBJS) $(ASSETSFILE)
paulo@0 40 EMU := start
paulo@0 41 GAMEICON := docs/dsicon.bmp
paulo@0 42
paulo@0 43 CC := gcc
paulo@0 44 CFLAGS :=
paulo@0 45
paulo@0 46 # The wintermute-approved way to ensure devkitARM is in the PATH
paulo@0 47 ifeq ($(strip $(DEVKITPRO)),)
paulo@0 48 $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
paulo@0 49 endif
paulo@0 50 ifeq ($(strip $(DEVKITARM)),)
paulo@0 51 $(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
paulo@0 52 endif
paulo@0 53 export PATH := $(DEVKITARM)/bin:$(PATH)
paulo@0 54
paulo@0 55 .PHONY: run clean cf
paulo@0 56
paulo@0 57 run: lj.nds
paulo@0 58 $(EMU) $<
paulo@0 59
paulo@0 60 lj.nds: $(objdir)/ljds.bin $(objdir)/ljds7.bin $(GAMEICON)
paulo@0 61 ndstool -c $@ -9 $(objdir)/ljds.bin -7 $(objdir)/ljds7.bin -b $(GAMEICON) "LOCKJAW DS;The Soviet Mind Game"
paulo@0 62
paulo@0 63 %.nds.gba: %.nds
paulo@0 64 dsbuild $< -o $@
paulo@0 65
paulo@0 66 %.bin: %.elf
paulo@0 67 $(ARMOBJ) -O binary $< $@
paulo@0 68
paulo@0 69 $(EXE): $(OBJS)
paulo@0 70 $(ARMGCC) -g -mthumb-interwork -mno-fpu -specs=ds_arm9.specs $^ -L$(NDSLIB_LIB) $(LDLIBS9) -o $@
paulo@0 71
paulo@0 72 $(objdir)/ljds7.elf: $(objdir)/dsarm7.o $(objdir)/lookup_tables7.o $(objdir)/dssound7.o
paulo@0 73 $(ARMGCC) -g -mthumb-interwork -mno-fpu -specs=ds_arm7.specs $^ -L$(NDSLIB_LIB) -lnds7 -o $@
paulo@0 74
paulo@0 75 $(objdir)/%7.o: $(srcdir)/%7.c
paulo@0 76 $(ARMGCC) $(CFLAGS7) -I$(NDSLIB_INCLUDE) -MMD -DARM7 -c $< -o $@
paulo@0 77 @cp $(objdir)/$*.d $(objdir)/$*.P; \
paulo@0 78 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
paulo@0 79 -e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
paulo@0 80 rm -f $(objdir)/$*.d
paulo@0 81
paulo@0 82 $(objdir)/%.o: $(srcdir)/%.c $(srcdir)/ljds.h
paulo@0 83 $(ARMGCC) $(CFLAGS9) -I$(NDSLIB_INCLUDE) -MMD -DARM9 -c $< -o $@
paulo@0 84 @cp $(objdir)/$*.d $(objdir)/$*.P; \
paulo@0 85 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
paulo@0 86 -e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
paulo@0 87 rm -f $(objdir)/$*.d
paulo@0 88
paulo@0 89 %.o: %.s
paulo@0 90 $(ARMGCC) $(CFLAGS9) -I$(NDSLIB_INCLUDE) -MMD -DARM9 -c $< -o $@
paulo@0 91 @cp $(objdir)/$*.d $(objdir)/$*.P; \
paulo@0 92 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
paulo@0 93 -e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
paulo@0 94 rm -f $(objdir)/$*.d
paulo@0 95
paulo@0 96 $(ASSETSFILE): $(ASSETS)
paulo@0 97 bin2s $^ > $@
paulo@0 98
paulo@0 99 # Handle header dependencies
paulo@0 100
paulo@0 101 -include $(DEPOBJS:%.o=%.P)
paulo@0 102 # The master copy of the variable width font library is in another folder
paulo@0 103
paulo@0 104 src/fontdraw%: /e/games/ac/double/rac/src/fontdraw%
paulo@0 105 cp $< $@
paulo@0 106
paulo@0 107 #ejector is at http://jimprice.com/jim-soft.shtml#eject
paulo@0 108 #and is not necessary for building the program
paulo@0 109 cf: lj.nds
paulo@0 110 cp lj.nds /h/
paulo@0 111 ejector H:
paulo@0 112
paulo@0 113 # PC side rules
paulo@0 114
paulo@0 115 tools/fontconv.exe: tools/fontconv.o
paulo@1 116 # gcc -Wall -s $^ -lalleg -o $@
paulo@1 117 gcc -Wall -s $^ `allegro-config --libs` -o $@
paulo@0 118
paulo@0 119 tools/mktables.exe: tools/mktables.o
paulo@0 120 gcc -Wall -s $^ -o $@
paulo@0 121
paulo@0 122 tools/%.o: tools/%.c
paulo@0 123 gcc -Wall -O2 -std=gnu99 -c $< -o $@
paulo@0 124
paulo@0 125 $(objdir)/vwfont.bin: tools/fontconv.exe $(srcdir)/font.bmp
paulo@0 126 $^ $@
paulo@0 127
paulo@0 128 $(objdir)/lookup_tables7.s: tools/mktables.exe
paulo@0 129 $<
paulo@0 130
paulo@0 131 # Cleanup rules
paulo@0 132
paulo@0 133 clean:
paulo@0 134 -rm $(objdir)/*.s
paulo@0 135 -rm $(objdir)/*.o
paulo@0 136 -rm $(objdir)/*.P
paulo@0 137