mirror of
https://github.com/AntonioND/nitro-engine.git
synced 2025-06-19 09:05:50 -04:00
Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8932de1fff | ||
![]() |
86955bc0a0 | ||
![]() |
6e1dca996c | ||
![]() |
02f3cd7012 | ||
![]() |
926bb4f361 | ||
![]() |
f6b0200be3 | ||
![]() |
d42cb2c08e | ||
![]() |
d52a92812e | ||
![]() |
cb2e62f953 | ||
![]() |
5a10679dfb | ||
![]() |
b67c60d5f0 | ||
![]() |
fff1a65647 | ||
![]() |
efbf4b6546 | ||
![]() |
dd20800334 | ||
![]() |
39117696aa | ||
![]() |
459d8f8960 | ||
![]() |
e5ae245674 | ||
![]() |
8a18dfa586 | ||
![]() |
de9ca58286 | ||
![]() |
446e27110e | ||
![]() |
09c3712431 |
79
.github/workflows/build.yml
vendored
Normal file
79
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
#
|
||||||
|
# SPDX-FileContributor: Antonio Niño Díaz, 2025
|
||||||
|
|
||||||
|
name: Documentation
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
paths-ignore:
|
||||||
|
- '**.rst'
|
||||||
|
- 'examples'
|
||||||
|
- 'licenses'
|
||||||
|
- 'Makefile*'
|
||||||
|
- 'source*'
|
||||||
|
- 'tests'
|
||||||
|
- 'tools'
|
||||||
|
workflow_dispatch:
|
||||||
|
repository_dispatch:
|
||||||
|
types: [run_build]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
generate_website:
|
||||||
|
name: Generate website
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Clone project
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: 'master'
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get install doxygen
|
||||||
|
|
||||||
|
- name: Build documentation
|
||||||
|
run: |
|
||||||
|
cd documentation
|
||||||
|
bash generate.sh
|
||||||
|
|
||||||
|
# Create tarball with everything to upload to GitHub pages
|
||||||
|
cd html
|
||||||
|
tar -cvf ../../repo.tar ./*
|
||||||
|
|
||||||
|
- name: Upload repo artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: github-pages
|
||||||
|
path: repo.tar
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
publish_repo:
|
||||||
|
name: Publish website with GitHub pages
|
||||||
|
if: contains(github.ref,'refs/heads/master')
|
||||||
|
needs: [generate_website]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Setup Pages
|
||||||
|
uses: actions/configure-pages@v5
|
||||||
|
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v4
|
9
Makefile
9
Makefile
@ -21,12 +21,3 @@ install: all
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(MAKE) -f Makefile.blocksds clean
|
$(MAKE) -f Makefile.blocksds clean
|
||||||
|
|
||||||
.PHONY: dkp dkp-clean
|
|
||||||
|
|
||||||
dkp:
|
|
||||||
$(MAKE) -f Makefile.dkp
|
|
||||||
$(MAKE) -f Makefile.dkp NE_DEBUG=1
|
|
||||||
|
|
||||||
dkp-clean:
|
|
||||||
$(MAKE) -f Makefile.dkp clean
|
|
||||||
|
@ -49,7 +49,7 @@ ARCHIVE := lib/lib$(NAME).a
|
|||||||
PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi-
|
PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi-
|
||||||
CC := $(PREFIX)gcc
|
CC := $(PREFIX)gcc
|
||||||
CXX := $(PREFIX)g++
|
CXX := $(PREFIX)g++
|
||||||
AR := ar
|
AR := $(PREFIX)ar
|
||||||
MKDIR := mkdir
|
MKDIR := mkdir
|
||||||
RM := rm -rf
|
RM := rm -rf
|
||||||
CP := cp
|
CP := cp
|
||||||
@ -92,16 +92,16 @@ WARNFLAGS := -Wall -Wno-address-of-packed-member
|
|||||||
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 \
|
||||||
@ -147,6 +147,7 @@ install: all
|
|||||||
$(V)$(CP) -r tools/img2ds/*.py $(BLOCKSDSEXT)/$(INSTALLNAME)/tools/img2ds
|
$(V)$(CP) -r tools/img2ds/*.py $(BLOCKSDSEXT)/$(INSTALLNAME)/tools/img2ds
|
||||||
$(V)$(CP) -r tools/md5_to_dsma/*.py $(BLOCKSDSEXT)/$(INSTALLNAME)/tools/md5_to_dsma
|
$(V)$(CP) -r tools/md5_to_dsma/*.py $(BLOCKSDSEXT)/$(INSTALLNAME)/tools/md5_to_dsma
|
||||||
$(V)$(CP) -r tools/obj2dl/*.py $(BLOCKSDSEXT)/$(INSTALLNAME)/tools/obj2dl
|
$(V)$(CP) -r tools/obj2dl/*.py $(BLOCKSDSEXT)/$(INSTALLNAME)/tools/obj2dl
|
||||||
|
$(V)$(CP) -r licenses $(BLOCKSDSEXT)/$(INSTALLNAME)/
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo " CLEAN"
|
@echo " CLEAN"
|
||||||
|
139
Makefile.dkp
139
Makefile.dkp
@ -1,139 +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
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
SOURCES := source source/dsma source/libdsf
|
|
||||||
DATA := data
|
|
||||||
INCLUDES := include source/libdsf
|
|
||||||
|
|
||||||
ifeq ($(NE_DEBUG),1)
|
|
||||||
TARGET := NE_debug
|
|
||||||
BUILD := build_debug
|
|
||||||
else
|
|
||||||
TARGET := NE
|
|
||||||
BUILD := build_release
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -mthumb -mthumb-interwork
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O2\
|
|
||||||
-march=armv5te -mtune=arm946e-s \
|
|
||||||
-fomit-frame-pointer -ffast-math \
|
|
||||||
$(ARCH) -Wno-address-of-packed-member
|
|
||||||
|
|
||||||
ifeq ($(NE_DEBUG),1)
|
|
||||||
CFLAGS += -DNE_DEBUG
|
|
||||||
endif
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# any extra libraries we wish to link with the project
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBS :=
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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_debug build_release lib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
$(OUTPUT) : $(OFILES)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o : %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -1,6 +1,32 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
Version 0.15.3 (2025-03-26)
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
- 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 Nitro Engine will probably need changes to work with current devkitARM.
|
||||||
|
- The GRF files used in an example have been updated, they were built before the
|
||||||
|
format was changed.
|
||||||
|
- The build scripts for assets have been modified to use the value of the
|
||||||
|
environment variables ``BLOCKSDS`` and ``BLOCKSDSEXT`` if they are found.
|
||||||
|
- Build library with debug symbols to help debug applications that use it.
|
||||||
|
|
||||||
|
Version 0.15.2 (2025-01-15)
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
- Fix `ar` binary used to build the library.
|
||||||
|
- Update documentation.
|
||||||
|
- Fix build of examples in devkitARM.
|
||||||
|
- Improve setup instructions.
|
||||||
|
|
||||||
|
Version 0.15.1 (2024-12-23)
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
- Install licenses with the rest of the library.
|
||||||
|
- Clarify some comments in examples.
|
||||||
|
|
||||||
Version 0.15.0 (2024-12-01)
|
Version 0.15.0 (2024-12-01)
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ PROJECT_NAME = "Nitro Engine"
|
|||||||
# could be handy for archiving the generated documentation or if some version
|
# could be handy for archiving the generated documentation or if some version
|
||||||
# control system is used.
|
# control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = 0.15.0
|
PROJECT_NUMBER = 0.15.3
|
||||||
|
|
||||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||||
# for a project that appears at the top of each page and should give viewer a
|
# for a project that appears at the top of each page and should give viewer a
|
||||||
|
@ -1,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -3,14 +3,16 @@
|
|||||||
rm -rf data
|
rm -rf data
|
||||||
mkdir -p data
|
mkdir -p data
|
||||||
|
|
||||||
|
BLOCKSDSEXT="${BLOCKSDSEXT:-/opt/blocksds/external/}"
|
||||||
|
|
||||||
# ptexconv can be obtained here: https://github.com/Garhoogin/ptexconv/
|
# ptexconv can be obtained here: https://github.com/Garhoogin/ptexconv/
|
||||||
|
|
||||||
/opt/blocksds/external/ptexconv/ptexconv \
|
$BLOCKSDSEXT/ptexconv/ptexconv \
|
||||||
-gt -ob -k FF00FF -v -f tex4x4 \
|
-gt -ob -k FF00FF -v -f tex4x4 \
|
||||||
-o data/grill \
|
-o data/grill \
|
||||||
assets/grill.png
|
assets/grill.png
|
||||||
|
|
||||||
/opt/blocksds/external/ptexconv/ptexconv \
|
$BLOCKSDSEXT/ptexconv/ptexconv \
|
||||||
-gt -ob -k FF00FF -v -f tex4x4 \
|
-gt -ob -k FF00FF -v -f tex4x4 \
|
||||||
-o data/landscape \
|
-o data/landscape \
|
||||||
assets/landscape.jpg
|
assets/landscape.jpg
|
||||||
|
@ -1,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -4,7 +4,8 @@ NITRO_ENGINE=../../..
|
|||||||
ASSETS=$NITRO_ENGINE/examples/assets
|
ASSETS=$NITRO_ENGINE/examples/assets
|
||||||
TOOLS=$NITRO_ENGINE/tools
|
TOOLS=$NITRO_ENGINE/tools
|
||||||
MD5_TO_DSMA=$TOOLS/md5_to_dsma/md5_to_dsma.py
|
MD5_TO_DSMA=$TOOLS/md5_to_dsma/md5_to_dsma.py
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
rm -rf nitrofiles
|
rm -rf nitrofiles
|
||||||
mkdir -p nitrofiles
|
mkdir -p nitrofiles
|
||||||
|
@ -1,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -4,7 +4,8 @@ NITRO_ENGINE=../../..
|
|||||||
ASSETS=$NITRO_ENGINE/examples/assets
|
ASSETS=$NITRO_ENGINE/examples/assets
|
||||||
TOOLS=$NITRO_ENGINE/tools
|
TOOLS=$NITRO_ENGINE/tools
|
||||||
OBJ2DL=$TOOLS/obj2dl/obj2dl.py
|
OBJ2DL=$TOOLS/obj2dl/obj2dl.py
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
rm -rf nitrofiles
|
rm -rf nitrofiles
|
||||||
mkdir -p nitrofiles
|
mkdir -p nitrofiles
|
||||||
|
@ -1,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -4,7 +4,8 @@ NITRO_ENGINE=../../..
|
|||||||
ASSETS=$NITRO_ENGINE/examples/assets
|
ASSETS=$NITRO_ENGINE/examples/assets
|
||||||
TOOLS=$NITRO_ENGINE/tools
|
TOOLS=$NITRO_ENGINE/tools
|
||||||
OBJ2DL=$TOOLS/obj2dl/obj2dl.py
|
OBJ2DL=$TOOLS/obj2dl/obj2dl.py
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
rm -rf nitrofiles
|
rm -rf nitrofiles
|
||||||
mkdir -p nitrofiles
|
mkdir -p nitrofiles
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
GRIT=/opt/blocksds/core/tools/grit/grit
|
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
|
||||||
|
GRIT=$BLOCKSDS/tools/grit/grit
|
||||||
|
|
||||||
rm -rf nitrofiles
|
rm -rf nitrofiles
|
||||||
mkdir -p nitrofiles
|
mkdir -p nitrofiles
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -1,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,225 +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
|
|
||||||
# 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 :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# options for code generation
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
|
|
||||||
|
|
||||||
CFLAGS := -g -Wall -O3\
|
|
||||||
$(ARCH) $(INCLUDE) -DARM9
|
|
||||||
|
|
||||||
# Enable debug mode of Nitro Engine
|
|
||||||
CFLAGS += -DNE_DEBUG
|
|
||||||
|
|
||||||
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)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# Use debug version of Nitro Engine
|
|
||||||
LIBS := -lNE_debug -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -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)/nitro-engine $(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 $(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
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -20,9 +20,9 @@ void Draw3DScene1(void *arg)
|
|||||||
|
|
||||||
NE_2DViewInit();
|
NE_2DViewInit();
|
||||||
|
|
||||||
NE_RichTextRender3D(3, "VAWATa\ntajl", 0, 0);
|
NE_RichTextRender3D(1, "VAWATa\ntajl", 0, 0);
|
||||||
|
|
||||||
NE_RichTextRender3DAlpha(2, "Text with alpha", 10, 80,
|
NE_RichTextRender3DAlpha(0, "Text with alpha", 10, 80,
|
||||||
POLY_ALPHA(20) | POLY_CULL_BACK, 30);
|
POLY_ALPHA(20) | POLY_CULL_BACK, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,28 +70,28 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Load a 16-color font to be used for rendering text as quads
|
// Load a 16-color font to be used for rendering text as quads
|
||||||
|
|
||||||
NE_RichTextInit(2);
|
NE_RichTextInit(0);
|
||||||
NE_RichTextMetadataLoadFAT(2, "fonts/font.fnt");
|
NE_RichTextMetadataLoadFAT(0, "fonts/font.fnt");
|
||||||
NE_RichTextMaterialLoadGRF(2, "fonts/font_16_png.grf");
|
NE_RichTextMaterialLoadGRF(0, "fonts/font_16_png.grf");
|
||||||
|
|
||||||
// Load a 256-color font to be used for rendering text as quads
|
// Load a 256-color font to be used for rendering text as quads
|
||||||
|
|
||||||
NE_RichTextInit(3);
|
NE_RichTextInit(1);
|
||||||
NE_RichTextMetadataLoadFAT(3, "fonts/font.fnt");
|
NE_RichTextMetadataLoadFAT(1, "fonts/font.fnt");
|
||||||
NE_RichTextMaterialLoadGRF(3, "fonts/font_256_png.grf");
|
NE_RichTextMaterialLoadGRF(1, "fonts/font_256_png.grf");
|
||||||
|
|
||||||
// Load a 16-color font to be used for rendering text to textures.
|
// Load a 16-color font to be used for rendering text to textures.
|
||||||
|
|
||||||
NE_RichTextInit(5);
|
NE_RichTextInit(2);
|
||||||
NE_RichTextMetadataLoadFAT(5, "fonts/font.fnt");
|
NE_RichTextMetadataLoadFAT(2, "fonts/font.fnt");
|
||||||
NE_RichTextBitmapLoadGRF(5, "fonts/font_16_png.grf");
|
NE_RichTextBitmapLoadGRF(2, "fonts/font_16_png.grf");
|
||||||
|
|
||||||
// Render text to a texture using the last font we've loaded
|
// Render text to a texture using the last font we've loaded
|
||||||
|
|
||||||
// We don't care about the palette, passing NULL will mark the palette
|
// We don't care about managing the palette. Passing NULL will tell Nitro
|
||||||
// to be autodeleted when the material is deleted.
|
// Engine to delete the palete automatically when the material is deleted.
|
||||||
NE_Material *Material = NULL;
|
NE_Material *Material = NULL;
|
||||||
NE_RichTextRenderMaterial(5,
|
NE_RichTextRenderMaterial(2,
|
||||||
"Sample: AWAV.\nÿ_ßðñÑü(o´Áá)|\nInvalid char: ŋ",
|
"Sample: AWAV.\nÿ_ßðñÑü(o´Áá)|\nInvalid char: ŋ",
|
||||||
&Material, NULL);
|
&Material, NULL);
|
||||||
|
|
||||||
@ -114,9 +114,7 @@ int main(int argc, char *argv[])
|
|||||||
NE_SpriteDelete(Scene.TextSprite);
|
NE_SpriteDelete(Scene.TextSprite);
|
||||||
NE_MaterialDelete(Material);
|
NE_MaterialDelete(Material);
|
||||||
|
|
||||||
NE_RichTextEnd(2);
|
NE_RichTextResetSystem();
|
||||||
NE_RichTextEnd(3);
|
|
||||||
NE_RichTextEnd(5);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -23,9 +23,9 @@ void Draw3DScene(void *arg)
|
|||||||
|
|
||||||
NE_2DViewInit();
|
NE_2DViewInit();
|
||||||
|
|
||||||
NE_RichTextRender3D(3, "VAWATa\ntajl", 0, 0);
|
NE_RichTextRender3D(1, "VAWATa\ntajl", 0, 0);
|
||||||
|
|
||||||
NE_RichTextRender3DAlpha(2, "Text with alpha", 10, 80,
|
NE_RichTextRender3DAlpha(0, "Text with alpha", 10, 80,
|
||||||
POLY_ALPHA(20) | POLY_CULL_BACK, 30);
|
POLY_ALPHA(20) | POLY_CULL_BACK, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,8 +55,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Load a 16-color font to be used for rendering text as quads
|
// Load a 16-color font to be used for rendering text as quads
|
||||||
|
|
||||||
NE_RichTextInit(2);
|
NE_RichTextInit(0);
|
||||||
NE_RichTextMetadataLoadMemory(2, font_fnt_bin, font_fnt_bin_size);
|
NE_RichTextMetadataLoadMemory(0, font_fnt_bin, font_fnt_bin_size);
|
||||||
|
|
||||||
{
|
{
|
||||||
NE_Material *Font16 = NE_MaterialCreate();
|
NE_Material *Font16 = NE_MaterialCreate();
|
||||||
@ -71,13 +71,13 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// The material and palette will be deleted when the rich text font is
|
// The material and palette will be deleted when the rich text font is
|
||||||
// deleted.
|
// deleted.
|
||||||
NE_RichTextMaterialSet(2, Font16, Pal16);
|
NE_RichTextMaterialSet(0, Font16, Pal16);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load a 256-color font to be used for rendering text as quads
|
// Load a 256-color font to be used for rendering text as quads
|
||||||
|
|
||||||
NE_RichTextInit(3);
|
NE_RichTextInit(1);
|
||||||
NE_RichTextMetadataLoadMemory(3, font_fnt_bin, font_fnt_bin_size);
|
NE_RichTextMetadataLoadMemory(1, font_fnt_bin, font_fnt_bin_size);
|
||||||
|
|
||||||
{
|
{
|
||||||
NE_Material *Font256 = NE_MaterialCreate();
|
NE_Material *Font256 = NE_MaterialCreate();
|
||||||
@ -92,22 +92,22 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// The material and palette will be deleted when the rich text font is
|
// The material and palette will be deleted when the rich text font is
|
||||||
// deleted.
|
// deleted.
|
||||||
NE_RichTextMaterialSet(3, Font256, Pal256);
|
NE_RichTextMaterialSet(1, Font256, Pal256);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load a 16-color font to be used for rendering text to textures.
|
// Load a 16-color font to be used for rendering text to textures.
|
||||||
|
|
||||||
NE_RichTextInit(5);
|
NE_RichTextInit(2);
|
||||||
NE_RichTextMetadataLoadMemory(5, font_fnt_bin, font_fnt_bin_size);
|
NE_RichTextMetadataLoadMemory(2, font_fnt_bin, font_fnt_bin_size);
|
||||||
NE_RichTextBitmapSet(5, font_16Bitmap, 256, 256, NE_PAL16,
|
NE_RichTextBitmapSet(2, font_16Bitmap, 256, 256, NE_PAL16,
|
||||||
font_16Pal, font_16PalLen);
|
font_16Pal, font_16PalLen);
|
||||||
|
|
||||||
// Render text to a texture using the last font we've loaded
|
// Render text to a texture using the last font we've loaded
|
||||||
|
|
||||||
// We don't care about the palette, passing NULL will mark the palette
|
// We don't care about managing the palette. Passing NULL will tell Nitro
|
||||||
// to be autodeleted when the material is deleted.
|
// Engine to delete the palete automatically when the material is deleted.
|
||||||
NE_Material *Material = NULL;
|
NE_Material *Material = NULL;
|
||||||
NE_RichTextRenderMaterial(5,
|
NE_RichTextRenderMaterial(2,
|
||||||
"Sample: AWAV.\nÿ_ßðñÑü(o´Áá)|\nInvalid char: ŋ",
|
"Sample: AWAV.\nÿ_ßðñÑü(o´Áá)|\nInvalid char: ŋ",
|
||||||
&Material, NULL);
|
&Material, NULL);
|
||||||
|
|
||||||
@ -130,9 +130,7 @@ int main(int argc, char *argv[])
|
|||||||
NE_SpriteDelete(Scene.TextSprite);
|
NE_SpriteDelete(Scene.TextSprite);
|
||||||
NE_MaterialDelete(Material);
|
NE_MaterialDelete(Material);
|
||||||
|
|
||||||
NE_RichTextEnd(2);
|
NE_RichTextResetSystem();
|
||||||
NE_RichTextEnd(3);
|
|
||||||
NE_RichTextEnd(5);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,220 +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
|
|
||||||
# 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 :=
|
|
||||||
GRAPHICS := graphics
|
|
||||||
AUDIO :=
|
|
||||||
ICON :=
|
|
||||||
|
|
||||||
# specify a directory which contains the nitro filesystem
|
|
||||||
# this is relative to the Makefile
|
|
||||||
NITRO :=
|
|
||||||
|
|
||||||
# These set the information text in the nds file
|
|
||||||
GAME_TITLE := $(shell basename $(CURDIR))
|
|
||||||
GAME_SUBTITLE1 := Nitro Engine example
|
|
||||||
GAME_SUBTITLE2 := github.com/AntonioND/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 := -lNE -lfat -lnds9
|
|
||||||
|
|
||||||
# automatigically add libraries for NitroFS
|
|
||||||
ifneq ($(strip $(NITRO)),)
|
|
||||||
LIBS := -lfilesystem -lfat $(LIBS)
|
|
||||||
endif
|
|
||||||
# automagically add maxmod library
|
|
||||||
ifneq ($(strip $(AUDIO)),)
|
|
||||||
LIBS := -lmm9 $(LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# list of directories containing libraries, this must be the top level containing
|
|
||||||
# include and lib
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nitro-engine
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# 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 $(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
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
@ -52,7 +52,7 @@ extern "C" {
|
|||||||
/// Minor version of Nitro Engine
|
/// Minor version of Nitro Engine
|
||||||
#define NITRO_ENGINE_MINOR (15)
|
#define NITRO_ENGINE_MINOR (15)
|
||||||
/// Patch version of Nitro Engine
|
/// Patch version of Nitro Engine
|
||||||
#define NITRO_ENGINE_PATCH (0)
|
#define NITRO_ENGINE_PATCH (3)
|
||||||
|
|
||||||
/// Full version of Nitro Engine
|
/// Full version of Nitro Engine
|
||||||
#define NITRO_ENGINE_VERSION ((NITRO_ENGINE_MAJOR << 16) | \
|
#define NITRO_ENGINE_VERSION ((NITRO_ENGINE_MAJOR << 16) | \
|
||||||
@ -60,7 +60,7 @@ extern "C" {
|
|||||||
(NITRO_ENGINE_PATCH))
|
(NITRO_ENGINE_PATCH))
|
||||||
|
|
||||||
/// String with the version of Nitro Engine
|
/// String with the version of Nitro Engine
|
||||||
#define NITRO_ENGINE_VERSION_STRING "0.15.0"
|
#define NITRO_ENGINE_VERSION_STRING "0.15.3"
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
@ -34,7 +34,8 @@
|
|||||||
///
|
///
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
#define NE_MAX_RICH_TEXT_FONTS 8 ///< Default max number of rich text fonts
|
#define NE_DEFAULT_RICH_TEXT_FONTS 8 ///< Default max number of rich text fonts
|
||||||
|
#define NE_MAX_RICH_TEXT_FONTS NE_DEFAULT_RICH_TEXT_FONTS ///< Deprecated and unused, left for compatibility
|
||||||
|
|
||||||
/// Change the priority of rich text drawn after this function call.
|
/// Change the priority of rich text drawn after this function call.
|
||||||
///
|
///
|
||||||
@ -44,12 +45,20 @@ void NE_RichTextPrioritySet(int priority);
|
|||||||
/// Set to 0 the priority of rich text drawn after this function call.
|
/// Set to 0 the priority of rich text drawn after this function call.
|
||||||
void NE_RichTextPriorityReset(void);
|
void NE_RichTextPriorityReset(void);
|
||||||
|
|
||||||
|
/// Initializes the rich text system with the specified number of slots.
|
||||||
|
///
|
||||||
|
/// This must be called before initializing any rich text slots.
|
||||||
|
///
|
||||||
|
/// @param numSlots The number of rich text slots to allocate.
|
||||||
|
/// @return Returns 1 on success, 0 on failure.
|
||||||
|
int NE_RichTextStartSystem(u32 numSlots);
|
||||||
|
|
||||||
/// Clears all rich text font slots.
|
/// Clears all rich text font slots.
|
||||||
void NE_RichTextResetSystem(void);
|
void NE_RichTextResetSystem(void);
|
||||||
|
|
||||||
/// Initialize a rich text slot.
|
/// Initialize a rich text slot.
|
||||||
///
|
///
|
||||||
/// @param slot The slot to initialize (from 0 to NE_MAX_RICH_TEXT_FONTS).
|
/// @param slot The slot to initialize (from 0 to the number of slots specified in NE_RichTextSystemStart).
|
||||||
void NE_RichTextInit(u32 slot);
|
void NE_RichTextInit(u32 slot);
|
||||||
|
|
||||||
/// End a rich text slot and free all the resources used by it.
|
/// End a rich text slot and free all the resources used by it.
|
||||||
@ -157,6 +166,19 @@ int NE_RichTextBitmapSet(u32 slot, const void *texture_buffer,
|
|||||||
NE_TextureFormat texture_fmt,
|
NE_TextureFormat texture_fmt,
|
||||||
const void *palette_buffer, size_t palette_size);
|
const void *palette_buffer, size_t palette_size);
|
||||||
|
|
||||||
|
/// Calculates the final size and cursor position of rendering the provided string.
|
||||||
|
///More actions
|
||||||
|
/// @param slot The slot to use.
|
||||||
|
/// @param str The string to render.
|
||||||
|
/// @param size_x Pointer to store the width of the resulting image.
|
||||||
|
/// @param size_y Pointer to store the height of the resulting image.
|
||||||
|
/// @param final_x Pointer to store the final X position of the cursor.
|
||||||
|
/// @param final_y Pointer to store the final Y position of the cursor.
|
||||||
|
/// @return Returns 1 on success, 0 on failure.
|
||||||
|
int NE_RichTextRenderDryRunWithPos(u32 slot, const char *str,
|
||||||
|
size_t *size_x, size_t *size_y,
|
||||||
|
size_t *final_x, size_t *final_y);
|
||||||
|
|
||||||
/// Calculates the final size of rendering the provided string.
|
/// Calculates the final size of rendering the provided string.
|
||||||
///
|
///
|
||||||
/// @param slot The slot to use.
|
/// @param slot The slot to use.
|
||||||
@ -167,6 +189,19 @@ int NE_RichTextBitmapSet(u32 slot, const void *texture_buffer,
|
|||||||
int NE_RichTextRenderDryRun(u32 slot, const char *str,
|
int NE_RichTextRenderDryRun(u32 slot, const char *str,
|
||||||
size_t *size_x, size_t *size_y);
|
size_t *size_x, size_t *size_y);
|
||||||
|
|
||||||
|
/// Render a string by rendering one 3D quad per codepoint.
|
||||||
|
///
|
||||||
|
/// This preserves the polygon format that is currently active.
|
||||||
|
///
|
||||||
|
/// @param slot The slot to use.
|
||||||
|
/// @param str The string to render.
|
||||||
|
/// @param x The left coordinate of the text.
|
||||||
|
/// @param y The top coordinate of the text.
|
||||||
|
/// @param xIndent The horizontal indentation to apply to the first line of text.
|
||||||
|
/// @return Returns 1 on success, 0 on failure.
|
||||||
|
int NE_RichTextRender3DWithIndent(u32 slot, const char *str, s32 x, s32 y,
|
||||||
|
s32 xIndent);
|
||||||
|
|
||||||
/// Render a string by rendering one 3D quad per codepoint.
|
/// Render a string by rendering one 3D quad per codepoint.
|
||||||
///
|
///
|
||||||
/// This preserves the polygon format that is currently active.
|
/// This preserves the polygon format that is currently active.
|
||||||
@ -178,6 +213,48 @@ int NE_RichTextRenderDryRun(u32 slot, const char *str,
|
|||||||
/// @return Returns 1 on success, 0 on failure.
|
/// @return Returns 1 on success, 0 on failure.
|
||||||
int NE_RichTextRender3D(u32 slot, const char *str, s32 x, s32 y);
|
int NE_RichTextRender3D(u32 slot, const char *str, s32 x, s32 y);
|
||||||
|
|
||||||
|
/// Render a string by rendering one 3D quad per codepoint.More actions
|
||||||
|
///
|
||||||
|
/// This preserves the polygon format that is currently active.
|
||||||
|
///
|
||||||
|
/// @param slot The slot to use.
|
||||||
|
/// @param str The string to render.
|
||||||
|
/// @param x The left coordinate of the text.
|
||||||
|
/// @param y The top coordinate of the text.
|
||||||
|
/// @param xIndent The horizontal indentation to apply to the first line of text.
|
||||||
|
/// @return Returns 1 on success, 0 on failure.
|
||||||
|
int NE_RichTextRender3DWithIndent(u32 slot, const char *str, s32 x, s32 y,
|
||||||
|
s32 xIndent);
|
||||||
|
|
||||||
|
/// Render a string by rendering one 3D quad per codepoint.
|
||||||
|
///
|
||||||
|
/// This preserves the polygon format that is currently active.
|
||||||
|
/// @return Returns 1 on success, 0 on failure.
|
||||||
|
int NE_RichTextRender3D(u32 slot, const char *str, s32 x, s32 y);
|
||||||
|
|
||||||
|
/// Render a string by rendering one 3D quad per codepoint with alternating
|
||||||
|
/// polygon IDs.
|
||||||
|
///
|
||||||
|
/// This function will alternate between polygon IDs so that alpha blending
|
||||||
|
/// works between multiple polygons when they overlap. This is a requirement of
|
||||||
|
/// the NDS 3D hardware.
|
||||||
|
///
|
||||||
|
/// It is required to pass the base polygon format as a parameter because the
|
||||||
|
/// polygon format data is write-only. Whenever the polygon ID needs to be
|
||||||
|
/// changed, the rest of the polygon format flags need to be set as well.
|
||||||
|
///
|
||||||
|
/// @param slot The slot to use.
|
||||||
|
/// @param str The string to render.
|
||||||
|
/// @param x The left coordinate of the text.
|
||||||
|
/// @param y The top coordinate of the text.
|
||||||
|
/// @param poly_fmt The polygon format values to be used for the quads.
|
||||||
|
/// @param poly_id_base The base polygon ID to use for the quads.
|
||||||
|
/// @param xIndent The horizontal indentation to apply to the first line of text.
|
||||||
|
/// @return Returns 1 on success, 0 on failure.
|
||||||
|
int NE_RichTextRender3DAlphaWithIndent(u32 slot, const char *str, s32 x, s32 y,
|
||||||
|
uint32_t poly_fmt, int poly_id_base,
|
||||||
|
s32 xIndent);
|
||||||
|
|
||||||
/// Render a string by rendering one 3D quad per codepoint with alternating
|
/// Render a string by rendering one 3D quad per codepoint with alternating
|
||||||
/// polygon IDs.
|
/// polygon IDs.
|
||||||
///
|
///
|
||||||
|
47
readme.rst
47
readme.rst
@ -8,9 +8,7 @@ Introduction
|
|||||||
This is a 3D game engine, a lot of functions designed to simplify the process of
|
This is a 3D game engine, a lot of functions designed to simplify the process of
|
||||||
making a 3D game. It isn't standalone, it needs libnds to work.
|
making a 3D game. It isn't standalone, it needs libnds to work.
|
||||||
|
|
||||||
You can use Nitro Engine with `BlocksDS <https://blocksds.github.io/docs/>`_ and
|
You can use Nitro Engine with `BlocksDS <https://blocksds.github.io/docs/>`_.
|
||||||
devkitPro, but BlocksDS is preferred as some features of Nitro Engine are only
|
|
||||||
available with BlocksDS.
|
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
|
||||||
@ -40,6 +38,14 @@ Setup
|
|||||||
BlocksDS
|
BlocksDS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
You can install this library with ``wf-pacman`` directly:
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
wf-pacman -Sy blocksds-nitroengine
|
||||||
|
|
||||||
|
If you want to build the library from source, follow the instructions:
|
||||||
|
|
||||||
1. Clone this repository and run:
|
1. Clone this repository and run:
|
||||||
|
|
||||||
.. code:: bash
|
.. code:: bash
|
||||||
@ -63,41 +69,22 @@ aren't very flexible, and they don't support converting 3D models, or saving
|
|||||||
graphics or models to the filesystem (you can only inject them as data to the
|
graphics or models to the filesystem (you can only inject them as data to the
|
||||||
ARM9, which isn't acceptable for big games).
|
ARM9, which isn't acceptable for big games).
|
||||||
|
|
||||||
For BlocksDS, try `ArchitectDS <https://github.com/AntonioND/architectds>`. This
|
You can also try `ArchitectDS <https://github.com/AntonioND/architectds>`_. This
|
||||||
build system written in Python supports converting every format that Nitro
|
build system written in Python supports converting every format that Nitro
|
||||||
Engine supports, and it lets you save everything in NitroFS so that your game
|
Engine supports, and it lets you save everything in NitroFS so that your game
|
||||||
can grow as much as you want. ArchitectDS comes with plenty of examples of how
|
can grow as much as you want. ArchitectDS comes with plenty of examples of how
|
||||||
to use it with Nitro Engine.
|
to use it with Nitro Engine.
|
||||||
|
|
||||||
devkitpro
|
devkitPro
|
||||||
---------
|
---------
|
||||||
|
|
||||||
1. Clone this repository. Create a symbolic link to it inside the devkitPro
|
**NOTE**: This option has been temporarily removed. The Makefiles that were
|
||||||
folder in your system. For example, in Linux, create a symlink so that
|
present in the repository were only valid in old versions of devkitARM,
|
||||||
``/opt/devkitpro/nitro-engine`` points to the folder with Nitro Engine:
|
unsupported by their maintainers. The code and examples will also need changes
|
||||||
|
to work with the new version of their libraries.
|
||||||
|
|
||||||
.. code:: bash
|
Usage notes
|
||||||
|
-----------
|
||||||
ln -sT /path/to/nitro-engine /opt/devkitpro/nitro-engine
|
|
||||||
|
|
||||||
2. Go to the ``nitro-engine`` folder and type this on the terminal:
|
|
||||||
|
|
||||||
.. code:: bash
|
|
||||||
|
|
||||||
make dkp -j`nproc`
|
|
||||||
|
|
||||||
This should build the library in both debug and release modes.
|
|
||||||
|
|
||||||
3. If you want to check that everything is working as expected, open one of the
|
|
||||||
folders of the examples and type ``make -f Makefile.dkp``. That should build
|
|
||||||
an ``.nds`` file that you can run on an emulator or real hardware.
|
|
||||||
|
|
||||||
Note: If you're using **melonDS**, remember that any example that uses NitroFS
|
|
||||||
with will fail if it's built with the libraries that come with devkitPro because
|
|
||||||
of a bug in the libraries. Other emulators like **DeSmuME** still work.
|
|
||||||
|
|
||||||
Common
|
|
||||||
------
|
|
||||||
|
|
||||||
Note that some features of the 3D hardware aren't emulated by most emulators, so
|
Note that some features of the 3D hardware aren't emulated by most emulators, so
|
||||||
you may need to use an actual NDS to test some things. **melonDS** seems to
|
you may need to use an actual NDS to test some things. **melonDS** seems to
|
||||||
|
@ -29,7 +29,9 @@ typedef struct {
|
|||||||
bool active;
|
bool active;
|
||||||
} ne_rich_textinfo_t;
|
} ne_rich_textinfo_t;
|
||||||
|
|
||||||
static ne_rich_textinfo_t NE_RichTextInfo[NE_MAX_RICH_TEXT_FONTS];
|
static u32 NE_NumRichTextSlots = 0;
|
||||||
|
|
||||||
|
static ne_rich_textinfo_t *NE_RichTextInfo;
|
||||||
|
|
||||||
static int NE_RICH_TEXT_PRIORITY = 0;
|
static int NE_RICH_TEXT_PRIORITY = 0;
|
||||||
|
|
||||||
@ -45,8 +47,17 @@ void NE_RichTextPriorityReset(void)
|
|||||||
|
|
||||||
void NE_RichTextInit(u32 slot)
|
void NE_RichTextInit(u32 slot)
|
||||||
{
|
{
|
||||||
if (slot >= NE_MAX_RICH_TEXT_FONTS)
|
// Compatibility mode -- if someone tries to allocate a slot
|
||||||
|
// without having called start system, we allocate the old maximum
|
||||||
|
// number of slots for safety
|
||||||
|
if (NE_NumRichTextSlots == 0)
|
||||||
|
NE_RichTextStartSystem(NE_DEFAULT_RICH_TEXT_FONTS);
|
||||||
|
|
||||||
|
if (slot >= NE_NumRichTextSlots)
|
||||||
|
{
|
||||||
|
NE_DebugPrint("Attempted to initialize a slot greater than the number of slots allocated; skipping");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
||||||
if (info->active)
|
if (info->active)
|
||||||
@ -60,7 +71,7 @@ void NE_RichTextInit(u32 slot)
|
|||||||
|
|
||||||
int NE_RichTextEnd(u32 slot)
|
int NE_RichTextEnd(u32 slot)
|
||||||
{
|
{
|
||||||
if (slot >= NE_MAX_RICH_TEXT_FONTS)
|
if (slot >= NE_NumRichTextSlots)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
||||||
@ -97,17 +108,31 @@ int NE_RichTextEnd(u32 slot)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int NE_RichTextStartSystem(u32 numSlots)
|
||||||
|
{
|
||||||
|
NE_NumRichTextSlots = numSlots;
|
||||||
|
NE_RichTextInfo = calloc(sizeof(ne_rich_textinfo_t), NE_NumRichTextSlots);
|
||||||
|
if (NE_RichTextInfo == NULL)
|
||||||
|
{
|
||||||
|
NE_DebugPrint("Failed to allocate array for NE_RichTextInfo");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
void NE_RichTextResetSystem(void)
|
void NE_RichTextResetSystem(void)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NE_MAX_RICH_TEXT_FONTS; i++)
|
for (int i = 0; i < NE_NumRichTextSlots; i++)
|
||||||
NE_RichTextEnd(i);
|
NE_RichTextEnd(i);
|
||||||
|
free(NE_RichTextInfo);
|
||||||
|
NE_NumRichTextSlots = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int NE_RichTextMetadataLoadFAT(u32 slot, const char *path)
|
int NE_RichTextMetadataLoadFAT(u32 slot, const char *path)
|
||||||
{
|
{
|
||||||
NE_AssertPointer(path, "NULL path pointer");
|
NE_AssertPointer(path, "NULL path pointer");
|
||||||
|
|
||||||
if (slot >= NE_MAX_RICH_TEXT_FONTS)
|
if (slot >= NE_NumRichTextSlots)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
||||||
@ -131,7 +156,7 @@ int NE_RichTextMetadataLoadMemory(u32 slot, const void *data, size_t data_size)
|
|||||||
{
|
{
|
||||||
NE_AssertPointer(data, "NULL data pointer");
|
NE_AssertPointer(data, "NULL data pointer");
|
||||||
|
|
||||||
if (slot >= NE_MAX_RICH_TEXT_FONTS)
|
if (slot >= NE_NumRichTextSlots)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
||||||
@ -155,7 +180,7 @@ int NE_RichTextMaterialLoadGRF(u32 slot, const char *path)
|
|||||||
{
|
{
|
||||||
NE_AssertPointer(path, "NULL path pointer");
|
NE_AssertPointer(path, "NULL path pointer");
|
||||||
|
|
||||||
if (slot >= NE_MAX_RICH_TEXT_FONTS)
|
if (slot >= NE_NumRichTextSlots)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
||||||
@ -181,7 +206,7 @@ int NE_RichTextMaterialSet(u32 slot, NE_Material *mat, NE_Palette *pal)
|
|||||||
{
|
{
|
||||||
NE_AssertPointer(mat, "NULL material pointer");
|
NE_AssertPointer(mat, "NULL material pointer");
|
||||||
|
|
||||||
if (slot >= NE_MAX_RICH_TEXT_FONTS)
|
if (slot >= NE_NumRichTextSlots)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
||||||
@ -204,7 +229,7 @@ int NE_RichTextBitmapLoadGRF(u32 slot, const char *path)
|
|||||||
#else // NE_BLOCKSDS
|
#else // NE_BLOCKSDS
|
||||||
NE_AssertPointer(path, "NULL path pointer");
|
NE_AssertPointer(path, "NULL path pointer");
|
||||||
|
|
||||||
if (slot >= NE_MAX_RICH_TEXT_FONTS)
|
if (slot >= NE_NumRichTextSlots)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
||||||
@ -307,7 +332,7 @@ int NE_RichTextBitmapSet(u32 slot, const void *texture_buffer,
|
|||||||
NE_AssertPointer(texture_buffer, "NULL texture pointer");
|
NE_AssertPointer(texture_buffer, "NULL texture pointer");
|
||||||
NE_AssertPointer(palette_buffer, "NULL palette pointer");
|
NE_AssertPointer(palette_buffer, "NULL palette pointer");
|
||||||
|
|
||||||
if (slot >= NE_MAX_RICH_TEXT_FONTS)
|
if (slot >= NE_NumRichTextSlots)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
||||||
@ -334,33 +359,45 @@ int NE_RichTextBitmapSet(u32 slot, const void *texture_buffer,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int NE_RichTextRenderDryRun(u32 slot, const char *str,
|
int NE_RichTextRenderDryRunWithPos(u32 slot, const char *str,
|
||||||
size_t *size_x, size_t *size_y)
|
size_t *size_x, size_t *size_y,
|
||||||
|
size_t *final_x, size_t *final_y)
|
||||||
{
|
{
|
||||||
NE_AssertPointer(str, "NULL str pointer");
|
NE_AssertPointer(str, "NULL str pointer");
|
||||||
NE_AssertPointer(size_x, "NULL size X pointer");
|
NE_AssertPointer(size_x, "NULL size X pointer");
|
||||||
NE_AssertPointer(size_y, "NULL size Y pointer");
|
NE_AssertPointer(size_y, "NULL size Y pointer");
|
||||||
|
NE_AssertPointer(final_x, "NULL final X pointer");
|
||||||
|
NE_AssertPointer(final_y, "NULL final Y pointer");
|
||||||
|
|
||||||
if (slot >= NE_MAX_RICH_TEXT_FONTS)
|
if (slot >= NE_NumRichTextSlots)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
||||||
if (!info->active)
|
if (!info->active)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
dsf_error err = DSF_StringRenderDryRun(info->handle, str,
|
dsf_error err = DSF_StringRenderDryRunWithCursor(info->handle, str,
|
||||||
size_x, size_y);
|
size_x, size_y,
|
||||||
|
final_x, final_y);
|
||||||
if (err != DSF_NO_ERROR)
|
if (err != DSF_NO_ERROR)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int NE_RichTextRender3D(u32 slot, const char *str, s32 x, s32 y)
|
int NE_RichTextRenderDryRun(u32 slot, const char *str,
|
||||||
|
size_t *size_x, size_t *size_y)
|
||||||
|
{
|
||||||
|
size_t final_x, final_y;
|
||||||
|
return NE_RichTextRenderDryRunWithPos(slot, str, size_x, size_y, &final_x, &final_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
int NE_RichTextRender3DWithIndent(u32 slot, const char *str, s32 x, s32 y,
|
||||||
|
s32 xIndent)
|
||||||
{
|
{
|
||||||
NE_AssertPointer(str, "NULL str pointer");
|
NE_AssertPointer(str, "NULL str pointer");
|
||||||
|
|
||||||
if (slot >= NE_MAX_RICH_TEXT_FONTS)
|
if (slot >= NE_NumRichTextSlots)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
||||||
@ -369,8 +406,37 @@ int NE_RichTextRender3D(u32 slot, const char *str, s32 x, s32 y)
|
|||||||
|
|
||||||
NE_MaterialUse(info->material);
|
NE_MaterialUse(info->material);
|
||||||
|
|
||||||
dsf_error err = DSF_StringRender3D(info->handle, str, x, y,
|
dsf_error err = DSF_StringRender3DWithIndent(info->handle, str, x, y,
|
||||||
NE_RICH_TEXT_PRIORITY);
|
NE_RICH_TEXT_PRIORITY, xIndent);
|
||||||
|
if (err != DSF_NO_ERROR)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int NE_RichTextRender3D(u32 slot, const char *str, s32 x, s32 y)
|
||||||
|
{
|
||||||
|
return NE_RichTextRender3DWithIndent(slot, str, x, y, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int NE_RichTextRender3DAlphaWithIndent(u32 slot, const char *str, s32 x, s32 y,
|
||||||
|
uint32_t poly_fmt, int poly_id_base,
|
||||||
|
s32 xIndent)
|
||||||
|
{
|
||||||
|
NE_AssertPointer(str, "NULL str pointer");
|
||||||
|
|
||||||
|
if (slot >= NE_NumRichTextSlots)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
||||||
|
if (!info->active)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
NE_MaterialUse(info->material);
|
||||||
|
|
||||||
|
dsf_error err = DSF_StringRender3DAlphaWithIndent(info->handle, str, x, y,
|
||||||
|
NE_RICH_TEXT_PRIORITY,
|
||||||
|
poly_fmt, poly_id_base, xIndent);
|
||||||
if (err != DSF_NO_ERROR)
|
if (err != DSF_NO_ERROR)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -380,24 +446,7 @@ int NE_RichTextRender3D(u32 slot, const char *str, s32 x, s32 y)
|
|||||||
int NE_RichTextRender3DAlpha(u32 slot, const char *str, s32 x, s32 y,
|
int NE_RichTextRender3DAlpha(u32 slot, const char *str, s32 x, s32 y,
|
||||||
uint32_t poly_fmt, int poly_id_base)
|
uint32_t poly_fmt, int poly_id_base)
|
||||||
{
|
{
|
||||||
NE_AssertPointer(str, "NULL str pointer");
|
return NE_RichTextRender3DAlphaWithIndent(slot, str, x, y, poly_fmt, poly_id_base, 0);
|
||||||
|
|
||||||
if (slot >= NE_MAX_RICH_TEXT_FONTS)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
|
||||||
if (!info->active)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
NE_MaterialUse(info->material);
|
|
||||||
|
|
||||||
dsf_error err = DSF_StringRender3DAlpha(info->handle, str, x, y,
|
|
||||||
NE_RICH_TEXT_PRIORITY,
|
|
||||||
poly_fmt, poly_id_base);
|
|
||||||
if (err != DSF_NO_ERROR)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int NE_RichTextRenderMaterial(u32 slot, const char *str, NE_Material **mat,
|
int NE_RichTextRenderMaterial(u32 slot, const char *str, NE_Material **mat,
|
||||||
@ -407,7 +456,7 @@ int NE_RichTextRenderMaterial(u32 slot, const char *str, NE_Material **mat,
|
|||||||
NE_AssertPointer(mat, "NULL mat pointer");
|
NE_AssertPointer(mat, "NULL mat pointer");
|
||||||
NE_AssertPointer(pal, "NULL pal pointer");
|
NE_AssertPointer(pal, "NULL pal pointer");
|
||||||
|
|
||||||
if (slot >= NE_MAX_RICH_TEXT_FONTS)
|
if (slot >= NE_NumRichTextSlots)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
ne_rich_textinfo_t *info = &NE_RichTextInfo[slot];
|
||||||
|
@ -537,23 +537,27 @@ static dsf_error DSF_CodepointRender3D(dsf_handle handle, uint32_t codepoint,
|
|||||||
return DSF_NO_ERROR;
|
return DSF_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
dsf_error DSF_StringRenderDryRun(dsf_handle handle, const char *str,
|
dsf_error DSF_StringRenderDryRunWithCursor(dsf_handle handle, const char *str,
|
||||||
size_t *size_x, size_t *size_y)
|
size_t *size_x, size_t *size_y,
|
||||||
|
size_t *final_x, size_t *final_y)
|
||||||
{
|
{
|
||||||
if ((handle == 0) || (str == NULL) || (size_x == NULL) || (size_y == NULL))
|
if ((handle == 0) || (str == NULL) || (size_x == NULL) || (size_y == NULL) ||
|
||||||
|
(final_x == NULL) || (final_y == NULL))
|
||||||
return DSF_INVALID_ARGUMENT;
|
return DSF_INVALID_ARGUMENT;
|
||||||
|
|
||||||
|
dsf_font_internal_state *font = (dsf_font_internal_state *)handle;
|
||||||
|
|
||||||
if (strlen(str) == 0)
|
if (strlen(str) == 0)
|
||||||
{
|
{
|
||||||
*size_x = 0;
|
*size_x = 0;
|
||||||
*size_y = 0;
|
*size_y = 0;
|
||||||
|
*final_x = font->pointer_x;
|
||||||
|
*final_y = font->pointer_y;
|
||||||
return DSF_NO_ERROR;
|
return DSF_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
dsf_error ret = DSF_NO_ERROR;
|
dsf_error ret = DSF_NO_ERROR;
|
||||||
|
|
||||||
dsf_font_internal_state *font = (dsf_font_internal_state *)handle;
|
|
||||||
|
|
||||||
font->pointer_x = 0;
|
font->pointer_x = 0;
|
||||||
font->pointer_y = 0;
|
font->pointer_y = 0;
|
||||||
font->box_left = 0;
|
font->box_left = 0;
|
||||||
@ -587,8 +591,16 @@ dsf_error DSF_StringRenderDryRun(dsf_handle handle, const char *str,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
dsf_error DSF_StringRender3D(dsf_handle handle, const char *str,
|
dsf_error DSF_StringRenderDryRun(dsf_handle handle, const char *str,
|
||||||
int32_t x, int32_t y, int32_t z)
|
size_t *size_x, size_t *size_y)
|
||||||
|
{
|
||||||
|
size_t final_x, final_y;
|
||||||
|
return DSF_StringRenderDryRunWithCursor(handle, str, size_x, size_y, &final_x, &final_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
dsf_error DSF_StringRender3DWithIndent(dsf_handle handle, const char *str,
|
||||||
|
int32_t x, int32_t y, int32_t z,
|
||||||
|
int32_t xStart)
|
||||||
{
|
{
|
||||||
if ((handle == 0) || (str == NULL))
|
if ((handle == 0) || (str == NULL))
|
||||||
return DSF_INVALID_ARGUMENT;
|
return DSF_INVALID_ARGUMENT;
|
||||||
@ -597,7 +609,7 @@ dsf_error DSF_StringRender3D(dsf_handle handle, const char *str,
|
|||||||
|
|
||||||
dsf_font_internal_state *font = (dsf_font_internal_state *)handle;
|
dsf_font_internal_state *font = (dsf_font_internal_state *)handle;
|
||||||
|
|
||||||
font->pointer_x = x;
|
font->pointer_x = x + xStart;
|
||||||
font->pointer_y = y;
|
font->pointer_y = y;
|
||||||
font->box_left = x;
|
font->box_left = x;
|
||||||
font->box_top = y;
|
font->box_top = y;
|
||||||
@ -623,9 +635,16 @@ dsf_error DSF_StringRender3D(dsf_handle handle, const char *str,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
dsf_error DSF_StringRender3DAlpha(dsf_handle handle, const char *str,
|
dsf_error DSF_StringRender3D(dsf_handle handle, const char *str,
|
||||||
|
int32_t x, int32_t y, int32_t z)
|
||||||
|
{
|
||||||
|
return DSF_StringRender3DWithIndent(handle, str, x, y, z, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
dsf_error DSF_StringRender3DAlphaWithIndent(dsf_handle handle, const char *str,
|
||||||
int32_t x, int32_t y, int32_t z,
|
int32_t x, int32_t y, int32_t z,
|
||||||
uint32_t poly_fmt, int poly_id_base)
|
uint32_t poly_fmt, int poly_id_base,
|
||||||
|
int32_t xStart)
|
||||||
{
|
{
|
||||||
if ((handle == 0) || (str == NULL))
|
if ((handle == 0) || (str == NULL))
|
||||||
return DSF_INVALID_ARGUMENT;
|
return DSF_INVALID_ARGUMENT;
|
||||||
@ -634,7 +653,7 @@ dsf_error DSF_StringRender3DAlpha(dsf_handle handle, const char *str,
|
|||||||
|
|
||||||
dsf_font_internal_state *font = (dsf_font_internal_state *)handle;
|
dsf_font_internal_state *font = (dsf_font_internal_state *)handle;
|
||||||
|
|
||||||
font->pointer_x = x;
|
font->pointer_x = x + xStart;
|
||||||
font->pointer_y = y;
|
font->pointer_y = y;
|
||||||
font->box_left = x;
|
font->box_left = x;
|
||||||
font->box_top = y;
|
font->box_top = y;
|
||||||
@ -663,6 +682,13 @@ dsf_error DSF_StringRender3DAlpha(dsf_handle handle, const char *str,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dsf_error DSF_StringRender3DAlpha(dsf_handle handle, const char *str,
|
||||||
|
int32_t x, int32_t y, int32_t z,
|
||||||
|
uint32_t poly_fmt, int poly_id_base)
|
||||||
|
{
|
||||||
|
return DSF_StringRender3DAlphaWithIndent(handle, str, x, y, z, poly_fmt, poly_id_base, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static dsf_error DSF_CodepointRenderBuffer(dsf_handle handle,
|
static dsf_error DSF_CodepointRenderBuffer(dsf_handle handle,
|
||||||
uint32_t codepoint, unsigned int texture_fmt,
|
uint32_t codepoint, unsigned int texture_fmt,
|
||||||
const void *font_texture, size_t font_width, size_t font_height,
|
const void *font_texture, size_t font_width, size_t font_height,
|
||||||
|
@ -93,6 +93,18 @@ dsf_error DSF_FreeFont(dsf_handle *handle);
|
|||||||
/// @defgroup libdsf_render Functions to draw text strings.
|
/// @defgroup libdsf_render Functions to draw text strings.
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
/// @param handle Handler of the font to use.
|
||||||
|
/// @param str String to print.
|
||||||
|
/// @param size_x Pointer to a variable to store the size.
|
||||||
|
/// @param size_y Pointer to a variable to store the size.
|
||||||
|
/// @param final_x Pointer to a variable to store the final X cursor position.
|
||||||
|
/// @param final_y Pointer to a variable to store the final Y cursor position.
|
||||||
|
///
|
||||||
|
/// @return An error code or DSF_NO_ERROR on success.
|
||||||
|
dsf_error DSF_StringRenderDryRunWithCursor(dsf_handle handle, const char *str,
|
||||||
|
size_t *size_x, size_t *size_y,
|
||||||
|
size_t *final_x, size_t *final_y);
|
||||||
|
|
||||||
/// Pretend to render a string to calculate its final size once rendered.
|
/// Pretend to render a string to calculate its final size once rendered.
|
||||||
///
|
///
|
||||||
/// @param handle Handler of the font to use.
|
/// @param handle Handler of the font to use.
|
||||||
@ -104,6 +116,20 @@ dsf_error DSF_FreeFont(dsf_handle *handle);
|
|||||||
dsf_error DSF_StringRenderDryRun(dsf_handle handle, const char *str,
|
dsf_error DSF_StringRenderDryRun(dsf_handle handle, const char *str,
|
||||||
size_t *size_x, size_t *size_y);
|
size_t *size_x, size_t *size_y);
|
||||||
|
|
||||||
|
/// Render a string by rendering one 3D quad per codepoint.
|
||||||
|
///
|
||||||
|
/// @param handle Handler of the font to use.
|
||||||
|
/// @param str String to print.
|
||||||
|
/// @param x Top x coordinate (0 to 255, but you can go outside of that).
|
||||||
|
/// @param y Left y coordinate (0 to 191, but you can go outside of that).
|
||||||
|
/// @param z Z coordinate (depth).
|
||||||
|
/// @param xStart The horizontal component of the cursor's starting offset (reset to x on line break)
|
||||||
|
///
|
||||||
|
/// @return An error code or DSF_NO_ERROR on success.
|
||||||
|
dsf_error DSF_StringRender3DWithIndent(dsf_handle handle, const char *str,
|
||||||
|
int32_t x, int32_t y, int32_t z,
|
||||||
|
int32_t xStart);
|
||||||
|
|
||||||
/// Render a string by rendering one 3D quad per codepoint.
|
/// Render a string by rendering one 3D quad per codepoint.
|
||||||
///
|
///
|
||||||
/// @param handle Handler of the font to use.
|
/// @param handle Handler of the font to use.
|
||||||
@ -116,6 +142,32 @@ dsf_error DSF_StringRenderDryRun(dsf_handle handle, const char *str,
|
|||||||
dsf_error DSF_StringRender3D(dsf_handle handle, const char *str,
|
dsf_error DSF_StringRender3D(dsf_handle handle, const char *str,
|
||||||
int32_t x, int32_t y, int32_t z);
|
int32_t x, int32_t y, int32_t z);
|
||||||
|
|
||||||
|
/// Render a string by rendering one 3D quad per codepoint with alternating
|
||||||
|
/// polygon IDs.
|
||||||
|
///
|
||||||
|
/// This function will alternate between polygon IDs so that alpha blending
|
||||||
|
/// works between multiple polygons when they overlap. This is a requirement of
|
||||||
|
/// the NDS 3D hardware.
|
||||||
|
///
|
||||||
|
/// It is required to pass the base polygon format as a parameter because the
|
||||||
|
/// polygon format data is write-only. Whenever the polygon ID needs to be
|
||||||
|
/// changed, the rest of the polygon format flags need to be set as well.
|
||||||
|
///
|
||||||
|
/// @param handle Handler of the font to use.
|
||||||
|
/// @param str String to print.
|
||||||
|
/// @param x Top x coordinate (0 to 255, but you can go outside of that).
|
||||||
|
/// @param y Left y coordinate (0 to 191, but you can go outside of that).
|
||||||
|
/// @param z Z coordinate (depth).
|
||||||
|
/// @param poly_fmt Polygon formats to apply to the characters.
|
||||||
|
/// @param poly_id_base poly_id_base and poly_id_base + 1 will be used.
|
||||||
|
/// @param xStart The horizontal component of the cursor's starting offset (reset to x on line break)
|
||||||
|
///
|
||||||
|
/// @return An error code or DSF_NO_ERROR on success.
|
||||||
|
dsf_error DSF_StringRender3DAlphaWithIndent(dsf_handle handle, const char *str,
|
||||||
|
int32_t x, int32_t y, int32_t z,
|
||||||
|
uint32_t poly_fmt, int poly_id_base,
|
||||||
|
int32_t xStart);
|
||||||
|
|
||||||
/// Render a string by rendering one 3D quad per codepoint with alternating
|
/// Render a string by rendering one 3D quad per codepoint with alternating
|
||||||
/// polygon IDs.
|
/// polygon IDs.
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user