Skip to content

Commit

Permalink
Initial wood rpg code V1.25
Browse files Browse the repository at this point in the history
To be compiled with devKitARM r32
  • Loading branch information
ahezard committed Jul 2, 2016
1 parent d710b8a commit 75e7a61
Show file tree
Hide file tree
Showing 617 changed files with 1,253,908 additions and 0 deletions.
121 changes: 121 additions & 0 deletions akloader/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
endif

include $(DEVKITARM)/ds_rules

export TARGET := $(shell basename $(CURDIR))
export TOPDIR := $(CURDIR)


#---------------------------------------------------------------------------------
# path to tools - this can be deleted if you set the path in windows
#---------------------------------------------------------------------------------
export PATH := $(DEVKITARM)/bin:$(PATH)

.PHONY: arm7/rpg/$(TARGET).arm7 arm9/rpg/$(TARGET).arm9
.PHONY: arm7/r4/$(TARGET).arm7 arm9/r4/$(TARGET).arm9
.PHONY: arm7/ak2i/$(TARGET).arm7 arm9/ak2i/$(TARGET).arm9
.PHONY: arm7/r4idsn/$(TARGET).arm7 arm9/r4idsn/$(TARGET).arm9
.PHONY: all rpg r4 ak2i r4idsn clean

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
all: rpg r4

#---------------------------------------------------------------------------------
# rpg target
#---------------------------------------------------------------------------------
rpg: $(TARGET)_rpg.nds

#---------------------------------------------------------------------------------
# r4 target
#---------------------------------------------------------------------------------
r4: $(TARGET)_r4.nds

#---------------------------------------------------------------------------------
# ak2i target
#---------------------------------------------------------------------------------
ak2i: $(TARGET)_ak2i.nds

#---------------------------------------------------------------------------------
# r4idsn target
#---------------------------------------------------------------------------------
r4idsn: $(TARGET)_r4idsn.nds

#---------------------------------------------------------------------------------
$(TARGET)_rpg.nds : arm7/rpg/$(TARGET).arm7 arm9/rpg/$(TARGET).arm9
ndstool -c $(TARGET)_rpg.nds -7 arm7/rpg/$(TARGET).arm7 -9 arm9/rpg/$(TARGET).arm9 -e9 0x023c0000 -e7 0x023fa000
# ndstool -c $(TARGET).nds -9 $(TARGET).arm9 -7 $(TARGET).arm7 -b unknown_nds.bmp "new flash card;www.acekard.com" -r9 0x02200000 -e9 0x02204000 -e7 0x023fc000 -h 0x4000 -g ACEK AK ACEKARDBOOT -n 0x00586400 0x001808F8
mkdir -p ../akmenu4/arm9/data/rpg
cp arm7/rpg/$(TARGET).arm7 ../akmenu4/arm9/data/rpg/akloader_arm7.bin
cp arm9/rpg/$(TARGET).arm9 ../akmenu4/arm9/data/rpg/akloader_arm9.bin

#---------------------------------------------------------------------------------
arm7/rpg/$(TARGET).arm7:
$(MAKE) -C arm7

#---------------------------------------------------------------------------------
arm9/rpg/$(TARGET).arm9:
$(MAKE) -C arm9

#---------------------------------------------------------------------------------
$(TARGET)_r4.nds : arm7/r4/$(TARGET).arm7 arm9/r4/$(TARGET).arm9
ndstool -c $(TARGET)_r4.nds -7 arm7/r4/$(TARGET).arm7 -9 arm9/r4/$(TARGET).arm9 -e9 0x023c0000 -e7 0x023fa000
mkdir -p ../akmenu4/arm9/data/r4
cp arm7/r4/$(TARGET).arm7 ../akmenu4/arm9/data/r4/akloader_arm7.bin
cp arm9/r4/$(TARGET).arm9 ../akmenu4/arm9/data/r4/akloader_arm9.bin

#---------------------------------------------------------------------------------
arm7/r4/$(TARGET).arm7:
$(MAKE) -C arm7 STORAGE=r4

#---------------------------------------------------------------------------------
arm9/r4/$(TARGET).arm9:
$(MAKE) -C arm9 STORAGE=r4

