diff --git a/Makefile b/Makefile index 30c1e58..5695ff5 100644 --- a/Makefile +++ b/Makefile @@ -22,12 +22,13 @@ GAME_SUBTITLE2 := www.acekard.com include $(DEVKITARM)/ds_rules -.PHONY: checkarm7 checkarm9 checkarm9_ak2 checkarm9_dsi clean +.PHONY: checkarm7 checkarm9 checkarm9_ak2 checkarm9_dsi checkarm9_m3 checkarm9_tt clean #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- -all: checkarm7 checkarm9 checkarm9_ak2 checkarm9_dsi checkarm9_tt $(TARGET).nds $(TARGET)_ak2.nds $(TARGET)_tt.nds $(TARGET).dsi +all: checkarm7 checkarm9 checkarm9_ak2 checkarm9_dsi checkarm9_m3 checkarm9_tt \ + $(TARGET).nds $(TARGET)_ak2.nds $(TARGET)_m3.nds $(TARGET)_tt.nds $(TARGET).dsi #--------------------------------------------------------------------------------- checkarm7: @@ -45,6 +46,10 @@ checkarm9_ak2: checkarm9_dsi: $(MAKE) -C arm9_dsi +#--------------------------------------------------------------------------------- +checkarm9_m3: + $(MAKE) -C arm9_m3 + #--------------------------------------------------------------------------------- checkarm9_tt: $(MAKE) -C arm9_tt @@ -61,6 +66,12 @@ $(TARGET)_ak2.nds : $(NITRO_FILES) arm7/$(TARGET).elf arm9_ak2/$(TARGET).elf -b $(GAME_ICON) "$(GAME_TITLE);$(GAME_SUBTITLE1);$(GAME_SUBTITLE2)" \ $(_ADDFILES) +#--------------------------------------------------------------------------------- +$(TARGET)_m3.nds : $(NITRO_FILES) arm7/$(TARGET).elf arm9_m3/$(TARGET).elf + ndstool -c $@ -7 arm7/$(TARGET).elf -9 arm9_m3/$(TARGET).elf \ + -b $(GAME_ICON) "$(GAME_TITLE);$(GAME_SUBTITLE1);$(GAME_SUBTITLE2)" \ + $(_ADDFILES) + #--------------------------------------------------------------------------------- $(TARGET)_tt.nds : $(NITRO_FILES) arm7/$(TARGET).elf arm9_tt/$(TARGET).elf ndstool -c $@ -7 arm7/$(TARGET).elf -9 arm9_tt/$(TARGET).elf \ @@ -89,6 +100,10 @@ arm9_ak2/$(TARGET).elf: arm9_dsi/$(TARGET).elf: $(MAKE) -C arm9_dsi +#--------------------------------------------------------------------------------- +arm9_m3/$(TARGET).elf: + $(MAKE) -C arm9_m3 + #--------------------------------------------------------------------------------- arm9_tt/$(TARGET).elf: $(MAKE) -C arm9_tt @@ -98,6 +113,7 @@ clean: $(MAKE) -C arm9 clean $(MAKE) -C arm9_ak2 clean $(MAKE) -C arm9_dsi clean + $(MAKE) -C arm9_m3 clean $(MAKE) -C arm9_tt clean $(MAKE) -C arm7 clean rm -f *.nds *.dsi diff --git a/arm9_m3/Makefile b/arm9_m3/Makefile new file mode 100644 index 0000000..aa9f57c --- /dev/null +++ b/arm9_m3/Makefile @@ -0,0 +1,141 @@ +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITARM)),) +$(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") +endif + +include $(DEVKITARM)/ds_rules + +SOURCE_PATH := ../arm9 +#--------------------------------------------------------------------------------- +# 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 +# all directories are relative to this makefile +#--------------------------------------------------------------------------------- +BUILD := build +SOURCES := $(SOURCE_PATH)/source $(SOURCE_PATH)/source/ui $(SOURCE_PATH)/source/font $(SOURCE_PATH)/source/launcher $(SOURCE_PATH)/source/launcher/libfat_ext $(SOURCE_PATH)/source/saves +INCLUDES := $(SOURCE_PATH)/include ../share $(SOURCES) +DATA := $(SOURCE_PATH)/data ../data +GRAPHICS := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s + +CFLAGS := -g -Wall -O3\ + $(ARCH) $(INCLUDE) -DARM9 + +CFLAGS += -D_NO_BOOTSTUB_ -D__KERNEL_LAUNCHER_SUPPORT__ -D__TTLAUNCHER__ -D__TTLAUNCHER_M3__ + +CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions +ASFLAGS := -g $(ARCH) $(INCLUDE) +LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lfat -lnds9 + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(LIBNDS) $(PORTLIBS) + +#--------------------------------------------------------------------------------- +# 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 ARM9ELF := $(CURDIR)/$(TARGET).elf + +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_BIN := $(addsuffix .o,$(BINFILES)) + +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) + +export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES) + +export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES))) + +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) + +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(TARGET).elf + + +#--------------------------------------------------------------------------------- +else + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(ARM9ELF) : $(OFILES) + @echo linking $(notdir $@) + @$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@ + +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.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 +#---------------------------------------------------------------------------------------