Compare commits

...

43 Commits

Author SHA1 Message Date
Antonio Niño Díaz
cc40a1daad examples: Add example of using affine sprites 2025-06-17 00:20:04 +01:00
Antonio Niño Díaz
0159fb67bf examples: Rename "affine" example to "bgaffine" for clarity 2025-06-16 23:41:48 +01:00
Antonio Niño Díaz
f834dd6bcb docs: library: Update changelog and version number to 1.1.9 2025-03-26 18:11:06 +00:00
Antonio Niño Díaz
2089aab7f9 build: Build library with debug symbols enabled
They are excluded from the final binaries, so the only effect of this is
to help with debugging by using a bit more of disk space.
2025-03-26 18:10:00 +00:00
Antonio Niño Díaz
45eacf3336 docs: Update changelog 2025-03-24 21:27:22 +00:00
Antonio Niño Díaz
e4fd0ba9b6 examples: Look for path of BlocksDS toolchain in convert.sh
Instead of hardcoding the path, check if the environment variable BLOCKSDS
has been set and use its value instead.
2025-03-24 21:26:32 +00:00
Antonio Niño Díaz
dc1de0cd56 build: docs: Remove all outdated devkitARM makefiles
They don't work. Even if they were updated, the code will require changes,
as well as the examples. For now, it's better to remove the makefiles than
to pretend we support devkitARM.
2025-03-24 20:57:15 +00:00
Antonio Niño Díaz
fc762cb9c3 docs: library: Update changelog and update version 2025-02-28 01:24:15 +00:00
Antonio Niño Díaz
ffb023de49 examples: Fix crash in udptalk example
In BlocksDS, close() only works for files, not for sockets. Instead, it is
needed to use closesocket(), which is provided by DSWifi.
2025-02-17 00:36:05 +00:00
ThorTuwy
e6242613c9 library: Fix 32x64 sprite size definition 2025-02-09 12:48:26 +01:00
ThorTuwy
3002fad8d1 examples: Add example to show all possible 2D sprite sizes 2025-02-09 12:48:10 +01:00
Antonio Niño Díaz
b80d754974 docs: library: Update changelog and update version number to 1.1.7 2025-01-15 18:22:34 +00:00
Antonio Niño Díaz
e4171984aa docs: Add note about devkitARM support 2025-01-15 18:20:59 +00:00
Antonio Niño Díaz
8228b95a85 docs: Mention BlocksDS package in setup instructions 2025-01-14 01:27:08 +00:00
Antonio Niño Díaz
659ea7f5cd build: Use ar from ARM toolchain instead of the host 2024-12-30 02:18:46 +01:00
Antonio Niño Díaz
62df61ca36 docs: library: Update changelog and bump version to 1.1.6 2024-12-23 00:45:34 +01:00
Antonio Niño Díaz
9827b42f35 build: Copy licenses when installing library 2024-12-01 13:44:01 +00:00
Antonio Niño Díaz
b9cbe66d3a library: Update link to nds-hb-menu 2024-11-28 02:50:51 +00:00
BG2CNT
bedb6b1b3a sprite256: Fix doc typo in NF_VramSpritePal 2024-09-27 17:56:21 +01:00
Antonio Niño Díaz
67f129bc1e docs: library: Update changelog and bump version number 2024-09-10 18:23:38 +01:00
Antonio Niño Díaz
0079268fcd examples: template: Update BlocksDS makefiles
They have been updated a few times in the BlocksDS repository, but not
here.
2024-08-13 19:50:29 +01:00
Antonio Niño Díaz
86c952817f docs: Fix link 2024-08-01 18:40:43 +01:00
Antonio Niño Díaz
4abfaca8a2 docs: Update Doxyfile 2024-08-01 18:02:45 +01:00
Antonio Niño Díaz
50437c3839 docs: library: Update changelog and bump version to 1.1.4 2024-07-06 12:44:47 +01:00
Antonio Niño Díaz
d892d6cc8a library: Fix '\n' in NF_WriteText16()
Also, slightly rework the code of NF_WriteText() to match the code sytle
of the rest of the library.
2024-07-06 12:44:24 +01:00
Antonio Niño Díaz
70fe30ef29 library: Fix typo 2024-06-22 11:27:25 +01:00
Antonio Niño Díaz
418791f8f2 library: Update extensions of custom maps and fonts
It's better to use the natural extensions of grit rather than the modified
extensions of NFLib. Update the documentation to reflect that.

Also, remove references to bat scripts.
2024-06-20 01:22:50 +01:00
Antonio Niño Díaz
e2a8e1ad4d examples: Remove duplicated assets conversion script 2024-06-20 01:22:50 +01:00
BG2CNT
c5c64a5cc1
library: fix up "\n" bug in NF_WriteText 2024-06-17 22:56:46 +02:00
BG2CNT
92007d25f8
library: Fix version number 2024-06-17 16:33:22 +01:00
Antonio Niño Díaz
e7ec60cf47 docs: Update changelog 2024-06-08 12:50:52 +01:00
Antonio Niño Díaz
e6567ee10f library: Improve error checking when loading files 2024-06-03 02:20:28 +01:00
Antonio Niño Díaz
71700aab03 examples: Fix tilechange example
Using a different version of grit has changed slightly the output. The code
needs to be updated to use the new tile indices.
2024-06-03 02:00:22 +01:00
Antonio Niño Díaz
72010704c4 examples: Update scripts to use grit from BlocksDS
This version of grit lets the user export binary file without ".bin"
after ".img", ".pal" or ".map", so the conversion scripts can be simplified
a lot.

All the converted files have been regenerated.
2024-06-03 01:08:07 +01:00
Antonio Niño Díaz
194561993a build: docs: example: Set BlocksDS as primary toolchain
The main reason is that BlocksDS doesn't have any bug with NitroFS, and
NitroFS is strictly required to use NFlib. With devkitPro, melonDS won't be
able to run any program made with NFlib due to a bug with NitroFS.
2024-06-03 00:27:39 +01:00
Antonio Niño Díaz
3b106b9f36 docs: Add note about ArchitectDS to the readme 2024-06-01 02:03:16 +01:00
Antonio Niño Díaz
537748791e docs: Update changelog 2024-03-30 11:52:23 +00:00
Antonio Niño Díaz
e9f12e4aee templates: examples: Fix linker invocation for C++
Using g++ to link object files automatically links the STD of C++. It looks
like this library is linked outside of the start/end-group commands with
the other libraries, which causes undefined reference errors when linking
C++ projects that use standard library functions that interface with the
OS, like `fopen()`.

Thanks to @lifehackerhansol for the report and testing the fix.
2024-03-26 18:57:01 +00:00
Antonio Niño Díaz
fb3168e87f docs: Turn changelog into a rst file 2024-01-28 02:50:48 +00:00
Antonio Niño Díaz
30bdb320c8 docs: library: Update version to 1.1.1 2024-01-28 02:45:31 +00:00
Antonio Niño Díaz
06557f1773 library: Support colmaps with extensions .map and .img
Currently it is needed to rename the extension of the collision maps
from .img and .map to .dat and .cmp for NFlib to find the files. This
patch makes it also try to load the original extensions so that the
renaming isn't required.
2023-12-24 03:05:46 +01:00
Antonio Niño Díaz
ba8ba3c3b3 library: Add helper to detect if a file exists 2023-12-24 03:05:33 +01:00
Antonio Niño Díaz
331eee9737 library: Support fonts with extension .img
Currently it is needed to rename the extension of the font to .fnt from
.img for NFlib to find the files. This patch makes it also try to load a
.img file so that the renaming isn't required.
2023-12-24 02:48:44 +01:00
383 changed files with 2525 additions and 12557 deletions

661
Doxyfile

File diff suppressed because it is too large Load Diff

256
Makefile
View File