#---------------------------------------------------------------------------------
$(TARGET)_ak2i.nds : arm7/ak2i/$(TARGET).arm7 arm9/ak2i/$(TARGET).arm9
ndstool -c $(TARGET)_ak2i.nds -7 arm7/ak2i/$(TARGET).arm7 -9 arm9/ak2i/$(TARGET).arm9 -e9 0x023c0000 -e7 0x023fa000
mkdir -p ../akmenu4/arm9/data/ak2i
cp arm7/ak2i/$(TARGET).arm7 ../akmenu4/arm9/data/ak2i/akloader_arm7.bin
cp arm9/ak2i/$(TARGET).arm9 ../akmenu4/arm9/data/ak2i/akloader_arm9.bin

#---------------------------------------------------------------------------------
arm7/ak2i/$(TARGET).arm7:
$(MAKE) -C arm7 STORAGE=ak2i

#---------------------------------------------------------------------------------
arm9/ak2i/$(TARGET).arm9:
$(MAKE) -C arm9 STORAGE=ak2i

#---------------------------------------------------------------------------------
$(TARGET)_r4idsn.nds : arm7/r4idsn/$(TARGET).arm7 arm9/r4idsn/$(TARGET).arm9
ndstool -c $(TARGET)_r4idsn.nds -7 arm7/r4idsn/$(TARGET).arm7 -9 arm9/r4idsn/$(TARGET).arm9 -e9 0x023c0000 -e7 0x023fa000
mkdir -p ../akmenu4/arm9/data/r4idsn
cp arm7/r4idsn/$(TARGET).arm7 ../akmenu4/arm9/data/r4idsn/akloader_arm7.bin
cp arm9/r4idsn/$(TARGET).arm9 ../akmenu4/arm9/data/r4idsn/akloader_arm9.bin

#---------------------------------------------------------------------------------
arm7/r4idsn/$(TARGET).arm7:
$(MAKE) -C arm7 STORAGE=r4idsn

#---------------------------------------------------------------------------------
arm9/r4idsn/$(TARGET).arm9:
$(MAKE) -C arm9 STORAGE=r4idsn

#---------------------------------------------------------------------------------
clean:
$(MAKE) -C arm9 clean
$(MAKE) -C arm7 clean
$(MAKE) -C arm9 STORAGE=r4 clean
$(MAKE) -C arm7 STORAGE=r4 clean
$(MAKE) -C arm9 STORAGE=ak2i clean
$(MAKE) -C arm7 STORAGE=ak2i clean
$(MAKE) -C arm9 STORAGE=r4idsn clean
$(MAKE) -C arm7 STORAGE=r4idsn clean
rm -f $(TARGET)_rpg.nds $(TARGET)_r4.nds $(TARGET)_ak2i.nds $(TARGET)_r4idsn.nds
134 changes: 134 additions & 0 deletions akloader/arm7/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif

include $(DEVKITARM)/ds_rules

#---------------------------------------------------------------------------------
# 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
# all directories are relative to this makefile
#---------------------------------------------------------------------------------
STORAGE ?= rpg
BUILD := $(STORAGE)/build
SOURCES := source
INCLUDES := include $(BUILD)
DATA := data

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -mthumb
#-mthumb-interwork

CFLAGS := -g -Wall -Os\
-mcpu=arm7tdmi -mtune=arm7tdmi -fomit-frame-pointer\
-ffast-math \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM7 -fno-dwarf2-cfi-asm
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -fno-rtti --ansi


ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=../../specs/ds_arm7.specs -g $(ARCH) -mno-fpu -Wl,-Map,$(notdir $*).map

LIBS := -lunds7

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBUNDS)


#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(notdir $(BUILD)),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export ARM7BIN := $(CURDIR)/$(STORAGE)/$(TARGET).arm7
export ARM7ELF := $(CURDIR)/$(STORAGE)/$(TARGET).arm7.elf
export DEPSDIR := $(CURDIR)/$(BUILD)

export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))

CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

export OFILES := $(addsuffix .o,$(BINFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)

export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)

export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(STORAGE) *.elf


#---------------------------------------------------------------------------------
else

DEPENDS := $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(ARM7BIN) : $(ARM7ELF)
@$(OBJCOPY) -O binary $< $@
@echo built ... $(notdir $@)


$(ARM7ELF) : $(OFILES)
@echo linking $(notdir $@)
@$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@


#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
%.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

-include $(DEPENDS)

#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
Loading

0 comments on commit 75e7a61

Please sign in to comment.