Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cc40a1daad | ||
![]() |
0159fb67bf | ||
![]() |
f834dd6bcb | ||
![]() |
2089aab7f9 | ||
![]() |
45eacf3336 | ||
![]() |
e4fd0ba9b6 | ||
![]() |
dc1de0cd56 |
6
Makefile
@ -83,16 +83,16 @@ WARNFLAGS := -Wall -Wextra
|
|||||||
INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \
|
INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \
|
||||||
$(foreach path,$(LIBDIRS),-I$(path)/include)
|
$(foreach path,$(LIBDIRS),-I$(path)/include)
|
||||||
|
|
||||||
ASFLAGS += -x assembler-with-cpp $(DEFINES) $(ARCH) \
|
ASFLAGS += -g -x assembler-with-cpp $(DEFINES) $(ARCH) \
|
||||||
-mthumb -mthumb-interwork $(INCLUDEFLAGS) \
|
-mthumb -mthumb-interwork $(INCLUDEFLAGS) \
|
||||||
-ffunction-sections -fdata-sections
|
-ffunction-sections -fdata-sections
|
||||||
|
|
||||||
CFLAGS += -std=gnu11 $(WARNFLAGS) $(DEFINES) $(ARCH) \
|
CFLAGS += -g -std=gnu11 $(WARNFLAGS) $(DEFINES) $(ARCH) \
|
||||||
-mthumb -mthumb-interwork $(INCLUDEFLAGS) -O2 \
|
-mthumb -mthumb-interwork $(INCLUDEFLAGS) -O2 \
|
||||||
-ffunction-sections -fdata-sections \
|
-ffunction-sections -fdata-sections \
|
||||||
-fomit-frame-pointer
|
-fomit-frame-pointer
|
||||||
|
|
||||||
CXXFLAGS += -std=gnu++14 $(WARNFLAGS) $(DEFINES) $(ARCH) \
|
CXXFLAGS += -g -std=gnu++14 $(WARNFLAGS) $(DEFINES) $(ARCH) \
|
||||||
-mthumb -mthumb-interwork $(INCLUDEFLAGS) -O2 \
|
-mthumb -mthumb-interwork $(INCLUDEFLAGS) -O2 \
|
||||||
-ffunction-sections -fdata-sections \
|
-ffunction-sections -fdata-sections \
|
||||||
-fno-exceptions -fno-rtti \
|
-fno-exceptions -fno-rtti \
|
||||||
|
124
Makefile.dkp
@ -1,124 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.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
|
|
||||||
# DATA is a list of directories containing data files
|
|
||||||
# INCLUDES is a list of directories containing header files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := nflib
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
DATA := data
|
|
||||||
INCLUDES := include
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -mthumb -mthumb-interwork
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O2\
|
|
||||||
-march=armv5te -mtune=arm946e-s \
|
|
||||||
-fomit-frame-pointer -ffast-math \
|
|
||||||
$(ARCH)
|
|
||||||
|
|
||||||
CFLAGS += $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
|
|
||||||
ASFLAGS := -g $(ARCH) -march=armv5te -mtune=arm946e-s
|
|
||||||
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)/lib/lib$(TARGET).a
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(DATA),$(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)))
|
|
||||||
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)) \
|
|
||||||
$(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)
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean all
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
all: $(BUILD)
|
|
||||||
|
|
||||||
lib:
|
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
|
||||||
$(BUILD): lib
|
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) lib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT) : $(OFILES)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o : %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,3 +1,13 @@
|
|||||||
|
NightFox's Lib Ver. 1.1.9
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
- The devkitARM makefiles have been removed as they only work with old versions
|
||||||
|
of devkitARM, which aren't supported by its maintainers. The code and examples
|
||||||
|
of NFLib will probably need changes to work with current devkitARM.
|
||||||
|
- In all scripts to convert assets, check if the environment variable
|
||||||
|
``BLOCKSDS`` is set, which overrides the default path.
|
||||||
|
- Build library with debug symbols to help debug applications that use it.
|
||||||
|
|
||||||
NightFox's Lib Ver. 1.1.8
|
NightFox's Lib Ver. 1.1.8
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT numbers.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
$GRIT numbers.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
||||||
$GRIT redcar.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
$GRIT redcar.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
||||||
$GRIT redcar.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
$GRIT redcar.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
||||||
$GRIT redcar.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
$GRIT redcar.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT numbers.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
$GRIT numbers.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
||||||
$GRIT redcar.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
$GRIT redcar.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
||||||
$GRIT redcar.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
$GRIT redcar.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT whiteball.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
$GRIT whiteball.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT pointer.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
$GRIT pointer.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT pointer.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
$GRIT pointer.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT ball.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
$GRIT ball.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
for file in *.png; do
|
for file in *.png; do
|
||||||
$GRIT "$file" -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
$GRIT "$file" -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT nfl.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
$GRIT nfl.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT img16_c.jpg -ftB -fh! -gb -gB16
|
$GRIT img16_c.jpg -ftB -fh! -gb -gB16
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT img16_c.jpg -ftB -fh! -gb -gB16
|
$GRIT img16_c.jpg -ftB -fh! -gb -gB16
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT ball.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
$GRIT ball.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
||||||
$GRIT character.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
$GRIT character.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT nfl.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
$GRIT nfl.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
||||||
$GRIT water.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
$GRIT water.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT bitmap16.png -ftB -fh! -gb -gB16
|
$GRIT bitmap16.png -ftB -fh! -gb -gB16
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT bitmap16.png -ftB -fh! -gb -gB16
|
$GRIT bitmap16.png -ftB -fh! -gb -gB16
|
||||||
$GRIT img16_a.png -ftB -fh! -gb -gB16
|
$GRIT img16_a.png -ftB -fh! -gb -gB16
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT bitmap16.png -ftB -fh! -gb -gB16
|
$GRIT bitmap16.png -ftB -fh! -gb -gB16
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT nfl.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
$GRIT nfl.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
||||||
$GRIT bg0.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
$GRIT bg0.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT bitmap16.jpg -ftB -fh! -gb -gB16
|
$GRIT bitmap16.jpg -ftB -fh! -gb -gB16
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
# The two backgrounds that share the palette have been edited to use 128 colors
|
# The two backgrounds that share the palette have been edited to use 128 colors
|
||||||
# each, so that the final combined palette is 256 colors in size.
|
# each, so that the final combined palette is 256 colors in size.
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
# The two backgrounds in the same screen share the palette
|
# The two backgrounds in the same screen share the palette
|
||||||
$GRIT navygrid.png waves512.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLa -pS -Onavygrid
|
$GRIT navygrid.png waves512.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLa -pS -Onavygrid
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT blue.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
$GRIT blue.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
||||||
# Only generate palette for the other two
|
# Only generate palette for the other two
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT ball.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
$GRIT ball.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT layer3.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
$GRIT layer3.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT bitmap16.png -ftB -fh! -gb -gB16
|
$GRIT bitmap16.png -ftB -fh! -gb -gB16
|
||||||
$GRIT blueball.png -ftB -fh! -gb -gB16
|
$GRIT blueball.png -ftB -fh! -gb -gB16
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT ball.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
$GRIT ball.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
||||||
$GRIT character.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
$GRIT character.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
||||||
|
1
examples/graphics/spriteaffine/Makefile
Normal file
@ -0,0 +1 @@
|
|||||||
|
include ../../Makefile.example
|
BIN
examples/graphics/spriteaffine/assets/ball.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
8
examples/graphics/spriteaffine/assets/convert.sh
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
|
$GRIT ball.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
||||||
|
|
||||||
|
mv *.pal *.img ../nitrofiles/sprite
|
BIN
examples/graphics/spriteaffine/nitrofiles/sprite/ball.img
Normal file
BIN
examples/graphics/spriteaffine/nitrofiles/sprite/ball.pal
Normal file
109
examples/graphics/spriteaffine/source/main.c
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
// SPDX-License-Identifier: CC0-1.0
|
||||||
|
//
|
||||||
|
// SPDX-FileContributor: NightFox & Co., 2009-2011
|
||||||
|
// SPDX-FileContributor: Antonio Niño Díaz, 2025
|
||||||
|
//
|
||||||
|
// Affine sprite loading example
|
||||||
|
// http://www.nightfoxandco.com
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <nds.h>
|
||||||
|
#include <filesystem.h>
|
||||||
|
|
||||||
|
#include <nf_lib.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
// Set random seed based on the current time
|
||||||
|
srand(time(NULL));
|
||||||
|
|
||||||
|
// Prepare a NitroFS initialization screen
|
||||||
|
NF_Set2D(0, 0);
|
||||||
|
NF_Set2D(1, 0);
|
||||||
|
consoleDemoInit();
|
||||||
|
printf("\n NitroFS init. Please wait.\n\n");
|
||||||
|
printf(" Iniciando NitroFS,\n por favor, espere.\n\n");
|
||||||
|
swiWaitForVBlank();
|
||||||
|
|
||||||
|
// Initialize NitroFS and set it as the root folder of the filesystem
|
||||||
|
nitroFSInit(NULL);
|
||||||
|
NF_SetRootFolder("NITROFS");
|
||||||
|
|
||||||
|
// Initialize 2D engine in both screens and use mode 0
|
||||||
|
NF_Set2D(0, 0);
|
||||||
|
NF_Set2D(1, 0);
|
||||||
|
|
||||||
|
// Initialize sprite system
|
||||||
|
NF_InitSpriteBuffers(); // Initialize storage buffers
|
||||||
|
NF_InitSpriteSys(0); // Top screen
|
||||||
|
NF_InitSpriteSys(1); // Bottom screen
|
||||||
|
|
||||||
|
NF_LoadSpriteGfx("sprite/ball", 0, 32, 32);
|
||||||
|
NF_LoadSpritePal("sprite/ball", 0);
|
||||||
|
|
||||||
|
// Transfer the required sprites to VRAM
|
||||||
|
NF_VramSpriteGfx(1, 0, 0, true);
|
||||||
|
NF_VramSpritePal(1, 0, 0);
|
||||||
|
|
||||||
|
// Setup ball sprites
|
||||||
|
NF_CreateSprite(1, 10, 0, 0, 16, 16);
|
||||||
|
NF_EnableSpriteRotScale(1, 10, 4, false); // rotation ID 4, no double size
|
||||||
|
|
||||||
|
NF_CreateSprite(1, 20, 0, 0, 128, 16);
|
||||||
|
NF_EnableSpriteRotScale(1, 20, 4, true); // rotation ID 4, double size
|
||||||
|
|
||||||
|
NF_CreateSprite(1, 30, 0, 0, 16, 96);
|
||||||
|
NF_EnableSpriteRotScale(1, 30, 5, false); // rotation ID 5, no double size
|
||||||
|
|
||||||
|
NF_CreateSprite(1, 40, 0, 0, 128, 96);
|
||||||
|
NF_EnableSpriteRotScale(1, 40, 5, true); // rotation ID 5, double size
|
||||||
|
|
||||||
|
int angle = 512;
|
||||||
|
int scale = 350;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
scanKeys(); // Read keypad
|
||||||
|
u16 keys = keysHeld(); // Keys currently pressed
|
||||||
|
|
||||||
|
// Rotate and scale sprites
|
||||||
|
|
||||||
|
if (keys & KEY_LEFT)
|
||||||
|
angle += 16;
|
||||||
|
if (keys & KEY_RIGHT)
|
||||||
|
angle -= 16;
|
||||||
|
|
||||||
|
angle &= 511;
|
||||||
|
|
||||||
|
if (keys & KEY_A)
|
||||||
|
{
|
||||||
|
scale += 2;
|
||||||
|
if (scale > 512)
|
||||||
|
scale = 512;
|
||||||
|
}
|
||||||
|
if (keys & KEY_B)
|
||||||
|
{
|
||||||
|
scale -= 2;
|
||||||
|
if (scale < 0)
|
||||||
|
scale = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
NF_SpriteRotScale(1, 4, angle, scale, scale);
|
||||||
|
NF_SpriteRotScale(1, 5, -angle, scale, scale);
|
||||||
|
|
||||||
|
// Update OAM array
|
||||||
|
NF_SpriteOamSet(0);
|
||||||
|
NF_SpriteOamSet(1);
|
||||||
|
|
||||||
|
// Wait for the screen refresh
|
||||||
|
swiWaitForVBlank();
|
||||||
|
|
||||||
|
// Update OAM
|
||||||
|
oamUpdate(&oamMain);
|
||||||
|
oamUpdate(&oamSub);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT ball.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
$GRIT ball.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
||||||
$GRIT character.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
$GRIT character.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT 8x8.png -ftB -fh! -gTFF00FF -gt -gB8 -m! -p!
|
$GRIT 8x8.png -ftB -fh! -gTFF00FF -gt -gB8 -m! -p!
|
||||||
$GRIT 16x16.png -ftB -fh! -gTFF00FF -gt -gB8 -m! -p!
|
$GRIT 16x16.png -ftB -fh! -gTFF00FF -gt -gB8 -m! -p!
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT pointer.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
$GRIT pointer.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.dkp
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT nfl.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
$GRIT nfl.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT layer3.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
$GRIT layer3.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
||||||
|
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
.SUFFIXES:
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(strip $(DEVKITARM)),)
|
|
||||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
||||||
endif
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
#GAME_TITLE := My Wonderful Homebrew
|
|
||||||
#GAME_SUBTITLE1 := built with devkitARM
|
|
||||||
#GAME_SUBTITLE2 := http://devitpro.org
|
|
||||||
|
|
||||||
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
|
|
||||||
# AUDIO is a list of directories containing audio to be converted by maxmod
|
|
||||||
# ICON is the image used to create the game icon, leave blank to use default rule
|
|
||||||
# NITRO is a directory that will be accessible via NitroFS
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
TARGET := $(shell basename $(CURDIR))
|
|
||||||
BUILD := build
|
|
||||||
SOURCES := source
|
|
||||||
INCLUDES := include
|
|
||||||
DATA := data
|
|
||||||
GRAPHICS :=
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO := nitrofiles
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
|
|
||||||
ASFLAGS := -g $(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 := -lnflib
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := $(LIBS) -lfilesystem -lfat
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := $(LIBS) -lmm9
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS := $(LIBS) -lnds9
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
|
|
||||||
$(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)/*.*)))
|
|
||||||
|
|
||||||
# prepare NitroFS directory
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export NITRO_FILES := $(CURDIR)/$(NITRO)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# get audio list for maxmod
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
|
|
||||||
|
|
||||||
# place the soundbank file in NitroFS if using it
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
|
|
||||||
|
|
||||||
# otherwise, needs to be loaded from memory
|
|
||||||
else
|
|
||||||
export SOUNDBANK := soundbank.bin
|
|
||||||
BINFILES += $(SOUNDBANK)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
ifeq ($(strip $(ICON)),)
|
|
||||||
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
|
|
||||||
else
|
|
||||||
ifeq ($(suffix $(ICON)), .grf)
|
|
||||||
export GAME_ICON := $(CURDIR)/$(ICON)
|
|
||||||
else
|
|
||||||
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(BUILD):
|
|
||||||
@mkdir -p $@
|
|
||||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
|
|
||||||
$(OUTPUT).elf: $(OFILES)
|
|
||||||
|
|
||||||
# source files depend on generated headers
|
|
||||||
$(OFILES_SOURCES) : $(HFILES)
|
|
||||||
|
|
||||||
# need to build soundbank first
|
|
||||||
$(OFILES): $(SOUNDBANK)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# rule to build solution from music files
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(SOUNDBANK) : $(MODFILES)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
mmutil $^ -d -o$@ -hsoundbank.h
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.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$*
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Convert non-GRF game icon to GRF if needed
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(GAME_ICON): $(notdir $(ICON))
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo convert $(notdir $<)
|
|
||||||
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
|
|
||||||
|
|
||||||
-include $(DEPSDIR)/*.d
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
$GRIT nfl.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
$GRIT nfl.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
|
||||||
|
|
||||||
|