Mercurial > hg > index.fcgi > lj > lj046
view dsmakefile @ 1:38c62fded078
initial builds (linux and lj.nds)
author | paulo@localhost |
---|---|
date | Fri, 13 Mar 2009 01:10:13 -0700 |
parents | c84446dfb3f5 |
children |
line source
1 # Makefile for Nintendo DS version of LOCKJAW
2 #
3 # Copr. 2006-2007 Damian Yerrick
4 #
5 # This work is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 srcdir := src
20 objdir := obj/ds
21 EXE := $(objdir)/ljds.elf
22 EXE7 := $(objdir)/ljds7.elf
23 ASSETSFILE := $(objdir)/assets.s
24 ASSETS := $(srcdir)/text.chr $(srcdir)/gbablk.chr $(objdir)/vwfont.bin
25 ARMGCC=arm-eabi-gcc
26 ARMOBJ=arm-eabi-objcopy
27 CFLAGS7=-std=gnu99 -Wall -O2 -mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork
28 CFLAGS9=-std=gnu99 -Wall -O2 -mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer -ffast-math -mthumb-interwork -DDEBRIEF_SHORT -DHAS_FOPEN
29 LDLIBS9=-lfat -lnds9
30 NDSLIB_INCLUDE=$(DEVKITPRO)/libnds/include
31 NDSLIB_LIB=$(DEVKITPRO)/libnds/lib
32 DEPOBJS := \
33 $(objdir)/ljds.o $(objdir)/ljplay.o $(objdir)/lj.o \
34 $(objdir)/gimmicks.o $(objdir)/wktables.o $(objdir)/macro.o \
35 $(objdir)/gbaopt.o $(objdir)/speed.o $(objdir)/options.o \
36 $(objdir)/fontdraw.o $(objdir)/dssleep.o $(objdir)/random.o \
37 $(objdir)/ljlocale.o $(objdir)/debrief.o $(objdir)/dsdebrief.o \
38 $(objdir)/gbamenus.o $(objdir)/ljpath.o $(objdir)/dsjoy.o
39 OBJS := $(DEPOBJS) $(ASSETSFILE)
40 EMU := start
41 GAMEICON := docs/dsicon.bmp
43 CC := gcc
44 CFLAGS :=
46 # The wintermute-approved way to ensure devkitARM is in the PATH
47 ifeq ($(strip $(DEVKITPRO)),)
48 $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
49 endif
50 ifeq ($(strip $(DEVKITARM)),)
51 $(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
52 endif
53 export PATH := $(DEVKITARM)/bin:$(PATH)
55 .PHONY: run clean cf
57 run: lj.nds
58 $(EMU) $<
60 lj.nds: $(objdir)/ljds.bin $(objdir)/ljds7.bin $(GAMEICON)
61 ndstool -c $@ -9 $(objdir)/ljds.bin -7 $(objdir)/ljds7.bin -b $(GAMEICON) "LOCKJAW DS;The Soviet Mind Game"
63 %.nds.gba: %.nds
64 dsbuild $< -o $@
66 %.bin: %.elf
67 $(ARMOBJ) -O binary $< $@
69 $(EXE): $(OBJS)
70 $(ARMGCC) -g -mthumb-interwork -mno-fpu -specs=ds_arm9.specs $^ -L$(NDSLIB_LIB) $(LDLIBS9) -o $@
72 $(objdir)/ljds7.elf: $(objdir)/dsarm7.o $(objdir)/lookup_tables7.o $(objdir)/dssound7.o
73 $(ARMGCC) -g -mthumb-interwork -mno-fpu -specs=ds_arm7.specs $^ -L$(NDSLIB_LIB) -lnds7 -o $@
75 $(objdir)/%7.o: $(srcdir)/%7.c
76 $(ARMGCC) $(CFLAGS7) -I$(NDSLIB_INCLUDE) -MMD -DARM7 -c $< -o $@
77 @cp $(objdir)/$*.d $(objdir)/$*.P; \
78 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
79 -e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
80 rm -f $(objdir)/$*.d
82 $(objdir)/%.o: $(srcdir)/%.c $(srcdir)/ljds.h
83 $(ARMGCC) $(CFLAGS9) -I$(NDSLIB_INCLUDE) -MMD -DARM9 -c $< -o $@
84 @cp $(objdir)/$*.d $(objdir)/$*.P; \
85 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
86 -e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
87 rm -f $(objdir)/$*.d
89 %.o: %.s
90 $(ARMGCC) $(CFLAGS9) -I$(NDSLIB_INCLUDE) -MMD -DARM9 -c $< -o $@
91 @cp $(objdir)/$*.d $(objdir)/$*.P; \
92 sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
93 -e '/^$$/ d' -e 's/$$/ :/' < $(objdir)/$*.d >> $(objdir)/$*.P; \
94 rm -f $(objdir)/$*.d
96 $(ASSETSFILE): $(ASSETS)
97 bin2s $^ > $@
99 # Handle header dependencies
101 -include $(DEPOBJS:%.o=%.P)
102 # The master copy of the variable width font library is in another folder
104 src/fontdraw%: /e/games/ac/double/rac/src/fontdraw%
105 cp $< $@
107 #ejector is at http://jimprice.com/jim-soft.shtml#eject
108 #and is not necessary for building the program
109 cf: lj.nds
110 cp lj.nds /h/
111 ejector H:
113 # PC side rules
115 tools/fontconv.exe: tools/fontconv.o
116 # gcc -Wall -s $^ -lalleg -o $@
117 gcc -Wall -s $^ `allegro-config --libs` -o $@
119 tools/mktables.exe: tools/mktables.o
120 gcc -Wall -s $^ -o $@
122 tools/%.o: tools/%.c
123 gcc -Wall -O2 -std=gnu99 -c $< -o $@
125 $(objdir)/vwfont.bin: tools/fontconv.exe $(srcdir)/font.bmp
126 $^ $@
128 $(objdir)/lookup_tables7.s: tools/mktables.exe
129 $<
131 # Cleanup rules
133 clean:
134 -rm $(objdir)/*.s
135 -rm $(objdir)/*.o
136 -rm $(objdir)/*.P