@ -1,124 +1,192 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
BLOCKSDS ?= /opt/blocksds/core
BLOCKSDSEXT ?= /opt/blocksds/external
include $(DEVKITARM)/ds_rules
WONDERFUL_TOOLCHAIN ?= /opt/wonderful
ARM_NONE_EABI_PATH ?= $(WONDERFUL_TOOLCHAIN)/toolchain/gcc-arm-none-eabi/bin/
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
#---------------------------------------------------------------------------------
TARGET := nflib
BUILD := build
SOURCES := source
DATA := data
INCLUDES := include
# Source code paths
# -----------------
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -mthumb -mthumb-interwork
SOURCEDIRS := source
INCLUDEDIRS := include
GFXDIRS :=
BINDIRS :=
CFLAGS := -g -Wall -O2\
-march=armv5te -mtune=arm946e-s \
-fomit-frame-pointer -ffast-math \
$(ARCH)
# Defines passed to all files
# ---------------------------
CFLAGS += $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
DEFINES := -DBLOCKSDS
ASFLAGS := -g $(ARCH) -march=armv5te -mtune=arm946e-s
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
# Libraries
# ---------
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS)
LIBDIRS := $(BLOCKSDS)/libs/libnds $(BLOCKSDS)/libs/dswifi
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
# Build artifacts
# ---------------
export OUTPUT := $(CURDIR)/lib/lib$(TARGET).a
NAME := nflib
INSTALLNAME := nflib
BUILDDIR := build
ARCHIVE := lib/lib$(NAME).a
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
# Tools
# -----
export DEPSDIR := $(CURDIR)/$(BUILD)
PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi-
CC := $(PREFIX)gcc
CXX := $(PREFIX)g++
AR := $(PREFIX)ar
MKDIR := mkdir
RM := rm -rf
CP := cp
INSTALL := install
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)/*.*)))
# Verbose flag
# ------------
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
ifeq ($(VERBOSE),1)
V :=
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
V := @
endif
#---------------------------------------------------------------------------------
export OFILES := $(addsuffix .o,$(BINFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
# Source files
# ------------
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
ifneq ($(BINDIRS),)
SOURCES_BIN := $(shell find -L $(BINDIRS) -name "*.bin")
INCLUDEDIRS += $(addprefix $(BUILDDIR)/,$(BINDIRS))
endif
ifneq ($(GFXDIRS),)
SOURCES_PNG := $(shell find -L $(GFXDIRS) -name "*.png")
INCLUDEDIRS += $(addprefix $(BUILDDIR)/,$(GFXDIRS))
endif
.PHONY: $(BUILD) clean all
SOURCES_S := $(shell find -L $(SOURCEDIRS) -name "*.s")
SOURCES_C := $(shell find -L $(SOURCEDIRS) -name "*.c")
SOURCES_CPP := $(shell find -L $(SOURCEDIRS) -name "*.cpp")
#---------------------------------------------------------------------------------
all: $(BUILD)
# Compiler and linker flags
# -------------------------
lib:
@[ -d $@ ] || mkdir -p $@
$(BUILD): lib
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
DEFINES += -D__NDS__ -DARM9
ARCH := -march=armv5te -mtune=arm946e-s
WARNFLAGS := -Wall -Wextra
INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \
$(foreach path,$(LIBDIRS),-I$(path)/include)
ASFLAGS += -g -x assembler-with-cpp $(DEFINES) $(ARCH) \
-mthumb -mthumb-interwork $(INCLUDEFLAGS) \
-ffunction-sections -fdata-sections
CFLAGS += -g -std=gnu11 $(WARNFLAGS) $(DEFINES) $(ARCH) \
-mthumb -mthumb-interwork $(INCLUDEFLAGS) -O2 \
-ffunction-sections -fdata-sections \
-fomit-frame-pointer
CXXFLAGS += -g -std=gnu++14 $(WARNFLAGS) $(DEFINES) $(ARCH) \
-mthumb -mthumb-interwork $(INCLUDEFLAGS) -O2 \
-ffunction-sections -fdata-sections \
-fno-exceptions -fno-rtti \
-fomit-frame-pointer
# Intermediate build files
# ------------------------
OBJS_ASSETS := $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN))) \
$(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_PNG)))
HEADERS_ASSETS := $(patsubst %.bin,%_bin.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN))) \
$(patsubst %.png,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_PNG)))
OBJS_SOURCES := $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_S))) \
$(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_C))) \
$(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_CPP)))
OBJS := $(OBJS_ASSETS) $(OBJS_SOURCES)
DEPS := $(OBJS:.o=.d)
# Targets
# -------
.PHONY: all clean docs install
all: $(ARCHIVE)
$(ARCHIVE): $(OBJS)
@echo " AR $@"
@$(MKDIR) -p $(@D)
$(V)$(AR) rcs $@ $(OBJS)
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) lib
@echo " CLEAN"
$(V)$(RM) $(ARCHIVE) $(BUILDDIR)
#---------------------------------------------------------------------------------
else
install: all
@echo " INSTALL $(BLOCKSDSEXT)/$(INSTALLNAME)/"
$(V)$(RM) $(BLOCKSDSEXT)/$(INSTALLNAME)/
$(V)$(INSTALL) -d $(BLOCKSDSEXT)/$(INSTALLNAME)/
$(V)$(CP) -r include lib licenses $(BLOCKSDSEXT)/$(INSTALLNAME)/
DEPENDS := $(OFILES:.o=.d)
docs:
$(V)doxygen Doxyfile
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT) : $(OFILES)
# Rules
# -----
#---------------------------------------------------------------------------------
%.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
$(BUILDDIR)/%.s.o : %.s
@echo " AS $<"
@$(MKDIR) -p $(@D)
$(V)$(CC) $(ASFLAGS) -MMD -MP -c -o $@ $<
$(BUILDDIR)/%.c.o : %.c
@echo " CC $<"
@$(MKDIR) -p $(@D)
$(V)$(CC) $(CFLAGS) -MMD -MP -c -o $@ $<
-include $(DEPENDS)
$(BUILDDIR)/%.arm.c.o : %.arm.c
@echo " CC $<"
@$(MKDIR) -p $(@D)
$(V)$(CC) $(CFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $<
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
$(BUILDDIR)/%.cpp.o : %.cpp
@echo " CXX $<"
@$(MKDIR) -p $(@D)
$(V)$(CXX) $(CXXFLAGS) -MMD -MP -c -o $@ $<
$(BUILDDIR)/%.arm.cpp.o : %.arm.cpp
@echo " CXX $<"
@$(MKDIR) -p $(@D)
$(V)$(CXX) $(CXXFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $<
$(BUILDDIR)/%.bin.o $(BUILDDIR)/%_bin.h : %.bin
@echo " BIN2C $<"
@$(MKDIR) -p $(@D)
$(V)$(BLOCKSDS)/tools/bin2c/bin2c $< $(@D)
$(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.bin.o $(BUILDDIR)/$*_bin.c
$(BUILDDIR)/%.png.o $(BUILDDIR)/%.h : %.png %.grit
@echo " GRIT $<"
@$(MKDIR) -p $(@D)
$(V)$(BLOCKSDS)/tools/grit/grit $< -ftc -W1 -o$(BUILDDIR)/$*
$(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.c
$(V)touch $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.h
# All assets must be built before the source code
# -----------------------------------------------
$(SOURCES_S) $(SOURCES_C) $(SOURCES_CPP): $(HEADERS_ASSETS)
# Include dependency files if they exist
# --------------------------------------
-include $(DEPS)

View File

@ -1,192 +0,0 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023
BLOCKSDS ?= /opt/blocksds/core
BLOCKSDSEXT ?= /opt/blocksds/external
WONDERFUL_TOOLCHAIN ?= /opt/wonderful
ARM_NONE_EABI_PATH ?= $(WONDERFUL_TOOLCHAIN)/toolchain/gcc-arm-none-eabi/bin/
# Source code paths
# -----------------
SOURCEDIRS := source
INCLUDEDIRS := include
GFXDIRS :=
BINDIRS :=
# Defines passed to all files
# ---------------------------
DEFINES := -DBLOCKSDS
# Libraries
# ---------
LIBDIRS := $(BLOCKSDS)/libs/libnds $(BLOCKSDS)/libs/dswifi
# Build artifacts
# ---------------
NAME := nflib
INSTALLNAME := nflib
BUILDDIR := build
ARCHIVE := lib/lib$(NAME).a
# Tools
# -----
PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi-
CC := $(PREFIX)gcc
CXX := $(PREFIX)g++
AR := ar
MKDIR := mkdir
RM := rm -rf
CP := cp
INSTALL := install
# Verbose flag
# ------------
ifeq ($(VERBOSE),1)
V :=
else
V := @
endif
# Source files
# ------------
ifneq ($(BINDIRS),)
SOURCES_BIN := $(shell find -L $(BINDIRS) -name "*.bin")
INCLUDEDIRS += $(addprefix $(BUILDDIR)/,$(BINDIRS))
endif
ifneq ($(GFXDIRS),)
SOURCES_PNG := $(shell find -L $(GFXDIRS) -name "*.png")
INCLUDEDIRS += $(addprefix $(BUILDDIR)/,$(GFXDIRS))
endif
SOURCES_S := $(shell find -L $(SOURCEDIRS) -name "*.s")
SOURCES_C := $(shell find -L $(SOURCEDIRS) -name "*.c")
SOURCES_CPP := $(shell find -L $(SOURCEDIRS) -name "*.cpp")
# Compiler and linker flags
# -------------------------
DEFINES += -D__NDS__ -DARM9
ARCH := -march=armv5te -mtune=arm946e-s
WARNFLAGS := -Wall -Wextra
INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \
$(foreach path,$(LIBDIRS),-I$(path)/include)
ASFLAGS += -x assembler-with-cpp $(DEFINES) $(ARCH) \
-mthumb -mthumb-interwork $(INCLUDEFLAGS) \
-ffunction-sections -fdata-sections
CFLAGS += -std=gnu11 $(WARNFLAGS) $(DEFINES) $(ARCH) \
-mthumb -mthumb-interwork $(INCLUDEFLAGS) -O2 \
-ffunction-sections -fdata-sections \
-fomit-frame-pointer
CXXFLAGS += -std=gnu++14 $(WARNFLAGS) $(DEFINES) $(ARCH) \
-mthumb -mthumb-interwork $(INCLUDEFLAGS) -O2 \
-ffunction-sections -fdata-sections \
-fno-exceptions -fno-rtti \
-fomit-frame-pointer
# Intermediate build files
# ------------------------
OBJS_ASSETS := $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN))) \
$(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_PNG)))
HEADERS_ASSETS := $(patsubst %.bin,%_bin.h,$(addprefix $(BUILDDIR)/,$(SOURCES_BIN))) \
$(patsubst %.png,%.h,$(addprefix $(BUILDDIR)/,$(SOURCES_PNG)))
OBJS_SOURCES := $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_S))) \
$(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_C))) \
$(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SOURCES_CPP)))
OBJS := $(OBJS_ASSETS) $(OBJS_SOURCES)
DEPS := $(OBJS:.o=.d)
# Targets
# -------
.PHONY: all clean docs install
all: $(ARCHIVE)
$(ARCHIVE): $(OBJS)
@echo " AR $@"
@$(MKDIR) -p $(@D)
$(V)$(AR) rcs $@ $(OBJS)
clean:
@echo " CLEAN"
$(V)$(RM) $(ARCHIVE) $(BUILDDIR)
install: all
@echo " INSTALL $(BLOCKSDSEXT)/$(INSTALLNAME)/"
$(V)$(RM) $(BLOCKSDSEXT)/$(INSTALLNAME)/
$(V)$(INSTALL) -d $(BLOCKSDSEXT)/$(INSTALLNAME)/
$(V)$(CP) -r include lib $(BLOCKSDSEXT)/$(INSTALLNAME)/
docs:
$(V)doxygen Doxyfile
# Rules
# -----
$(BUILDDIR)/%.s.o : %.s
@echo " AS $<"
@$(MKDIR) -p $(@D)
$(V)$(CC) $(ASFLAGS) -MMD -MP -c -o $@ $<
$(BUILDDIR)/%.c.o : %.c
@echo " CC $<"
@$(MKDIR) -p $(@D)
$(V)$(CC) $(CFLAGS) -MMD -MP -c -o $@ $<
$(BUILDDIR)/%.arm.c.o : %.arm.c
@echo " CC $<"
@$(MKDIR) -p $(@D)
$(V)$(CC) $(CFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $<
$(BUILDDIR)/%.cpp.o : %.cpp
@echo " CXX $<"
@$(MKDIR) -p $(@D)
$(V)$(CXX) $(CXXFLAGS) -MMD -MP -c -o $@ $<
$(BUILDDIR)/%.arm.cpp.o : %.arm.cpp
@echo " CXX $<"
@$(MKDIR) -p $(@D)
$(V)$(CXX) $(CXXFLAGS) -MMD -MP -marm -mlong-calls -c -o $@ $<
$(BUILDDIR)/%.bin.o $(BUILDDIR)/%_bin.h : %.bin
@echo " BIN2C $<"
@$(MKDIR) -p $(@D)
$(V)$(BLOCKSDS)/tools/bin2c/bin2c $< $(@D)
$(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.bin.o $(BUILDDIR)/$*_bin.c
$(BUILDDIR)/%.png.o $(BUILDDIR)/%.h : %.png %.grit
@echo " GRIT $<"
@$(MKDIR) -p $(@D)
$(V)$(BLOCKSDS)/tools/grit/grit $< -ftc -W1 -o$(BUILDDIR)/$*
$(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.c
$(V)touch $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.h
# All assets must be built before the source code
# -----------------------------------------------
$(SOURCES_S) $(SOURCES_C) $(SOURCES_CPP): $(HEADERS_ASSETS)
# Include dependency files if they exist
# --------------------------------------
-include $(DEPS)

View File

@ -1,14 +1,75 @@
NightFox's Lib Ver. 1.1.9
-------------------------
- The devkitARM makefiles have been removed as they only work with old versions
of devkitARM, which aren't supported by its maintainers. The code and examples
of NFLib will probably need changes to work with current devkitARM.
- In all scripts to convert assets, check if the environment variable
``BLOCKSDS`` is set, which overrides the default path.
- Build library with debug symbols to help debug applications that use it.
NightFox's Lib Ver. 1.1.8
-------------------------
- Fix 32x64 size definition.
- Add example of using all possible sprite sizes.
- Fix crash in udptalk example.
NightFox's Lib Ver. 1.1.7
-------------------------
- Use the right `ar` binary when building the library.
- Update setup instructions.
NightFox's Lib Ver. 1.1.6
-------------------------
- Copy licenses when installing the library.
- Update link to nds-hb-menu.
- Fix doc typo in NF_VramSpritePal() documentation.
NightFox's Lib Ver. 1.1.5
-------------------------
- Update BlocksDS makefiles.
NightFox's Lib Ver. 1.1.4
-------------------------
- Fix "\n" not working in NF_WriteText() and NF_WriteText16().
- Stop documenting old extensions of custom maps and fonts, use the default grit
extensions instead.
NightFox's Lib Ver. 1.1.3
-------------------------
- Improve error checks when loading files from the filesystem.
- The tilechange example has been fixed.
- BlocksDS is now defined as the recommende toolchain to use with NFLib.
NightFox's Lib Ver. 1.1.2
-------------------------
- Fix C++ builds with BlocksDS.
NightFox's Lib Ver. 1.1.1
-------------------------
- Support files with the default extensions generated by grit instead of the old
custom extensions of NFlib (img, pal, map instead of fnt, dat and cmp).
NightFox's Lib Ver. 1.1.0
--------------------------------------------------------------------------------
-------------------------
- Translate examples comments in library to English.
- Cleanup examples and library files.
- Improve deletion code of 3D sprites
- Update BlocksDS makefiles.
- A few minor fixes.
NightFox's Lib Ver. 1.0.0
--------------------------------------------------------------------------------
-------------------------
- Add original assets and conversion scripts to all examples.
- Start using semver for the version number of the library.
- Big cleanup of the library headers.
@ -16,29 +77,29 @@ NightFox's Lib Ver. 1.0.0
- Move WiFi functions to the main library.
- Added support for BlocksDS.
NightFox's Lib Ver. 20140413
--------------------------------------------------------------------------------
----------------------------
- Recompilada con las ultimas versiones de Libnds.
- Cambios menores en la libreria para compatibilizarla con la r42 de devkitPro.
NightFox's Lib Ver. 20130409
--------------------------------------------------------------------------------
----------------------------
- Optimizaciones menores en varias funciones (GetTile, GetPoint, SetColor...).
- Recompilada con las ultimas versiones de Libnds.
NightFox's Lib Ver. 20120804
--------------------------------------------------------------------------------
----------------------------
- Cambiado el numero maximo de fondos tileados de 32 a 64.
- Deteccion de la memoria VRAM maxima direccionable para sprites dependiendo
del modo iniciado (1D_64 o 1D_128).
NightFox's Lib Ver. 20120318
--------------------------------------------------------------------------------
- Modificada la funcion NF_InitSpriteSys(); Ahora es posible seleccionar,
----------------------------
- Modificada la funcion NF_InitSpriteSys(); Ahora es posible seleccionar,
opcionalmente, el tipo de mapeado de VRAM para sprites, (64 o 128). El mapa
64 divide la VRAM en celdas de 64 bytes, con lo que como mucho podremos usar
64kb para sprites. El modo 128 nos permite usar los 128kb de VRAM, pero en
@ -47,41 +108,37 @@ NightFox's Lib Ver. 20120318
Los proyectos actuales no deberan ser modificados en absoluto si no quereis
usae el modo 128.
NightFox's Lib Ver. 20120317
--------------------------------------------------------------------------------
----------------------------
- Corregido el error de alineamiento de VRAM que provocava que los Sprites de
8x8 pixeles no se mostraran correctamente en algunos casos.
- Libreria recompilada con el devkitArm R37.
- Ajustes en los archivos .h para poder usar la libreria en proyectos c++.
NightFox's Lib Ver. 20111108
--------------------------------------------------------------------------------
----------------------------
- Ajustes en los archivos .h para poder usar la libreria en proyectos c++.
NightFox's Lib Ver. 20111011 - BETA
--------------------------------------------------------------------------------
-----------------------------------
- Optimizada la gestion de VRAM de Sprites y 3D Sprites.
- Corregido bug en la gestion de VRAM de Sprites y 3d Sprites (Muy raramente
se mezclavan graficos al borrar y recrear muchos Sprites).
se mezclaban graficos al borrar y recrear muchos Sprites).
NightFox's Lib Ver. 20110911
--------------------------------------------------------------------------------
----------------------------
- Optimizada la funcion NF_SpriteFrame();
- Removidas las funciones de WIFI de la libreria principal. Ahora se distribuyen
en una libreria a parte.
NightFox's Lib Ver. 20110906
--------------------------------------------------------------------------------
- Añadida la funcion NF_GetLanguage(); la cual devuelve el codigo del idioma
----------------------------
- Añadida la funcion NF_GetLanguage() la cual devuelve el codigo del idioma
seleccionado en la consola. Se añade tambien el ejemplo de uso.
- Los mensages de error de inicializacion de FAT/NitroFS ahora son bilingües
(Español/Ingles), basandose en el Idioma seleccionado en la consola.
@ -89,55 +146,49 @@ NightFox's Lib Ver. 20110906
- Añadida la funcion NF_InitMixedBgSys(); la cual inicializa el modo mixto.
- Revisados los ejemplos y makefile.
NightFox's Lib Ver. 20110424
--------------------------------------------------------------------------------
----------------------------
- Modificada la estructura de control de las texturas en VRAM de los 3dSprites,
para que los datos que contienen puedan ser acedidos desde el codigo del
usuario.
NightFox's Lib Ver. 20110412
--------------------------------------------------------------------------------
----------------------------
- Añadido el soporte para los caracteres ÁÉÍÓÚáéíóúïü¡¿ en el motor de
texto de 8x8.
- Añadido el soporte para los caracteres ¡¿ en el motor de texto de 8x16.
NightFox's Lib Ver. 20110409
--------------------------------------------------------------------------------
----------------------------
- Correcciones en la proyection ortografica de los 3d Sprites.
- Corregido un bug en la desfragmentacion de VRAM de los Sprites y 3dSprites.
- Ajustes en la inicializacion de OpenGL.
NightFox's Lib Ver. 20110215
--------------------------------------------------------------------------------
----------------------------
- Correcciones en la proyection ortografica para ajustar el dibujado de los
3dSprites, habilitando ademas el eje Z.
- Añadida la funcion NF_3dSpriteSetDeep(); la cual permite cambiar la
- Añadida la funcion NF_3dSpriteSetDeep(); la cual permite cambiar la
profundidad donde se dibuja el Sprite, ignorando la prioridad.
- Actualizado el ejemplo "SetPriority" de los 3dSprites.
NightFox's Lib Ver. 20110209
--------------------------------------------------------------------------------
----------------------------
- Añadido soporte para acentos y dieresis (ÁÉÍÓÚáéíóúïü) al motor de texto
de 8x16. (Ver template de la fuente).
- Añadida la funcion NF_3dSpriteEditPalColor();
- Añadida la funcion NF_3dSpriteUpdatePalette();
- Añadida la funcion NF_3dSpriteGetPalColor();
- Añadida la funcion NF_3dSpriteEditPalColor().
- Añadida la funcion NF_3dSpriteUpdatePalette().
- Añadida la funcion NF_3dSpriteGetPalColor().
- Documentacion actualizada para todas las funciones de 3dSprites.
NightFox's Lib Ver. 20101212 - BETA
--------------------------------------------------------------------------------
-----------------------------------
- Añadida la funcion NF_Blend3dSprite(); la cual establece la transparencia
para el sprite seleccionado.
- Añadido el ejemplo de 3dSprites con transparencia.
@ -145,10 +196,9 @@ NightFox's Lib Ver. 20101212 - BETA
donde se dibujaran los Sprites 3D.
- Añadido el ejemplo de uso de la funcion NF_3dSpritesLayer();
NightFox's Lib Ver. 20101128 - BETA
--------------------------------------------------------------------------------
-----------------------------------
- Corregidos algunos comentarios en los ejemplos de Sprites.
- Añadida la funcion NF_LoadColisionBg(); para cargar un fondo de colisiones.
- Añadida la funcion NF_UnloadColisionBg(); para descargar un fondo de
@ -190,26 +240,23 @@ NightFox's Lib Ver. 20101128 - BETA
sobre los ejes indicados.
- Añadidos ejemplos para el uso de 3D Sprites.
NightFox's Lib Ver. 20100901
--------------------------------------------------------------------------------
----------------------------
- Corregido un bug en la funcion NF_SetExBgPal(); la cual no
funcionava correctamente. (Gracias a XIAO32 por el aviso).
- corregido tambien el ejemplo relacionado con las paletas extendidas.
NightFox's Lib Ver. 20100806
--------------------------------------------------------------------------------
----------------------------
- Corregido un bug en la funcion NF_CreateTiledBg(); que almacenava
incorrectamente el tamaño del fondo si este era exactamente de 512x256 o
256x512 pixeles, lo que provocava que el scroll del mismo fuera erratico.
NightFox's Lib Ver. 20100730 - Summer Edition
--------------------------------------------------------------------------------
---------------------------------------------
- Añadido el modo 2 en 2D para poder usar fondos tileados Affine.
- Añadida la funcion NF_InitAffineBgSys(); para inicializar los fondos Affine.
- Añadida la funcion NF_LoadAffineBg(); para la carga de fondos Affine,
@ -233,11 +280,10 @@ NightFox's Lib Ver. 20100730 - Summer Edition
el BAT encargado de convertir las fuentes para que use la version antigua.
- Se recompila la libreria usando la ultima version de devkitarm.
NightFox's Lib Ver. 20100701
--------------------------------------------------------------------------------
- Modificada la funcion NF_GetTile(); devolviendo ahora un valor u16 en
----------------------------
- Modificada la funcion NF_GetTile() devolviendo ahora un valor u16 en
vez de u8.
- En el ejemplo "graphics/bg" eliminada la linea que cargaba dos veces el mismo
fondo. (Gracias a Draco por el aviso).
@ -247,41 +293,46 @@ NightFox's Lib Ver. 20100701
- No se ha modificado la documentacion, dado que no se ha cambiado ninguna de
las funciones de la libreria.
NightFox's Lib Ver. 20100312
--------------------------------------------------------------------------------
----------------------------
- Eliminado el soporte para EFS, dado que la libreria esta obsoleta.
- Añadido soporte para NitroFS, el cual viene de serie con el DevkitArm.
- Actualizados todos los ejemplos para que usen NitroFS en vez de EFS.
- Añadido el "Homebrew menu" para lanzar archivos NDS que usen NitroFS en
flashcards no compatibles con pase de argumentos (int argc, char **argv).
flashcards no compatibles con pase de argumentos ``(int argc, char **argv)``.
Puedes encontrarlo en la carpeta tools.
NightFox's Lib Ver. 20100304
--------------------------------------------------------------------------------
----------------------------
- Libreria recompilada para que funcione con devkitPro R28.
- Modificada la libreria EFS lib para corregir las advertencias durante la
compilacion.
efs_lib.c: In function 'CheckFile':
efs_lib.c(305): warning: array subscript has type 'char'
::
efs_lib.c: In function 'CheckFile':
efs_lib.c(305): warning: array subscript has type 'char'
Se ha modidicado esta linea:
ext[i] = tolower(ext[i]);
::
ext[i] = tolower(ext[i]);
Con estas:
letter = ext[i];
if (letter >= 65 && letter <= 90) letter += 32;
ext[i] = letter;
::
letter = ext[i];
if (letter >= 65 && letter <= 90) letter += 32;
ext[i] = letter;
NightFox's Lib Ver. 20100301
--------------------------------------------------------------------------------
----------------------------
- Añadida la funcion NF_LoadBMP(); la cual carga un archivo BMP de 8, 16 o 24
bits en un slot de imagen de 16 bits.
- Añadido el parametro "alpha" a la funcion NF_Draw16bitsImage(); para decidir
@ -289,10 +340,9 @@ NightFox's Lib Ver. 20100301
- Añadido los ejemplos de carga de archivos en formato BMP.
- Añadido el ejemplo de scroll de una imagen cargada desde un BMP.
NightFox's Lib Ver. 20100209
--------------------------------------------------------------------------------
----------------------------
- Añadido el ejemplo de zoom x2 con interpolacion.
- Añadido el ejemplo de zoom x3 con interpolacion.
- Añadida la funcion NF_Init8bitsBgBuffers(); que inicializa los buffers para
@ -319,10 +369,9 @@ NightFox's Lib Ver. 20100209
- Añadida la funcion NF_Draw16bitsImage(); la cual dibuja una imagen cargada
en RAM en el backbuffer de la pantalla indicada.
NightFox's Lib Ver. 20100203
--------------------------------------------------------------------------------
----------------------------
- Añadida la documentacion de la funcion void NF_RotateTileGfx();
- Añadido el Modo 5 en la funcion NF_Set2D();
- Añadida la funcion NF_InitBitmapBgSys(); la cual inicializa los fondos en
@ -333,7 +382,7 @@ NightFox's Lib Ver. 20100203
los buffers de fondos BITMAP.
- Añadida la funcion NF_Init16bitsBackBuffer(); la cual inicializa los
backbuffers de 16bits.
- Añadida la funcion NF_Enable16bitsBackBuffer(); la cual habilita el
- Añadida la funcion NF_Enable16bitsBackBuffer(); la cual habilita el
BackBuffer de 16 bits en la pantalla indicada.
- Añadida la funcion NF_Disble16bitsBackBuffer(); la cual borra y libera de
la RAM el BackBuffer indicado.
@ -350,11 +399,9 @@ NightFox's Lib Ver. 20100203
- Todas las funciones de copia de la libreria de RAM a VRAM ahora se realizan
usando el canal DMA, lo que acelera el proceso en un 25% aproximadamente.
NightFox's Lib Ver. 20100130
--------------------------------------------------------------------------------
----------------------------
- Añadida la funcion void NF_RotateTileGfx(); la cual rota el grafico de un
tile en la direccion indicada.
- Dado a la funcion anterior, las fuentes para texto no necesitan mas las
@ -368,10 +415,9 @@ NightFox's Lib Ver. 20100130
Y en modo rotado 90º a la derecha.
- Añadido ejemplo de texto con fuentes 8x16 con rotacion.
NightFox's Lib Ver. 20100129
--------------------------------------------------------------------------------
----------------------------
- Añadido soporte para texto de 8x16 sin rotacion.
- Añadida la funcion NF_LoadTextFont16();
- Añadida la funcion NF_CreateTextLayer16();
@ -379,34 +425,30 @@ NightFox's Lib Ver. 20100129
- Añadida la funcion NF_ClearTextLayer16();
- Añadido el ejemplo para textos de 8x16.
NightFox's Lib Ver. 20091231
--------------------------------------------------------------------------------
----------------------------
- Actualizado el Makefile a la version R27.
- Textos: Corregido un bug en la funcion NF_ClearTextLayer(); que provocaba
desbordamientos de memoria al usarla (cosas de poner un bitshift mal por
un despiste).
NightFox's Lib Ver. 20091207
--------------------------------------------------------------------------------
----------------------------
- Ejemplos: Añadido el ejemplo "Wave"
- Ejemplos: Añadido el ejemplo "Water reflect"
- Entorno: Libreria recompilada y probada con el devkitPro R27
NightFox's Lib Ver. 20091202
--------------------------------------------------------------------------------
----------------------------
- Fondos 2D: Añadida la funcion NF_GetTilePal(); que permite obtener el numero
de paleta que usa un tile en concreto entre las 16 disponibles. Por defecto,
los fondos solo cargan una paleta que se carga en el slot 0.
- Fondos 2D: Añadida la funcion NF_SetTilePal(); que permite cambiar el numero
de paleta que usa un tile en concreto entre las 16 disponibles.
- Fondos 2D: Añadida la funcion NF_LoadExBgPal(); la cual carga en un slot en
- Fondos 2D: Añadida la funcion NF_LoadExBgPal(); la cual carga en un slot en
RAM una paleta de fondos para poderla usar luego como paleta extendida.
- Fondos 2D: Añadida la funcion NF_UnloadExBgPal(); la cual borra de la RAM
la paleta del slot especificado.
@ -425,10 +467,8 @@ NightFox's Lib Ver. 20091202
- Ejemplos actualizados.
- Documentacion actualizada.
NightFox's Lib Ver. 20091127
--------------------------------------------------------------------------------
----------------------------
- Fondos 2D: Las funciones de manipulacion de paletas de han renombrado
añadiendo el prefijo "Bg", ya que futuramente se añadiran las mismas
@ -443,10 +483,8 @@ NightFox's Lib Ver. 20091127
- Documentacion actualizada.
- Ejemplos actualizados.
NightFox's Lib Ver. 20091122
--------------------------------------------------------------------------------
----------------------------
- Texto: Añadido el soporte para los caracteres "Ç", "ç", "Ñ" y "ñ"
- Texto: Añadido el soporte para el caracter de control "\n" (nueva linea)
@ -463,25 +501,19 @@ NightFox's Lib Ver. 20091122
- Por hacer: Actualizar la documentacion con las funciones añadidas
- Ejemplo: Añadido ejemplo sobre la manipulacion de paletas
NightFox's Lib Ver. 20091115
--------------------------------------------------------------------------------
----------------------------
- Añadido el ejemplo de alpha blending
NightFox's Lib Ver. 20091101
--------------------------------------------------------------------------------
----------------------------
- Añadida la documentacion en Italiano (tide75)
- Añadido el ejemplo de fondos animados con tiles
NightFox's Lib Ver. 20091014
--------------------------------------------------------------------------------
----------------------------
- Añadida la funcion NF_SetTile();
- Añadido el ejemplo de cliente/servidor por UDP.

View File

@ -0,0 +1,25 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023-2024
.PHONY: all clean
MAKE := make
all:
@for i in `ls`; do \
if test -e $$i/Makefile ; then \
cd $$i; \
$(MAKE) --no-print-directory || exit 1; \
cd ..; \
fi; \
done;
clean:
@for i in `ls`; do \
if test -e $$i/Makefile ; then \
cd $$i; \
$(MAKE) clean --no-print-directory || exit 1; \
cd ..; \
fi; \
done;

View File

@ -1,25 +0,0 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023
.PHONY: all clean
MAKE := make
all:
@for i in `ls`; do \
if test -e $$i/Makefile.blocksds ; then \
cd $$i; \
$(MAKE) -f Makefile.blocksds --no-print-directory || { exit 1;}; \
cd ..; \
fi; \
done;
clean:
@for i in `ls`; do \
if test -e $$i/Makefile.blocksds ; then \
cd $$i; \
$(MAKE) -f Makefile.blocksds clean --no-print-directory || { exit 1;}; \
cd ..; \
fi; \
done;

View File

@ -1,222 +1 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
# These set the information text in the nds file
#GAME_TITLE := My Wonderful Homebrew
#GAME_SUBTITLE1 := built with devkitARM
#GAME_SUBTITLE2 := http://devitpro.org
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
# AUDIO is a list of directories containing audio to be converted by maxmod
# ICON is the image used to create the game icon, leave blank to use default rule
# NITRO is a directory that will be accessible via NitroFS
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
AUDIO :=
ICON :=
# specify a directory which contains the nitro filesystem
# this is relative to the Makefile
NITRO := nitrofiles
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
CFLAGS := -g -Wall -O3\
$(ARCH) $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lnflib
# automatigically add libraries for NitroFS
ifneq ($(strip $(NITRO)),)
LIBS := $(LIBS) -lfilesystem -lfat
endif
# automagically add maxmod library
ifneq ($(strip $(AUDIO)),)
LIBS := $(LIBS) -lmm9
endif
LIBS := $(LIBS) -lnds9
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
# prepare NitroFS directory
ifneq ($(strip $(NITRO)),)
export NITRO_FILES := $(CURDIR)/$(NITRO)
endif
# get audio list for maxmod
ifneq ($(strip $(AUDIO)),)
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
# place the soundbank file in NitroFS if using it
ifneq ($(strip $(NITRO)),)
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
# otherwise, needs to be loaded from memory
else
export SOUNDBANK := soundbank.bin
BINFILES += $(SOUNDBANK)
endif
endif
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.bmp)
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
else
ifneq (,$(findstring icon.bmp,$(icons)))
export GAME_ICON := $(CURDIR)/icon.bmp
endif
endif
else
ifeq ($(suffix $(ICON)), .grf)
export GAME_ICON := $(CURDIR)/$(ICON)
else
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
endif
endif
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
$(OUTPUT).elf: $(OFILES)
# source files depend on generated headers
$(OFILES_SOURCES) : $(HFILES)
# need to build soundbank first
$(OFILES): $(SOUNDBANK)
#---------------------------------------------------------------------------------
# rule to build solution from music files
#---------------------------------------------------------------------------------
$(SOUNDBANK) : $(MODFILES)
#---------------------------------------------------------------------------------
mmutil $^ -d -o$@ -hsoundbank.h
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule creates assembly source files using grit
# grit takes an image file and a .grit describing how the file is to be processed
# add additional rules like this for each image extension
# you use in the graphics folders
#---------------------------------------------------------------------------------
%.s %.h: %.png %.grit
#---------------------------------------------------------------------------------
grit $< -fts -o$*
#---------------------------------------------------------------------------------
# Convert non-GRF game icon to GRF if needed
#---------------------------------------------------------------------------------
$(GAME_ICON): $(notdir $(ICON))
#---------------------------------------------------------------------------------
@echo convert $(notdir $<)
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
include ../../Makefile.example

View File

@ -1 +0,0 @@
include ../../Makefile.example.blocksds

View File

@ -1,17 +1,12 @@
#!/bin/sh
#!/bin/bash
grit blueball.png -ftb -fh! -gTFF00FF -gb -gB8 -m!
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
GRIT=$BLOCKSDS/tools/grit/grit
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
mv *.pal *.img ../nitrofiles/sprite
grit nature.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT nature.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
mv *.pal *.img *.map ../nitrofiles/bg

View File

@ -1 +1 @@
! ²²5G²0 %3NòL!£³VéL³.Ò“&š0 ù2$8Sm4¦ÛÙ¥<18>U ²Hi9E82þ,6Ò È8ìkK-³BbØBØRÚ22I ÆîYR5É)Re÷] où4 ©9¯:õTEK(Hýer ëLšÜ2£RFû<08>Zc®1¸Ö2SF!x$l&ýYQB¶0?.BÕb5ØE9?¹bb 3Ý&\$% ÏÉÜrÒEi)×Q9S8îo<­HZü0©!IÅ[o).³ ÕfÎ4¬!û&O}0[ Ãl¼ýY"WZ¯=ÕH¼u 55U&9G×&V]Ö6ÉS )GX N16=3ÖVù6U2m, <1D><u<E\QA\2Bf>ÕUBÕ zWì(o)^jäÚno4i¼?&/N3%¦(Ó66R¶BµEbo&<nJÙ ï(XfÉ1é!?Æ\J {f%=&z&ÉDJ R&>'&½Bƒi wJIü89"Ú$µÒ%×à Ç!
| ²²5G²0 %3NòL!£³VéL³.Ò“&š0 ù2$8Sm4¦ÛÙ¥<18>U ²Hi9E82þ,6Ò È8ìkK-³BbØBØRÚ22I ÆîYR5É)Re÷] où4 ©9¯:õTEK(Hýer ëLšÜ2£RFû<08>Zc®1¸Ö2SF!x$l&ýYQB¶0?.BÕb5ØE9?¹bb 3Ý&\$% ÏÉÜrÒEi)×Q9S8îo<­HZü0©!IÅ[o).Ó ÕfÎ4¬!û&O}0[ Ãl¼ýY"WZ¯=ÕH¼u 55U&9G×&V]Ö6ÉS )GX N16=3ÖVù6U2m, <1D><u<E\QA\2Bf>ÕUBÕ zWì(o)^jäÚno4i¼?&/N3%¦(Ó66R¶BµEbo&<nJÙ ï(XfÉ1é!?Æ\J {f%=&z&ÉDJ R&>'&½Bƒi wJIü89"Ú$µÒ%×à Ç!!

View File

@ -1,222 +1 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
# These set the information text in the nds file
#GAME_TITLE := My Wonderful Homebrew
#GAME_SUBTITLE1 := built with devkitARM
#GAME_SUBTITLE2 := http://devitpro.org
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
# AUDIO is a list of directories containing audio to be converted by maxmod
# ICON is the image used to create the game icon, leave blank to use default rule
# NITRO is a directory that will be accessible via NitroFS
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
AUDIO :=
ICON :=
# specify a directory which contains the nitro filesystem
# this is relative to the Makefile
NITRO := nitrofiles
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
CFLAGS := -g -Wall -O3\
$(ARCH) $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lnflib
# automatigically add libraries for NitroFS
ifneq ($(strip $(NITRO)),)
LIBS := $(LIBS) -lfilesystem -lfat
endif
# automagically add maxmod library
ifneq ($(strip $(AUDIO)),)
LIBS := $(LIBS) -lmm9
endif
LIBS := $(LIBS) -lnds9
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
# prepare NitroFS directory
ifneq ($(strip $(NITRO)),)
export NITRO_FILES := $(CURDIR)/$(NITRO)
endif
# get audio list for maxmod
ifneq ($(strip $(AUDIO)),)
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
# place the soundbank file in NitroFS if using it
ifneq ($(strip $(NITRO)),)
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
# otherwise, needs to be loaded from memory
else
export SOUNDBANK := soundbank.bin
BINFILES += $(SOUNDBANK)
endif
endif
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.bmp)
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
else
ifneq (,$(findstring icon.bmp,$(icons)))
export GAME_ICON := $(CURDIR)/icon.bmp
endif
endif
else
ifeq ($(suffix $(ICON)), .grf)
export GAME_ICON := $(CURDIR)/$(ICON)
else
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
endif
endif
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
$(OUTPUT).elf: $(OFILES)
# source files depend on generated headers
$(OFILES_SOURCES) : $(HFILES)
# need to build soundbank first
$(OFILES): $(SOUNDBANK)
#---------------------------------------------------------------------------------
# rule to build solution from music files
#---------------------------------------------------------------------------------
$(SOUNDBANK) : $(MODFILES)
#---------------------------------------------------------------------------------
mmutil $^ -d -o$@ -hsoundbank.h
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule creates assembly source files using grit
# grit takes an image file and a .grit describing how the file is to be processed
# add additional rules like this for each image extension
# you use in the graphics folders
#---------------------------------------------------------------------------------
%.s %.h: %.png %.grit
#---------------------------------------------------------------------------------
grit $< -fts -o$*
#---------------------------------------------------------------------------------
# Convert non-GRF game icon to GRF if needed
#---------------------------------------------------------------------------------
$(GAME_ICON): $(notdir $(ICON))
#---------------------------------------------------------------------------------
@echo convert $(notdir $<)
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
include ../../Makefile.example

View File

@ -1 +0,0 @@
include ../../Makefile.example.blocksds

View File

@ -1,18 +1,13 @@
#!/bin/sh
#!/bin/bash
grit numbers.png -ftb -fh! -gTFF00FF -gb -gB8 -m!
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
GRIT=$BLOCKSDS/tools/grit/grit
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT numbers.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
mv *.pal *.img ../nitrofiles/sprite
grit nfl.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
grit bg3.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT nfl.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
$GRIT bg3.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
mv *.pal *.img *.map ../nitrofiles/bg

View File

@ -1,222 +1 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
# These set the information text in the nds file
#GAME_TITLE := My Wonderful Homebrew
#GAME_SUBTITLE1 := built with devkitARM
#GAME_SUBTITLE2 := http://devitpro.org
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
# AUDIO is a list of directories containing audio to be converted by maxmod
# ICON is the image used to create the game icon, leave blank to use default rule
# NITRO is a directory that will be accessible via NitroFS
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
AUDIO :=
ICON :=
# specify a directory which contains the nitro filesystem
# this is relative to the Makefile
NITRO := nitrofiles
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
CFLAGS := -g -Wall -O3\
$(ARCH) $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lnflib
# automatigically add libraries for NitroFS
ifneq ($(strip $(NITRO)),)
LIBS := $(LIBS) -lfilesystem -lfat
endif
# automagically add maxmod library
ifneq ($(strip $(AUDIO)),)
LIBS := $(LIBS) -lmm9
endif
LIBS := $(LIBS) -lnds9
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
# prepare NitroFS directory
ifneq ($(strip $(NITRO)),)
export NITRO_FILES := $(CURDIR)/$(NITRO)
endif
# get audio list for maxmod
ifneq ($(strip $(AUDIO)),)
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
# place the soundbank file in NitroFS if using it
ifneq ($(strip $(NITRO)),)
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
# otherwise, needs to be loaded from memory
else
export SOUNDBANK := soundbank.bin
BINFILES += $(SOUNDBANK)
endif
endif
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.bmp)
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
else
ifneq (,$(findstring icon.bmp,$(icons)))
export GAME_ICON := $(CURDIR)/icon.bmp
endif
endif
else
ifeq ($(suffix $(ICON)), .grf)
export GAME_ICON := $(CURDIR)/$(ICON)
else
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
endif
endif
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
$(OUTPUT).elf: $(OFILES)
# source files depend on generated headers
$(OFILES_SOURCES) : $(HFILES)
# need to build soundbank first
$(OFILES): $(SOUNDBANK)
#---------------------------------------------------------------------------------
# rule to build solution from music files
#---------------------------------------------------------------------------------
$(SOUNDBANK) : $(MODFILES)
#---------------------------------------------------------------------------------
mmutil $^ -d -o$@ -hsoundbank.h
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule creates assembly source files using grit
# grit takes an image file and a .grit describing how the file is to be processed
# add additional rules like this for each image extension
# you use in the graphics folders
#---------------------------------------------------------------------------------
%.s %.h: %.png %.grit
#---------------------------------------------------------------------------------
grit $< -fts -o$*
#---------------------------------------------------------------------------------
# Convert non-GRF game icon to GRF if needed
#---------------------------------------------------------------------------------
$(GAME_ICON): $(notdir $(ICON))
#---------------------------------------------------------------------------------
@echo convert $(notdir $<)
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
include ../../Makefile.example

View File

@ -1 +0,0 @@
include ../../Makefile.example.blocksds

View File

@ -1,19 +1,14 @@
#!/bin/sh
#!/bin/bash
grit blueball.png -ftb -fh! -gTFF00FF -gb -gB8 -m!
grit redcar.png -ftb -fh! -gTFF00FF -gb -gB8 -m!
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
GRIT=$BLOCKSDS/tools/grit/grit
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
$GRIT redcar.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
mv *.pal *.img ../nitrofiles/sprite
grit nfl.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
grit bg3.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT nfl.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
$GRIT bg3.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
mv *.pal *.img *.map ../nitrofiles/bg

View File

@ -1,222 +1 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
# These set the information text in the nds file
#GAME_TITLE := My Wonderful Homebrew
#GAME_SUBTITLE1 := built with devkitARM
#GAME_SUBTITLE2 := http://devitpro.org
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
# AUDIO is a list of directories containing audio to be converted by maxmod
# ICON is the image used to create the game icon, leave blank to use default rule
# NITRO is a directory that will be accessible via NitroFS
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
AUDIO :=
ICON :=
# specify a directory which contains the nitro filesystem
# this is relative to the Makefile
NITRO := nitrofiles
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
CFLAGS := -g -Wall -O3\
$(ARCH) $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lnflib
# automatigically add libraries for NitroFS
ifneq ($(strip $(NITRO)),)
LIBS := $(LIBS) -lfilesystem -lfat
endif
# automagically add maxmod library
ifneq ($(strip $(AUDIO)),)
LIBS := $(LIBS) -lmm9
endif
LIBS := $(LIBS) -lnds9
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
# prepare NitroFS directory
ifneq ($(strip $(NITRO)),)
export NITRO_FILES := $(CURDIR)/$(NITRO)
endif
# get audio list for maxmod
ifneq ($(strip $(AUDIO)),)
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
# place the soundbank file in NitroFS if using it
ifneq ($(strip $(NITRO)),)
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
# otherwise, needs to be loaded from memory
else
export SOUNDBANK := soundbank.bin
BINFILES += $(SOUNDBANK)
endif
endif
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.bmp)
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
else
ifneq (,$(findstring icon.bmp,$(icons)))
export GAME_ICON := $(CURDIR)/icon.bmp
endif
endif
else
ifeq ($(suffix $(ICON)), .grf)
export GAME_ICON := $(CURDIR)/$(ICON)
else
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
endif
endif
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
$(OUTPUT).elf: $(OFILES)
# source files depend on generated headers
$(OFILES_SOURCES) : $(HFILES)
# need to build soundbank first
$(OFILES): $(SOUNDBANK)
#---------------------------------------------------------------------------------
# rule to build solution from music files
#---------------------------------------------------------------------------------
$(SOUNDBANK) : $(MODFILES)
#---------------------------------------------------------------------------------
mmutil $^ -d -o$@ -hsoundbank.h
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule creates assembly source files using grit
# grit takes an image file and a .grit describing how the file is to be processed
# add additional rules like this for each image extension
# you use in the graphics folders
#---------------------------------------------------------------------------------
%.s %.h: %.png %.grit
#---------------------------------------------------------------------------------
grit $< -fts -o$*
#---------------------------------------------------------------------------------
# Convert non-GRF game icon to GRF if needed
#---------------------------------------------------------------------------------
$(GAME_ICON): $(notdir $(ICON))
#---------------------------------------------------------------------------------
@echo convert $(notdir $<)
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
include ../../Makefile.example

View File

@ -1 +0,0 @@
include ../../Makefile.example.blocksds

View File

@ -1,18 +1,13 @@
#!/bin/sh
#!/bin/bash
grit blueball.png -ftb -fh! -gTFF00FF -gb -gB8 -m!
grit redcar.png -ftb -fh! -gTFF00FF -gb -gB8 -m!
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
GRIT=$BLOCKSDS/tools/grit/grit
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
$GRIT redcar.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
mv *.pal *.img ../nitrofiles/sprite
grit bg3.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT bg3.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
mv *.pal *.img *.map ../nitrofiles/bg

View File

@ -1,222 +1 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
# These set the information text in the nds file
#GAME_TITLE := My Wonderful Homebrew
#GAME_SUBTITLE1 := built with devkitARM
#GAME_SUBTITLE2 := http://devitpro.org
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
# AUDIO is a list of directories containing audio to be converted by maxmod
# ICON is the image used to create the game icon, leave blank to use default rule
# NITRO is a directory that will be accessible via NitroFS
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
AUDIO :=
ICON :=
# specify a directory which contains the nitro filesystem
# this is relative to the Makefile
NITRO := nitrofiles
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
CFLAGS := -g -Wall -O3\
$(ARCH) $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lnflib
# automatigically add libraries for NitroFS
ifneq ($(strip $(NITRO)),)
LIBS := $(LIBS) -lfilesystem -lfat
endif
# automagically add maxmod library
ifneq ($(strip $(AUDIO)),)
LIBS := $(LIBS) -lmm9
endif
LIBS := $(LIBS) -lnds9
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
# prepare NitroFS directory
ifneq ($(strip $(NITRO)),)
export NITRO_FILES := $(CURDIR)/$(NITRO)
endif
# get audio list for maxmod
ifneq ($(strip $(AUDIO)),)
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
# place the soundbank file in NitroFS if using it
ifneq ($(strip $(NITRO)),)
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
# otherwise, needs to be loaded from memory
else
export SOUNDBANK := soundbank.bin
BINFILES += $(SOUNDBANK)
endif
endif
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.bmp)
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
else
ifneq (,$(findstring icon.bmp,$(icons)))
export GAME_ICON := $(CURDIR)/icon.bmp
endif
endif
else
ifeq ($(suffix $(ICON)), .grf)
export GAME_ICON := $(CURDIR)/$(ICON)
else
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
endif
endif
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
$(OUTPUT).elf: $(OFILES)
# source files depend on generated headers
$(OFILES_SOURCES) : $(HFILES)
# need to build soundbank first
$(OFILES): $(SOUNDBANK)
#---------------------------------------------------------------------------------
# rule to build solution from music files
#---------------------------------------------------------------------------------
$(SOUNDBANK) : $(MODFILES)
#---------------------------------------------------------------------------------
mmutil $^ -d -o$@ -hsoundbank.h
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule creates assembly source files using grit
# grit takes an image file and a .grit describing how the file is to be processed
# add additional rules like this for each image extension
# you use in the graphics folders
#---------------------------------------------------------------------------------
%.s %.h: %.png %.grit
#---------------------------------------------------------------------------------
grit $< -fts -o$*
#---------------------------------------------------------------------------------
# Convert non-GRF game icon to GRF if needed
#---------------------------------------------------------------------------------
$(GAME_ICON): $(notdir $(ICON))
#---------------------------------------------------------------------------------
@echo convert $(notdir $<)
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
include ../../Makefile.example

View File

@ -1 +0,0 @@
include ../../Makefile.example.blocksds

View File

@ -1,18 +1,13 @@
#!/bin/sh
#!/bin/bash
grit blueball.png -ftb -fh! -gTFF00FF -gb -gB8 -m!
grit redcar.png -ftb -fh! -gTFF00FF -gb -gB8 -m!
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
GRIT=$BLOCKSDS/tools/grit/grit
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
$GRIT redcar.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
mv *.pal *.img ../nitrofiles/sprite
grit bg3.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT bg3.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
mv *.pal *.img *.map ../nitrofiles/bg

View File

@ -1,222 +1 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
# These set the information text in the nds file
#GAME_TITLE := My Wonderful Homebrew
#GAME_SUBTITLE1 := built with devkitARM
#GAME_SUBTITLE2 := http://devitpro.org
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
# AUDIO is a list of directories containing audio to be converted by maxmod
# ICON is the image used to create the game icon, leave blank to use default rule
# NITRO is a directory that will be accessible via NitroFS
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
AUDIO :=
ICON :=
# specify a directory which contains the nitro filesystem
# this is relative to the Makefile
NITRO := nitrofiles
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
CFLAGS := -g -Wall -O3\
$(ARCH) $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lnflib
# automatigically add libraries for NitroFS
ifneq ($(strip $(NITRO)),)
LIBS := $(LIBS) -lfilesystem -lfat
endif
# automagically add maxmod library
ifneq ($(strip $(AUDIO)),)
LIBS := $(LIBS) -lmm9
endif
LIBS := $(LIBS) -lnds9
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
# prepare NitroFS directory
ifneq ($(strip $(NITRO)),)
export NITRO_FILES := $(CURDIR)/$(NITRO)
endif
# get audio list for maxmod
ifneq ($(strip $(AUDIO)),)
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
# place the soundbank file in NitroFS if using it
ifneq ($(strip $(NITRO)),)
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
# otherwise, needs to be loaded from memory
else
export SOUNDBANK := soundbank.bin
BINFILES += $(SOUNDBANK)
endif
endif
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.bmp)
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
else
ifneq (,$(findstring icon.bmp,$(icons)))
export GAME_ICON := $(CURDIR)/icon.bmp
endif
endif
else
ifeq ($(suffix $(ICON)), .grf)
export GAME_ICON := $(CURDIR)/$(ICON)
else
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
endif
endif
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
$(OUTPUT).elf: $(OFILES)
# source files depend on generated headers
$(OFILES_SOURCES) : $(HFILES)
# need to build soundbank first
$(OFILES): $(SOUNDBANK)
#---------------------------------------------------------------------------------
# rule to build solution from music files
#---------------------------------------------------------------------------------
$(SOUNDBANK) : $(MODFILES)
#---------------------------------------------------------------------------------
mmutil $^ -d -o$@ -hsoundbank.h
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule creates assembly source files using grit
# grit takes an image file and a .grit describing how the file is to be processed
# add additional rules like this for each image extension
# you use in the graphics folders
#---------------------------------------------------------------------------------
%.s %.h: %.png %.grit
#---------------------------------------------------------------------------------
grit $< -fts -o$*
#---------------------------------------------------------------------------------
# Convert non-GRF game icon to GRF if needed
#---------------------------------------------------------------------------------
$(GAME_ICON): $(notdir $(ICON))
#---------------------------------------------------------------------------------
@echo convert $(notdir $<)
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
include ../../Makefile.example

View File

@ -1 +0,0 @@
include ../../Makefile.example.blocksds

View File

@ -1,20 +1,15 @@
#!/bin/sh
#!/bin/bash
grit numbers.png -ftb -fh! -gTFF00FF -gb -gB8 -m!
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
GRIT=$BLOCKSDS/tools/grit/grit
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT numbers.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
mv *.pal *.img ../nitrofiles/sprite
grit nfl.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
grit bg1.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
grit bg2.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
grit bg3.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT nfl.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
$GRIT bg1.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
$GRIT bg2.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
$GRIT bg3.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
mv *.pal *.img *.map ../nitrofiles/bg

View File

@ -1,222 +1 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
# These set the information text in the nds file
#GAME_TITLE := My Wonderful Homebrew
#GAME_SUBTITLE1 := built with devkitARM
#GAME_SUBTITLE2 := http://devitpro.org
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
# AUDIO is a list of directories containing audio to be converted by maxmod
# ICON is the image used to create the game icon, leave blank to use default rule
# NITRO is a directory that will be accessible via NitroFS
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
AUDIO :=
ICON :=
# specify a directory which contains the nitro filesystem
# this is relative to the Makefile
NITRO := nitrofiles
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
CFLAGS := -g -Wall -O3\
$(ARCH) $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lnflib
# automatigically add libraries for NitroFS
ifneq ($(strip $(NITRO)),)
LIBS := $(LIBS) -lfilesystem -lfat
endif
# automagically add maxmod library
ifneq ($(strip $(AUDIO)),)
LIBS := $(LIBS) -lmm9
endif
LIBS := $(LIBS) -lnds9
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
# prepare NitroFS directory
ifneq ($(strip $(NITRO)),)
export NITRO_FILES := $(CURDIR)/$(NITRO)
endif
# get audio list for maxmod
ifneq ($(strip $(AUDIO)),)
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
# place the soundbank file in NitroFS if using it
ifneq ($(strip $(NITRO)),)
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
# otherwise, needs to be loaded from memory
else
export SOUNDBANK := soundbank.bin
BINFILES += $(SOUNDBANK)
endif
endif
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.bmp)
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
else
ifneq (,$(findstring icon.bmp,$(icons)))
export GAME_ICON := $(CURDIR)/icon.bmp
endif
endif
else
ifeq ($(suffix $(ICON)), .grf)
export GAME_ICON := $(CURDIR)/$(ICON)
else
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
endif
endif
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
$(OUTPUT).elf: $(OFILES)
# source files depend on generated headers
$(OFILES_SOURCES) : $(HFILES)
# need to build soundbank first
$(OFILES): $(SOUNDBANK)
#---------------------------------------------------------------------------------
# rule to build solution from music files
#---------------------------------------------------------------------------------
$(SOUNDBANK) : $(MODFILES)
#---------------------------------------------------------------------------------
mmutil $^ -d -o$@ -hsoundbank.h
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule creates assembly source files using grit
# grit takes an image file and a .grit describing how the file is to be processed
# add additional rules like this for each image extension
# you use in the graphics folders
#---------------------------------------------------------------------------------
%.s %.h: %.png %.grit
#---------------------------------------------------------------------------------
grit $< -fts -o$*
#---------------------------------------------------------------------------------
# Convert non-GRF game icon to GRF if needed
#---------------------------------------------------------------------------------
$(GAME_ICON): $(notdir $(ICON))
#---------------------------------------------------------------------------------
@echo convert $(notdir $<)
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
include ../../Makefile.example

View File

@ -1 +0,0 @@
include ../../Makefile.example.blocksds

View File

@ -1,18 +1,13 @@
#!/bin/sh
#!/bin/bash
grit blueball.png -ftb -fh! -gTFF00FF -gb -gB8 -m!
grit redcar.png -ftb -fh! -gTFF00FF -gb -gB8 -m!
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
GRIT=$BLOCKSDS/tools/grit/grit
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
$GRIT redcar.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
mv *.pal *.img ../nitrofiles/sprite
grit bg3.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT bg3.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
mv *.pal *.img *.map ../nitrofiles/bg

View File

@ -1,222 +1 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
# These set the information text in the nds file
#GAME_TITLE := My Wonderful Homebrew
#GAME_SUBTITLE1 := built with devkitARM
#GAME_SUBTITLE2 := http://devitpro.org
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
# AUDIO is a list of directories containing audio to be converted by maxmod
# ICON is the image used to create the game icon, leave blank to use default rule
# NITRO is a directory that will be accessible via NitroFS
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
AUDIO :=
ICON :=
# specify a directory which contains the nitro filesystem
# this is relative to the Makefile
NITRO := nitrofiles
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
CFLAGS := -g -Wall -O3\
$(ARCH) $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lnflib
# automatigically add libraries for NitroFS
ifneq ($(strip $(NITRO)),)
LIBS := $(LIBS) -lfilesystem -lfat
endif
# automagically add maxmod library
ifneq ($(strip $(AUDIO)),)
LIBS := $(LIBS) -lmm9
endif
LIBS := $(LIBS) -lnds9
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
# prepare NitroFS directory
ifneq ($(strip $(NITRO)),)
export NITRO_FILES := $(CURDIR)/$(NITRO)
endif
# get audio list for maxmod
ifneq ($(strip $(AUDIO)),)
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
# place the soundbank file in NitroFS if using it
ifneq ($(strip $(NITRO)),)
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
# otherwise, needs to be loaded from memory
else
export SOUNDBANK := soundbank.bin
BINFILES += $(SOUNDBANK)
endif
endif
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.bmp)
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
else
ifneq (,$(findstring icon.bmp,$(icons)))
export GAME_ICON := $(CURDIR)/icon.bmp
endif
endif
else
ifeq ($(suffix $(ICON)), .grf)
export GAME_ICON := $(CURDIR)/$(ICON)
else
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
endif
endif
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
$(OUTPUT).elf: $(OFILES)
# source files depend on generated headers
$(OFILES_SOURCES) : $(HFILES)
# need to build soundbank first
$(OFILES): $(SOUNDBANK)
#---------------------------------------------------------------------------------
# rule to build solution from music files
#---------------------------------------------------------------------------------
$(SOUNDBANK) : $(MODFILES)
#---------------------------------------------------------------------------------
mmutil $^ -d -o$@ -hsoundbank.h
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule creates assembly source files using grit
# grit takes an image file and a .grit describing how the file is to be processed
# add additional rules like this for each image extension
# you use in the graphics folders
#---------------------------------------------------------------------------------
%.s %.h: %.png %.grit
#---------------------------------------------------------------------------------
grit $< -fts -o$*
#---------------------------------------------------------------------------------
# Convert non-GRF game icon to GRF if needed
#---------------------------------------------------------------------------------
$(GAME_ICON): $(notdir $(ICON))
#---------------------------------------------------------------------------------
@echo convert $(notdir $<)
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
include ../../Makefile.example

View File

@ -1 +0,0 @@
include ../../Makefile.example.blocksds

View File

@ -1,18 +1,13 @@
#!/bin/sh
#!/bin/bash
grit blueball.png -ftb -fh! -gTFF00FF -gb -gB8 -m!
grit redcar.png -ftb -fh! -gTFF00FF -gb -gB8 -m!
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
GRIT=$BLOCKSDS/tools/grit/grit
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT blueball.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
$GRIT redcar.png -ftB -fh! -gTFF00FF -gb -gB8 -m!
mv *.pal *.img ../nitrofiles/sprite
grit bg3.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT bg3.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
mv *.pal *.img *.map ../nitrofiles/bg

25
examples/Makefile Normal file
View File

@ -0,0 +1,25 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023-2024
.PHONY: all clean
MAKE := make
all:
@for i in `ls`; do \
if test -e $$i/Makefile ; then \
$(MAKE) -C $$i --no-print-directory || exit 1; \
fi; \
done;
@rm -fr build-all
@mkdir -p build-all
@find . -name "*.nds" -not -path build-all -exec cp -fv {} build-all \;
clean:
@for i in `ls`; do \
if test -e $$i/Makefile ; then \
$(MAKE) -C $$i clean --no-print-directory || exit 1; \
fi; \
done;
@rm -fr build-all

View File

@ -1,25 +0,0 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023
.PHONY: all clean
MAKE := make
all:
@for i in `ls`; do \
if test -e $$i/Makefile.blocksds ; then \
$(MAKE) -C $$i -f Makefile.blocksds --no-print-directory || { exit 1;} \
fi; \
done;
@rm -fr build-all
@mkdir -p build-all
@find . -name "*.nds" -not -path build-all -exec cp -fv {} build-all \;
clean:
@for i in `ls`; do \
if test -e $$i/Makefile.blocksds ; then \
$(MAKE) -C $$i -f Makefile.blocksds clean --no-print-directory || { exit 1;} \
fi; \
done;
@rm -fr build-all

View File

@ -1,11 +1,11 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023
# SPDX-FileContributor: Antonio Niño Díaz, 2023-2024
BLOCKSDS ?= /opt/blocksds/core
BLOCKSDSEXT ?= /opt/blocksds/external
export BLOCKSDS ?= /opt/blocksds/core
export BLOCKSDSEXT ?= /opt/blocksds/external
WONDERFUL_TOOLCHAIN ?= /opt/wonderful
export WONDERFUL_TOOLCHAIN ?= /opt/wonderful
ARM_NONE_EABI_PATH ?= $(WONDERFUL_TOOLCHAIN)/toolchain/gcc-arm-none-eabi/bin/
# User config
@ -42,18 +42,18 @@ LIBDIRS += $(BLOCKSDSEXT)/nflib \
# Build artifacts
# ---------------
BUILDDIR := build
BUILDDIR := build/$(NAME)
ELF := build/$(NAME).elf
DUMP := build/$(NAME).dump
MAP := build/$(NAME).map
ROM := $(NAME).nds
# If NITROFSDIR is set, the output of mmutil will be placed in that directory
# If NITROFSDIR is set, the soundbank created by mmutil will be saved to NitroFS
SOUNDBANKINFODIR := $(BUILDDIR)/maxmod
ifeq ($(strip $(NITROFSDIR)),)
SOUNDBANKDIR := $(BUILDDIR)/maxmod
else
SOUNDBANKDIR := $(NITROFSDIR)
SOUNDBANKDIR := $(BUILDDIR)/maxmod_nitrofs
endif
# Tools
@ -62,6 +62,7 @@ endif
PREFIX := $(ARM_NONE_EABI_PATH)arm-none-eabi-
CC := $(PREFIX)gcc
CXX := $(PREFIX)g++
LD := $(PREFIX)gcc
OBJDUMP := $(PREFIX)objdump
MKDIR := mkdir
RM := rm -rf
@ -100,18 +101,16 @@ SOURCES_CPP := $(shell find -L $(SOURCEDIRS) -name "*.cpp")
# Compiler and linker flags
# -------------------------
DEFINES += -D__NDS__ -DARM9
ARCH := -mthumb -mcpu=arm946e-s+nofp
ARCH := -march=armv5te -mtune=arm946e-s
SPECS := $(BLOCKSDS)/sys/crts/ds_arm9.specs
WARNFLAGS := -Wall
ifeq ($(SOURCES_CPP),)
LD := $(CC)
LIBS += -lc
LIBS += -lc
else
LD := $(CXX)
LIBS += -lstdc++ -lc
LIBS += -lstdc++ -lc
endif
INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \
@ -119,27 +118,21 @@ INCLUDEFLAGS := $(foreach path,$(INCLUDEDIRS),-I$(path)) \
LIBDIRSFLAGS := $(foreach path,$(LIBDIRS),-L$(path)/lib)
ASFLAGS += -x assembler-with-cpp $(DEFINES) $(ARCH) \
-mthumb -mthumb-interwork $(INCLUDEFLAGS) \
-ffunction-sections -fdata-sections
ASFLAGS += -x assembler-with-cpp $(INCLUDEFLAGS) $(DEFINES) \
$(ARCH) -ffunction-sections -fdata-sections \
-specs=$(SPECS)
CFLAGS += -std=gnu11 $(WARNFLAGS) $(DEFINES) $(ARCH) \
-mthumb -mthumb-interwork $(INCLUDEFLAGS) -O2 \
-ffunction-sections -fdata-sections \
-fomit-frame-pointer
CFLAGS += -std=gnu17 $(WARNFLAGS) $(INCLUDEFLAGS) $(DEFINES) \
$(ARCH) -O2 -ffunction-sections -fdata-sections \
-specs=$(SPECS)
CXXFLAGS += -std=gnu++14 $(WARNFLAGS) $(DEFINES) $(ARCH) \
-mthumb -mthumb-interwork $(INCLUDEFLAGS) -O2 \
-ffunction-sections -fdata-sections \
CXXFLAGS += -std=gnu++17 $(WARNFLAGS) $(INCLUDEFLAGS) $(DEFINES) \
$(ARCH) -O2 -ffunction-sections -fdata-sections \
-fno-exceptions -fno-rtti \
-fomit-frame-pointer
-specs=$(SPECS)
LDFLAGS := -mthumb -mthumb-interwork $(LIBDIRSFLAGS) \
-Wl,-Map,$(MAP) -Wl,--gc-sections -nostdlib \
-T$(BLOCKSDS)/sys/crts/ds_arm9.mem \
-T$(BLOCKSDS)/sys/crts/ds_arm9.ld \
-Wl,--no-warn-rwx-segments \
-Wl,--start-group $(LIBS) -lgcc -Wl,--end-group
LDFLAGS := $(ARCH) $(LIBDIRSFLAGS) -Wl,-Map,$(MAP) $(DEFINES) \
-Wl,--start-group $(LIBS) -Wl,--end-group -specs=$(SPECS)
# Intermediate build files
# ------------------------
@ -176,6 +169,10 @@ ifneq ($(strip $(NITROFSDIR)),)
# Additional arguments for ndstool
NDSTOOL_ARGS := -d $(NITROFSDIR)
ifneq ($(SOURCES_AUDIO),)
NDSTOOL_ARGS += -d $(SOUNDBANKDIR)
endif
# Make the NDS ROM depend on the filesystem only if it is needed
$(ROM): $(NITROFSDIR)
endif
@ -196,7 +193,7 @@ $(ROM): $(ELF)
$(ELF): $(OBJS)
@echo " LD $@"
$(V)$(LD) -o $@ $(OBJS) $(BLOCKSDS)/sys/crts/ds_arm9_crt0.o $(LDFLAGS)
$(V)$(LD) -o $@ $(OBJS) $(LDFLAGS)
$(DUMP): $(ELF)
@echo " OBJDUMP $@"
@ -206,8 +203,7 @@ dump: $(DUMP)
clean:
@echo " CLEAN"
$(V)$(RM) $(ROM) $(DUMP) $(BUILDDIR) $(SDIMAGE) \
$(SOUNDBANKDIR)/soundbank.bin
$(V)$(RM) $(ROM) $(DUMP) build $(SDIMAGE)
sdimage:
@echo " MKFATIMG $(SDIMAGE) $(SDROOT)"
@ -257,12 +253,14 @@ $(BUILDDIR)/%.png.o $(BUILDDIR)/%.h : %.png %.grit
@$(MKDIR) -p $(@D)
$(V)$(BLOCKSDS)/tools/grit/grit $< -ftc -W1 -o$(BUILDDIR)/$*
$(V)$(CC) $(CFLAGS) -MMD -MP -c -o $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.c
$(V)touch $(BUILDDIR)/$*.png.o $(BUILDDIR)/$*.h
ifneq ($(SOURCES_AUDIO),)
$(SOUNDBANKINFODIR)/soundbank.h: $(SOURCES_AUDIO)
@echo " MMUTIL $^"
@$(MKDIR) -p $(@D)
@$(MKDIR) -p $(SOUNDBANKDIR)
@$(MKDIR) -p $(SOUNDBANKINFODIR)
@$(BLOCKSDS)/tools/mmutil/mmutil $^ -d \
-o$(SOUNDBANKDIR)/soundbank.bin -h$(SOUNDBANKINFODIR)/soundbank.h

View File

@ -0,0 +1,25 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023-2024
.PHONY: all clean
MAKE := make
all:
@for i in `ls`; do \
if test -e $$i/Makefile ; then \
cd $$i; \
$(MAKE) --no-print-directory || exit 1; \
cd ..; \
fi; \
done;
clean:
@for i in `ls`; do \
if test -e $$i/Makefile ; then \
cd $$i; \
$(MAKE) clean --no-print-directory || exit 1; \
cd ..; \
fi; \
done;

View File

@ -1,25 +0,0 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023
.PHONY: all clean
MAKE := make
all:
@for i in `ls`; do \
if test -e $$i/Makefile.blocksds ; then \
cd $$i; \
$(MAKE) -f Makefile.blocksds --no-print-directory || { exit 1;}; \
cd ..; \
fi; \
done;
clean:
@for i in `ls`; do \
if test -e $$i/Makefile.blocksds ; then \
cd $$i; \
$(MAKE) -f Makefile.blocksds clean --no-print-directory || { exit 1;}; \
cd ..; \
fi; \
done;

View File

@ -1,222 +1 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
# These set the information text in the nds file
#GAME_TITLE := My Wonderful Homebrew
#GAME_SUBTITLE1 := built with devkitARM
#GAME_SUBTITLE2 := http://devitpro.org
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
# AUDIO is a list of directories containing audio to be converted by maxmod
# ICON is the image used to create the game icon, leave blank to use default rule
# NITRO is a directory that will be accessible via NitroFS
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
AUDIO :=
ICON :=
# specify a directory which contains the nitro filesystem
# this is relative to the Makefile
NITRO := nitrofiles
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
CFLAGS := -g -Wall -O3\
$(ARCH) $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lnflib
# automatigically add libraries for NitroFS
ifneq ($(strip $(NITRO)),)
LIBS := $(LIBS) -lfilesystem -lfat
endif
# automagically add maxmod library
ifneq ($(strip $(AUDIO)),)
LIBS := $(LIBS) -lmm9
endif
LIBS := $(LIBS) -lnds9
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
# prepare NitroFS directory
ifneq ($(strip $(NITRO)),)
export NITRO_FILES := $(CURDIR)/$(NITRO)
endif
# get audio list for maxmod
ifneq ($(strip $(AUDIO)),)
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
# place the soundbank file in NitroFS if using it
ifneq ($(strip $(NITRO)),)
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
# otherwise, needs to be loaded from memory
else
export SOUNDBANK := soundbank.bin
BINFILES += $(SOUNDBANK)
endif
endif
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.bmp)
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
else
ifneq (,$(findstring icon.bmp,$(icons)))
export GAME_ICON := $(CURDIR)/icon.bmp
endif
endif
else
ifeq ($(suffix $(ICON)), .grf)
export GAME_ICON := $(CURDIR)/$(ICON)
else
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
endif
endif
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
$(OUTPUT).elf: $(OFILES)
# source files depend on generated headers
$(OFILES_SOURCES) : $(HFILES)
# need to build soundbank first
$(OFILES): $(SOUNDBANK)
#---------------------------------------------------------------------------------
# rule to build solution from music files
#---------------------------------------------------------------------------------
$(SOUNDBANK) : $(MODFILES)
#---------------------------------------------------------------------------------
mmutil $^ -d -o$@ -hsoundbank.h
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule creates assembly source files using grit
# grit takes an image file and a .grit describing how the file is to be processed
# add additional rules like this for each image extension
# you use in the graphics folders
#---------------------------------------------------------------------------------
%.s %.h: %.png %.grit
#---------------------------------------------------------------------------------
grit $< -fts -o$*
#---------------------------------------------------------------------------------
# Convert non-GRF game icon to GRF if needed
#---------------------------------------------------------------------------------
$(GAME_ICON): $(notdir $(ICON))
#---------------------------------------------------------------------------------
@echo convert $(notdir $<)
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
include ../../Makefile.example

View File

@ -1 +0,0 @@
include ../../Makefile.example.blocksds

View File

@ -1,29 +1,16 @@
#!/bin/sh
#!/bin/bash
grit whiteball.png -ftb -fh! -gTFF00FF -gt -gB8 -m!
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
GRIT=$BLOCKSDS/tools/grit/grit
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT whiteball.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
mv *.pal *.img ../nitrofiles/sprite
grit pdemo_bg.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT pdemo_bg.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
mv *.pal *.img *.map ../nitrofiles/bg
grit pdemo_colmap.png -ftb -fh! -gt -gB8 -mRtp -mLf -p!
$GRIT pdemo_colmap.png -ftB -fh! -gt -gB8 -mRtp -mLf -p!
for file in *.img.bin; do
mv -- "$file" "${file%.img.bin}".dat
done
for file in *.map.bin; do
mv -- "$file" "${file%.map.bin}".cmp
done
mv *.dat *.cmp ../nitrofiles/maps
mv *.img *.map ../nitrofiles/maps

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,222 +1 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
# These set the information text in the nds file
#GAME_TITLE := My Wonderful Homebrew
#GAME_SUBTITLE1 := built with devkitARM
#GAME_SUBTITLE2 := http://devitpro.org
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
# AUDIO is a list of directories containing audio to be converted by maxmod
# ICON is the image used to create the game icon, leave blank to use default rule
# NITRO is a directory that will be accessible via NitroFS
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
AUDIO :=
ICON :=
# specify a directory which contains the nitro filesystem
# this is relative to the Makefile
NITRO := nitrofiles
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
CFLAGS := -g -Wall -O3\
$(ARCH) $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lnflib
# automatigically add libraries for NitroFS
ifneq ($(strip $(NITRO)),)
LIBS := $(LIBS) -lfilesystem -lfat
endif
# automagically add maxmod library
ifneq ($(strip $(AUDIO)),)
LIBS := $(LIBS) -lmm9
endif
LIBS := $(LIBS) -lnds9
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
# prepare NitroFS directory
ifneq ($(strip $(NITRO)),)
export NITRO_FILES := $(CURDIR)/$(NITRO)
endif
# get audio list for maxmod
ifneq ($(strip $(AUDIO)),)
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
# place the soundbank file in NitroFS if using it
ifneq ($(strip $(NITRO)),)
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
# otherwise, needs to be loaded from memory
else
export SOUNDBANK := soundbank.bin
BINFILES += $(SOUNDBANK)
endif
endif
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.bmp)
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
else
ifneq (,$(findstring icon.bmp,$(icons)))
export GAME_ICON := $(CURDIR)/icon.bmp
endif
endif
else
ifeq ($(suffix $(ICON)), .grf)
export GAME_ICON := $(CURDIR)/$(ICON)
else
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
endif
endif
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
$(OUTPUT).elf: $(OFILES)
# source files depend on generated headers
$(OFILES_SOURCES) : $(HFILES)
# need to build soundbank first
$(OFILES): $(SOUNDBANK)
#---------------------------------------------------------------------------------
# rule to build solution from music files
#---------------------------------------------------------------------------------
$(SOUNDBANK) : $(MODFILES)
#---------------------------------------------------------------------------------
mmutil $^ -d -o$@ -hsoundbank.h
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule creates assembly source files using grit
# grit takes an image file and a .grit describing how the file is to be processed
# add additional rules like this for each image extension
# you use in the graphics folders
#---------------------------------------------------------------------------------
%.s %.h: %.png %.grit
#---------------------------------------------------------------------------------
grit $< -fts -o$*
#---------------------------------------------------------------------------------
# Convert non-GRF game icon to GRF if needed
#---------------------------------------------------------------------------------
$(GAME_ICON): $(notdir $(ICON))
#---------------------------------------------------------------------------------
@echo convert $(notdir $<)
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
include ../../Makefile.example

View File

@ -1 +0,0 @@
include ../../Makefile.example.blocksds

View File

@ -1,29 +1,16 @@
#!/bin/sh
#!/bin/bash
grit pointer.png -ftb -fh! -gTFF00FF -gt -gB8 -m!
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
GRIT=$BLOCKSDS/tools/grit/grit
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT pointer.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
mv *.pal *.img ../nitrofiles/sprite
grit ppc_bg.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT ppc_bg.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
mv *.pal *.img *.map ../nitrofiles/bg
grit ppc_cmap.png -ftb -fh! -gt -gB8 -mRtp -mLf -p!
$GRIT ppc_cmap.png -ftB -fh! -gt -gB8 -mRtp -mLf -p!
for file in *.img.bin; do
mv -- "$file" "${file%.img.bin}".dat
done
for file in *.map.bin; do
mv -- "$file" "${file%.map.bin}".cmp
done
mv *.dat *.cmp ../nitrofiles/maps
mv *.img *.map ../nitrofiles/maps

View File

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -1,222 +1 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
# These set the information text in the nds file
#GAME_TITLE := My Wonderful Homebrew
#GAME_SUBTITLE1 := built with devkitARM
#GAME_SUBTITLE2 := http://devitpro.org
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
# AUDIO is a list of directories containing audio to be converted by maxmod
# ICON is the image used to create the game icon, leave blank to use default rule
# NITRO is a directory that will be accessible via NitroFS
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
AUDIO :=
ICON :=
# specify a directory which contains the nitro filesystem
# this is relative to the Makefile
NITRO := nitrofiles
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
CFLAGS := -g -Wall -O3\
$(ARCH) $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lnflib
# automatigically add libraries for NitroFS
ifneq ($(strip $(NITRO)),)
LIBS := $(LIBS) -lfilesystem -lfat
endif
# automagically add maxmod library
ifneq ($(strip $(AUDIO)),)
LIBS := $(LIBS) -lmm9
endif
LIBS := $(LIBS) -lnds9
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
# prepare NitroFS directory
ifneq ($(strip $(NITRO)),)
export NITRO_FILES := $(CURDIR)/$(NITRO)
endif
# get audio list for maxmod
ifneq ($(strip $(AUDIO)),)
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
# place the soundbank file in NitroFS if using it
ifneq ($(strip $(NITRO)),)
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
# otherwise, needs to be loaded from memory
else
export SOUNDBANK := soundbank.bin
BINFILES += $(SOUNDBANK)
endif
endif
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.bmp)
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
else
ifneq (,$(findstring icon.bmp,$(icons)))
export GAME_ICON := $(CURDIR)/icon.bmp
endif
endif
else
ifeq ($(suffix $(ICON)), .grf)
export GAME_ICON := $(CURDIR)/$(ICON)
else
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
endif
endif
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
$(OUTPUT).elf: $(OFILES)
# source files depend on generated headers
$(OFILES_SOURCES) : $(HFILES)
# need to build soundbank first
$(OFILES): $(SOUNDBANK)
#---------------------------------------------------------------------------------
# rule to build solution from music files
#---------------------------------------------------------------------------------
$(SOUNDBANK) : $(MODFILES)
#---------------------------------------------------------------------------------
mmutil $^ -d -o$@ -hsoundbank.h
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule creates assembly source files using grit
# grit takes an image file and a .grit describing how the file is to be processed
# add additional rules like this for each image extension
# you use in the graphics folders
#---------------------------------------------------------------------------------
%.s %.h: %.png %.grit
#---------------------------------------------------------------------------------
grit $< -fts -o$*
#---------------------------------------------------------------------------------
# Convert non-GRF game icon to GRF if needed
#---------------------------------------------------------------------------------
$(GAME_ICON): $(notdir $(ICON))
#---------------------------------------------------------------------------------
@echo convert $(notdir $<)
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
include ../../Makefile.example

View File

@ -1 +0,0 @@
include ../../Makefile.example.blocksds

View File

@ -1,38 +1,21 @@
#!/bin/sh
#!/bin/bash
grit pointer.png -ftb -fh! -gTFF00FF -gt -gB8 -m!
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
GRIT=$BLOCKSDS/tools/grit/grit
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT pointer.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
mv *.pal *.img ../nitrofiles/sprite
grit colmap.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
grit layer3.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT colmap.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
$GRIT layer3.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
mv *.pal *.img *.map ../nitrofiles/bg
grit cmap.png -ftb -fh! -g! -gB8 -mRt -mLf -p!
$GRIT cmap.png -ftB -fh! -g! -gB8 -mRt -mLf -p!
for file in *.map.bin; do
mv -- "$file" "${file%.map.bin}".cmp
done
mv *.map ../nitrofiles/maps
mv *.cmp ../nitrofiles/maps
$GRIT default.png -ftB -fh! -gt -gB8 -m!
grit default.png -ftb -fh! -gt -gB8 -m!
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
for file in *.img; do
mv -- "$file" "${file%.img}".fnt
done
mv *.pal *.fnt ../nitrofiles/fnt
mv *.pal *.img ../nitrofiles/fnt

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

25
examples/demo/Makefile Normal file
View File

@ -0,0 +1,25 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023-2024
.PHONY: all clean
MAKE := make
all:
@for i in `ls`; do \
if test -e $$i/Makefile ; then \
cd $$i; \
$(MAKE) --no-print-directory || exit 1; \
cd ..; \
fi; \
done;
clean:
@for i in `ls`; do \
if test -e $$i/Makefile ; then \
cd $$i; \
$(MAKE) clean --no-print-directory || exit 1; \
cd ..; \
fi; \
done;

View File

@ -1,25 +0,0 @@
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023
.PHONY: all clean
MAKE := make
all:
@for i in `ls`; do \
if test -e $$i/Makefile.blocksds ; then \
cd $$i; \
$(MAKE) -f Makefile.blocksds --no-print-directory || { exit 1;}; \
cd ..; \
fi; \
done;
clean:
@for i in `ls`; do \
if test -e $$i/Makefile.blocksds ; then \
cd $$i; \
$(MAKE) -f Makefile.blocksds clean --no-print-directory || { exit 1;}; \
cd ..; \
fi; \
done;

View File

@ -1,222 +1 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
# These set the information text in the nds file
#GAME_TITLE := My Wonderful Homebrew
#GAME_SUBTITLE1 := built with devkitARM
#GAME_SUBTITLE2 := http://devitpro.org
include $(DEVKITARM)/ds_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
# DATA is a list of directories containing binary files embedded using bin2o
# GRAPHICS is a list of directories containing image files to be converted with grit
# AUDIO is a list of directories containing audio to be converted by maxmod
# ICON is the image used to create the game icon, leave blank to use default rule
# NITRO is a directory that will be accessible via NitroFS
#---------------------------------------------------------------------------------
TARGET := $(shell basename $(CURDIR))
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
GRAPHICS :=
AUDIO :=
ICON :=
# specify a directory which contains the nitro filesystem
# this is relative to the Makefile
NITRO := nitrofiles
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
CFLAGS := -g -Wall -O3\
$(ARCH) $(INCLUDE) -DARM9
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project (order is important)
#---------------------------------------------------------------------------------
LIBS := -lnflib
# automatigically add libraries for NitroFS
ifneq ($(strip $(NITRO)),)
LIBS := $(LIBS) -lfilesystem -lfat
endif
# automagically add maxmod library
ifneq ($(strip $(AUDIO)),)
LIBS := $(LIBS) -lmm9
endif
LIBS := $(LIBS) -lnds9
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBNDS) $(PORTLIBS) $(DEVKITPRO)/nflib
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(CURDIR)/$(subst /,,$(dir $(ICON)))\
$(foreach dir,$(SOURCES),$(CURDIR)/$(dir))\
$(foreach dir,$(DATA),$(CURDIR)/$(dir))\
$(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
PNGFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.png)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
# prepare NitroFS directory
ifneq ($(strip $(NITRO)),)
export NITRO_FILES := $(CURDIR)/$(NITRO)
endif
# get audio list for maxmod
ifneq ($(strip $(AUDIO)),)
export MODFILES := $(foreach dir,$(notdir $(wildcard $(AUDIO)/*.*)),$(CURDIR)/$(AUDIO)/$(dir))
# place the soundbank file in NitroFS if using it
ifneq ($(strip $(NITRO)),)
export SOUNDBANK := $(NITRO_FILES)/soundbank.bin
# otherwise, needs to be loaded from memory
else
export SOUNDBANK := soundbank.bin
BINFILES += $(SOUNDBANK)
endif
endif
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(PNGFILES:.png=.o) $(OFILES_BIN) $(OFILES_SOURCES)
export HFILES := $(PNGFILES:.png=.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-iquote $(CURDIR)/$(dir))\
$(foreach dir,$(LIBDIRS),-I$(dir)/include)\
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.bmp)
ifneq (,$(findstring $(TARGET).bmp,$(icons)))
export GAME_ICON := $(CURDIR)/$(TARGET).bmp
else
ifneq (,$(findstring icon.bmp,$(icons)))
export GAME_ICON := $(CURDIR)/icon.bmp
endif
endif
else
ifeq ($(suffix $(ICON)), .grf)
export GAME_ICON := $(CURDIR)/$(ICON)
else
export GAME_ICON := $(CURDIR)/$(BUILD)/$(notdir $(basename $(ICON))).grf
endif
endif
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).nds $(SOUNDBANK)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).nds: $(OUTPUT).elf $(NITRO_FILES) $(GAME_ICON)
$(OUTPUT).elf: $(OFILES)
# source files depend on generated headers
$(OFILES_SOURCES) : $(HFILES)
# need to build soundbank first
$(OFILES): $(SOUNDBANK)
#---------------------------------------------------------------------------------
# rule to build solution from music files
#---------------------------------------------------------------------------------
$(SOUNDBANK) : $(MODFILES)
#---------------------------------------------------------------------------------
mmutil $^ -d -o$@ -hsoundbank.h
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
#---------------------------------------------------------------------------------
# This rule creates assembly source files using grit
# grit takes an image file and a .grit describing how the file is to be processed
# add additional rules like this for each image extension
# you use in the graphics folders
#---------------------------------------------------------------------------------
%.s %.h: %.png %.grit
#---------------------------------------------------------------------------------
grit $< -fts -o$*
#---------------------------------------------------------------------------------
# Convert non-GRF game icon to GRF if needed
#---------------------------------------------------------------------------------
$(GAME_ICON): $(notdir $(ICON))
#---------------------------------------------------------------------------------
@echo convert $(notdir $<)
@grit $< -g -gt -gB4 -gT FF00FF -m! -p -pe 16 -fh! -ftr
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
include ../../Makefile.example

View File

@ -1 +0,0 @@
include ../../Makefile.example.blocksds

View File

@ -1,23 +1,18 @@
#!/bin/sh
#!/bin/bash
grit ball.png -ftb -fh! -gTFF00FF -gt -gB8 -m!
BLOCKSDS="${BLOCKSDS:-/opt/blocksds/core/}"
GRIT=$BLOCKSDS/tools/grit/grit
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT ball.png -ftB -fh! -gTFF00FF -gt -gB8 -m!
mv *.pal *.img ../nitrofiles/spr
# The two backgrounds that share the palette have been edited to use 128 colors
# each, so that the final combined palette is 256 colors in size.
grit img8b_1.png img8b_2.png -ftb -fh! -gTFF00FF -gb -gB8 -pS -Oimg8b_1.pal
$GRIT img8b_1.png img8b_2.png -ftB -fh! -gTFF00FF -gb -gB8 -pS -Oimg8b_1.pal
grit nfl.png -ftb -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
for file in *.bin; do
mv -- "$file" "${file%.bin}"
done
$GRIT nfl.png -ftB -fh! -gTFF00FF -gt -gB8 -mR8 -mLs
# This is required or the library will say that the second background doesn't
# have a palette.

View File

@ -1,4 +1,4 @@
¢Œ1÷9f-MF·V°5!2B[VF¨9ÌArVZBð=»Ri-1FD)ÃÛ5kFé9 >ú^wN%4Fg1Ì5ÔZ/N©5žJqN´ Jù^6F&-•N%»Võ9/FË=g-®5Š5¹VsN_V§5ÅzJ“Zª=•R%!
B'!XFÏ=¿{ñ1:0N'))QR½N!o-£ BPBBTNé5FØVÝVˆ—Nµ1cñ=ä 1Jh5BÊ9E)BÌ9î97BtF\Bײ5³V!Ø5†-5J/J‰9qRïEµVûZ—V1xNNJZFACA<EFBFBD>)‡BI,-¤¡eÇ ƒAË-U*ƒë@R-Nâ8ÆA%-ƒv‰$cTnÄIRÇèF%R¥)1 7=Ã(S'd@nªX'5À]
|Œ1÷9f-MF·V°5!2B[VF¨9ÌArVZBð=»Ri-1FD)ÃÛ5kFé9 >ú^wN%4Fg1Ì5ÔZ/N©5žJqN´ Jù^6F&-•N%»Võ9/FË=g-®5Š5¹VsN_V§5ÅzJ“Zª=•R%!
B'!XFÏ=¿{ñ1:0N'))QR½N!o-£ BPBBTNé5FØVÝVˆ—Nµ1cñ=ä 1Jh5BÊ9E)BÌ9î97BtF\Bײ5³V!Ø5†-5J/J‰9qRïEµVûZ—V1xNNJZF¢CA<EFBFBD>)‡BI,-¤¡eÇ ƒAË-U*ƒë@R-Nâ8ÆA%-ƒv‰$cTnÄIRÇèF%R¥)1 7=Ã(S'd@nªX'5À]
^È9<C388>b´…Y…@
rÑ1'Aü#n¦ £eQŽ5 (9¥¢QD=®,‰E«90:å$8#íAbVãAª Ö DJJFô6Ô-E9‡Mb§EcÈ)ã0I57Vl=.B…¤d AZ5P%Är !¦(9d5Æg5ì©AÙ.…JÇB §BEe¢U«G=ªdÏ(
rÑ1'Aü#n¦ £eQŽ5 (9¥¢QD=®,‰E«90:å$8#íAbVãAª Ö DJJFô6Ô-E9‡Mb§EcÈ)ã0I57Vl=.B…¤d AZ5P%Är !¦(9d5Æg5ì©AÙ.…JÇB §BEe¢U«G=ªdÏ(A

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More