mirror of
https://github.com/knightfox75/nds_nflib.git
synced 2025-06-19 01:05:34 -04:00
Compare commits
38 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cc40a1daad | ||
![]() |
0159fb67bf | ||
![]() |
f834dd6bcb | ||
![]() |
2089aab7f9 | ||
![]() |
45eacf3336 | ||
![]() |
e4fd0ba9b6 | ||
![]() |
dc1de0cd56 | ||
![]() |
fc762cb9c3 | ||
![]() |
ffb023de49 | ||
![]() |
e6242613c9 | ||
![]() |
3002fad8d1 | ||
![]() |
b80d754974 | ||
![]() |
e4171984aa | ||
![]() |
8228b95a85 | ||
![]() |
659ea7f5cd | ||
![]() |
62df61ca36 | ||
![]() |
9827b42f35 | ||
![]() |
b9cbe66d3a | ||
![]() |
bedb6b1b3a | ||
![]() |
67f129bc1e | ||
![]() |
0079268fcd | ||
![]() |
86c952817f | ||
![]() |
4abfaca8a2 | ||
![]() |
50437c3839 | ||
![]() |
d892d6cc8a | ||
![]() |
70fe30ef29 | ||
![]() |
418791f8f2 | ||
![]() |
e2a8e1ad4d | ||
![]() |
c5c64a5cc1 | ||
![]() |
92007d25f8 | ||
![]() |
e7ec60cf47 | ||
![]() |
e6567ee10f | ||
![]() |
71700aab03 | ||
![]() |
72010704c4 | ||
![]() |
194561993a | ||
![]() |
3b106b9f36 | ||
![]() |
537748791e | ||
![]() |
e9f12e4aee |
254
Makefile
254
Makefile
@ -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 $@
|
||||
DEFINES += -D__NDS__ -DARM9
|
||||
|
||||
$(BUILD): lib
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
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)
|
||||
|
@ -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)
|
@ -1,3 +1,57 @@
|
||||
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
|
||||
-------------------------
|
||||
|
||||
|
25
examples/3dsprites/Makefile
Normal file
25
examples/3dsprites/Makefile
Normal 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;
|
@ -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;
|
@ -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
|
||||
|
@ -1 +0,0 @@
|
||||
include ../../Makefile.example.blocksds
|
@ -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
|
||||
|
Binary file not shown.
@ -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?¹bb3Ý&\$%ÏÉÜ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?¹bb3Ý&\$%ÏÉÜ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"Ú$µÒ%×ÃÇ!!
|
@ -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
|
||||
|
@ -1 +0,0 @@
|
||||
include ../../Makefile.example.blocksds
|
@ -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
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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
|
||||
|
@ -1 +0,0 @@
|
||||
include ../../Makefile.example.blocksds
|
@ -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
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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
|
||||
|
@ -1 +0,0 @@
|
||||
include ../../Makefile.example.blocksds
|
@ -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
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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
|
||||
|
@ -1 +0,0 @@
|
||||
include ../../Makefile.example.blocksds
|
@ -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
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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
|
||||
|
@ -1 +0,0 @@
|
||||
include ../../Makefile.example.blocksds
|
@ -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
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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
|
||||
|
@ -1 +0,0 @@
|
||||
include ../../Makefile.example.blocksds
|
@ -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
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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
|
||||
|
@ -1 +0,0 @@
|
||||
include ../../Makefile.example.blocksds
|
@ -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
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
25
examples/Makefile
Normal file
25
examples/Makefile
Normal 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
|
@ -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
|
@ -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
|
||||
|
25
examples/collisions/Makefile
Normal file
25
examples/collisions/Makefile
Normal 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;
|
@ -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;
|
@ -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
|
||||
|
@ -1 +0,0 @@
|
||||
include ../../Makefile.example.blocksds
|
@ -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
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
@ -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
|
||||
|
@ -1 +0,0 @@
|
||||
include ../../Makefile.example.blocksds
|
@ -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
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
@ -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
|
||||
|
@ -1 +0,0 @@
|
||||
include ../../Makefile.example.blocksds
|
@ -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
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
25
examples/demo/Makefile
Normal file
25
examples/demo/Makefile
Normal 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;
|
@ -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;
|
@ -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
|
||||
|
@ -1 +0,0 @@
|
||||
include ../../Makefile.example.blocksds
|
@ -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.
|
||||
|
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
¢Œ1÷9f-MF·V°5!2B[VF¨9ÌArVZBð=»Ri-1FD)ÃÛ5kFé9
>ú^wN%4Fg1Ì5ÔZ/N©5žJqN´5ã
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×Z¤²5³V!Ø5†-5J/J‰9qRïEµVûZ—V‹1xNNJZFACA<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´5ã
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×Z¤²5³V!Ø5†-5J/J‰9qRïEµVûZ—V‹1xNNJZF¢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…¤dAZ5P%Är!¦(9d5Æg5ì %ï©AÙ.…JÇB§††B‹Ee¢U«G=ªdÏ(
|
||||
rÑ1'Aü#n¦ £eQŽ5!©(9¥¢QD=®,‰E«90:å$8#íAbVãAªÖ
DJJFô6Ô-E9‡Mb§EcÈ)ã0I57Vl=.B…¤dAZ5P%Är!¦(9d5Æg5ì %ï©AÙ.…JÇB§††B‹Ee¢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
Loading…
Reference in New Issue
Block a user