diff dsmakefile @ 0:c84446dfb3f5

initial add
author paulo@localhost
date Fri, 13 Mar 2009 00:39:12 -0700
parents
children 38c62fded078
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dsmakefile	Fri Mar 13 00:39:12 2009 -0700
     1.3 @@ -0,0 +1,136 @@
     1.4 +# Makefile for Nintendo DS version of LOCKJAW
     1.5 +#
     1.6 +# Copr. 2006-2007 Damian Yerrick
     1.7 +# 
     1.8 +# This work is free software; you can redistribute it and/or modify
     1.9 +# it under the terms of the GNU General Public License as published by
    1.10 +# the Free Software Foundation; either version 2 of the License, or
    1.11 +# (at your option) any later version.
    1.12 +# 
    1.13 +# This program is distributed in the hope that it will be useful,
    1.14 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 +# GNU General Public License for more details.
    1.17 +# 
    1.18 +# You should have received a copy of the GNU General Public License
    1.19 +# along with this program; if not, write to the Free Software
    1.20 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.21 +
    1.22 +srcdir := src
    1.23 +objdir := obj/ds
    1.24 +EXE := $(objdir)/ljds.elf
    1.25 +EXE7 := $(objdir)/ljds7.elf
    1.26 +ASSETSFILE := $(objdir)/assets.s
    1.27 +ASSETS := $(srcdir)/text.chr $(srcdir)/gbablk.chr $(objdir)/vwfont.bin
    1.28 +ARMGCC=arm-eabi-gcc
    1.29 +ARMOBJ=arm-eabi-objcopy
    1.30 +CFLAGS7=-std=gnu99 -Wall -O2 -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork
    1.31 +CFLAGS9=-std=gnu99 -Wall -O2 -mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork -DDEBRIEF_SHORT -DHAS_FOPEN
    1.32 +LDLIBS9=-lfat -lnds9
    1.33 +NDSLIB_INCLUDE=$(DEVKITPRO)/libnds/include
    1.34 +NDSLIB_LIB=$(DEVKITPRO)/libnds/lib
    1.35 +DEPOBJS := \
    1.36 +$(objdir)/ljds.o $(objdir)/ljplay.o $(objdir)/lj.o \
    1.37 +$(objdir)/gimmicks.o $(objdir)/wktables.o $(objdir)/macro.o \
    1.38 +$(objdir)/gbaopt.o $(objdir)/speed.o $(objdir)/options.o \
    1.39 +$(objdir)/fontdraw.o $(objdir)/dssleep.o $(objdir)/random.o \
    1.40 +$(objdir)/ljlocale.o $(objdir)/debrief.o $(objdir)/dsdebrief.o \
    1.41 +$(objdir)/gbamenus.o $(objdir)/ljpath.o $(objdir)/dsjoy.o
    1.42 +OBJS := $(DEPOBJS) $(ASSETSFILE)
    1.43 +EMU := start
    1.44 +GAMEICON := docs/dsicon.bmp
    1.45 +
    1.46 +CC := gcc
    1.47 +CFLAGS := 
    1.48 +
    1.49 +# The wintermute-approved way to ensure devkitARM is in the PATH
    1.50 +ifeq ($(strip $(DEVKITPRO)),)
    1.51 +$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
    1.52 +endif
    1.53 +ifeq ($(strip $(DEVKITARM)),)
    1.54 +$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
    1.55 +endif
    1.56 +export PATH	:=	$(DEVKITARM)/bin:$(PATH)
    1.57 +
    1.58 +.PHONY: run clean cf
    1.59 +
    1.60 +run: lj.nds
    1.61 +	$(EMU) $<
    1.62 +
    1.63 +lj.nds: $(objdir)/ljds.bin $(objdir)/ljds7.bin $(GAMEICON)
    1.64 +	ndstool -c $@ -9 $(objdir)/ljds.bin -7 $(objdir)/ljds7.bin -b $(GAMEICON) "LOCKJAW DS;The Soviet Mind Game"
    1.65 +
    1.66 +%.nds.gba: %.nds
    1.67 +	dsbuild $< -o $@
    1.68 +
    1.69 +%.bin: %.elf
    1.70 +	$(ARMOBJ) -O binary $< $@
    1.71 +
    1.72 +$(EXE): $(OBJS)
    1.73 +	$(ARMGCC) -g -mthumb-interwork -mno-fpu -specs=ds_arm9.specs $^ -L$(NDSLIB_LIB) $(LDLIBS9) -o $@
    1.74 +
    1.75 +$(objdir)/ljds7.elf: $(objdir)/dsarm7.o $(objdir)/lookup_tables7.o $(objdir)/dssound7.o
    1.76 +	$(ARMGCC) -g -mthumb-interwork -mno-fpu -specs=ds_arm7.specs $^ -L$(NDSLIB_LIB) -lnds7 -o $@
    1.77 +
    1.78 +$(objdir)/%7.o: $(srcdir)/%7.c
    1.79 +	$(ARMGCC) $(CFLAGS7) -I$(NDSLIB_INCLUDE) -MMD -DARM7 -c $< -o $@
    1.80 +	@cp $(objdir)/$*.d $(objdir)/$*.P; \
    1.81 +	sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
    1.82 +	-e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
    1.83 +	rm -f $(objdir)/$*.d
    1.84 +
    1.85 +$(objdir)/%.o: $(srcdir)/%.c $(srcdir)/ljds.h
    1.86 +	$(ARMGCC) $(CFLAGS9) -I$(NDSLIB_INCLUDE) -MMD -DARM9 -c $< -o $@
    1.87 +	@cp $(objdir)/$*.d $(objdir)/$*.P; \
    1.88 +	sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
    1.89 +	-e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
    1.90 +	rm -f $(objdir)/$*.d
    1.91 +
    1.92 +%.o: %.s
    1.93 +	$(ARMGCC) $(CFLAGS9) -I$(NDSLIB_INCLUDE) -MMD -DARM9 -c $< -o $@
    1.94 +	@cp $(objdir)/$*.d $(objdir)/$*.P; \
    1.95 +	sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
    1.96 +	-e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
    1.97 +	rm -f $(objdir)/$*.d
    1.98 +
    1.99 +$(ASSETSFILE): $(ASSETS)
   1.100 +	bin2s $^ > $@
   1.101 +
   1.102 +# Handle header dependencies
   1.103 +
   1.104 +-include $(DEPOBJS:%.o=%.P)
   1.105 +# The master copy of the variable width font library is in another folder
   1.106 +
   1.107 +src/fontdraw%: /e/games/ac/double/rac/src/fontdraw%
   1.108 +	cp $< $@
   1.109 +
   1.110 +#ejector is at http://jimprice.com/jim-soft.shtml#eject
   1.111 +#and is not necessary for building the program
   1.112 +cf: lj.nds
   1.113 +	cp lj.nds /h/
   1.114 +	ejector H:
   1.115 +
   1.116 +# PC side rules
   1.117 +
   1.118 +tools/fontconv.exe: tools/fontconv.o
   1.119 +	gcc -Wall -s $^ -lalleg -o $@
   1.120 +
   1.121 +tools/mktables.exe: tools/mktables.o
   1.122 +	gcc -Wall -s $^ -o $@
   1.123 +
   1.124 +tools/%.o: tools/%.c
   1.125 +	gcc -Wall -O2 -std=gnu99 -c $< -o $@
   1.126 +
   1.127 +$(objdir)/vwfont.bin: tools/fontconv.exe $(srcdir)/font.bmp
   1.128 +	$^ $@
   1.129 +
   1.130 +$(objdir)/lookup_tables7.s: tools/mktables.exe
   1.131 +	$<
   1.132 +
   1.133 +# Cleanup rules
   1.134 +
   1.135 +clean:
   1.136 +	-rm $(objdir)/*.s
   1.137 +	-rm $(objdir)/*.o
   1.138 +	-rm $(objdir)/*.P
   1.139 +