Armwrestler now uses standard devkitarm makefiles.

This commit is contained in:
normmatt234 2010-07-01 05:27:33 +00:00
parent 9535e3cff9
commit 705a26cf41
10 changed files with 187 additions and 16 deletions

View File

@ -0,0 +1,150 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA :=
GRAPHICS := gfx
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -mthumb -mthumb-interwork
CFLAGS := -g -Wall -O2\
-march=armv5te -fomit-frame-pointer\
-ffast-math \
$(ARCH)
CFLAGS += $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g -march=armv5te $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lnds9
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS)
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir)) \
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES := $(addsuffix .o,$(BINFILES)) \
$(PNGFILES:.png=.o) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
icons := $(wildcard *.bmp)
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
else
ifneq (,$(findstring icon.bmp,$(icons)))
export GAME_ICON := $(CURDIR)/icon.bmp
endif
endif
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES)
#---------------------------------------------------------------------------------
%.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(bin2o)
#---------------------------------------------------------------------------------
# This rule creates assembly source files using grit
# grit takes an image file and a .grit describing how the file is to be processed
# add additional rules like this for each image extension
# you use in the graphics folders
#---------------------------------------------------------------------------------
%.s %.h : %.png %.grit
#---------------------------------------------------------------------------------
grit $< -fts -o$*
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------

View File

@ -1,5 +0,0 @@
.arm
.include "armwrestler-ds.asm"
.include "thumbwrestler-ds.asm"

View File

@ -0,0 +1,2 @@
make
pause

View File

@ -1,10 +0,0 @@
arm-eabi-as -march=armv5te -mthumb -EL -o armwrestler9.o armwrestler9.asm
arm-eabi-ld -Ttext 0x02004000 -EL -e main armwrestler9.o
arm-eabi-objcopy -O binary a.out armwrestler.arm9
arm-eabi-as -mcpu=arm7tdmi -EL -o armwrestler-arm7.o armwrestler-arm7.asm
arm-eabi-ld -Ttext 0x3800000 -EL -e arm7_main armwrestler-arm7.o
arm-eabi-objcopy -O binary a.out armwrestler.arm7
ndstool -c armwrestler.nds -r9 0x2004000 -e9 0x2004000 -r7 0x3800000 -e7 0x3800000 -9 armwrestler.arm9 -7 armwrestler.arm7
del *.o
del a.out
pause

View File

@ -16,6 +16,7 @@
.equ BAD_Rd, 0x10
.equ BAD_Rn, 0x20
.global main
main:
@ -2621,7 +2622,7 @@ jumptable: .word Test0,Test1,Test2,Test3
.word Test8,Test9,Menu,TestTmb,TestTmb,TestTmb
.global font
font: .incbin "font8x8.pat"
font: .incbin "../data/font8x8.pat"
szADC: .asciz "ADC"
szADD: .asciz "ADD"

View File

@ -0,0 +1 @@
<Project name="template"><MagicFolder excludeFolders="CVS;.svn" filter="*.h" name="include" path="include\"></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*.c;*.cpp" name="source" path="source\"><File path="main.c"></File></MagicFolder><File path="Makefile"></File></Project>

View File

@ -0,0 +1,32 @@
[Project ID]
Signature=UE Proj: v.1
[Project Information]
Filter=*.*
Project Directory=C:\projects\devkitPro\test\nds_template\arm9\
Use Relative Directory=1
Relative to Project File=1
Project Wordfile=
Project Tagfile=
Create Tagfile=0
Include Sub Directories=0
[Files]
0=include\
1=Makefile
2=source\
[Group]
0=
[Open Files]
Open File0=C:\projects\devkitPro\examples\nds\templates\arm9\source\main.c
Active File Display Mode=3
Open File Pos0=751
Open File Line0=0
Active File Index=0
Open File Window Pos0=2,3,-1,-1,-4,-23,0,0,918,359
Open File1=C:\projects\devkitPro\examples\nds\templates\arm9\build\arm9.map
Open File Pos1=9864
Open File Line1=15129
Open File Window Pos1=0,1,-1,-1,-4,-23,22,22,944,385
Open File2=
[File View]
Current Select=Project Files\source\main.c
Scroll Position=0