Updated makefiles to create and integrate GBFS

This commit is contained in:
Alex Gentilucci 2020-06-02 18:04:26 -06:00
parent 4d51b33d50
commit 9ecda5c8e3
Signed by: nytpu
GPG Key ID: 144ADD49F173F5CE
3 changed files with 23 additions and 14 deletions

View File

@ -1,5 +1,3 @@
# identical to the devkitarm template makefile, but uses tonclib instead of libgba
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
@ -18,25 +16,25 @@ include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/gba_rules.mak
# 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 data
# GRAPHICS is a list of directories containing files to be processed by grit
# GBFS_FILES is a list of files to be included in the GBFS store
#
# All directories are specified relative to the project directory where
# the makefile is found
#
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := src
INCLUDES := include
DATA :=
MUSIC :=
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := src
INCLUDES := include
GBFS_DIR := graphics
MUSIC :=
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -mthumb -mthumb-interwork
ARCH := -mthumb -mthumb-interwork
CFLAGS := -g -Wall -O2\
CFLAGS := -g -Wall -O2\
-mcpu=arm7tdmi -mtune=arm7tdmi\
$(ARCH)
@ -80,6 +78,7 @@ 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)/*.*)))
GBFSFILES := $(foreach dir,$(GBFS_DIR),$(wildcard $(dir)/*.*))
ifneq ($(strip $(MUSIC)),)
export AUDIOFILES := $(foreach dir,$(notdir $(wildcard $(MUSIC)/*.*)),$(CURDIR)/$(MUSIC)/$(dir))
@ -124,7 +123,7 @@ $(BUILD):
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).gba
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).gba data.gbfs
#---------------------------------------------------------------------------------
@ -134,12 +133,16 @@ else
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).gba : $(OUTPUT).elf
$(OUTPUT).gba : $(OUTPUT).elf data.gbfs
$(OUTPUT).elf : $(OFILES)
$(OFILES_SOURCES) : $(HFILES)
data.gbfs: $(wildcard ../$(GBFS_DIR)/*)
gbfs $@ $^
#---------------------------------------------------------------------------------
# The bin2o rule should be copied and modified
# for each extension used in the data directories
@ -160,7 +163,6 @@ soundbank.bin soundbank.h : $(AUDIOFILES)
@echo $(notdir $<)
@$(bin2o)
-include $(DEPSDIR)/*.d
#---------------------------------------------------------------------------------------
endif

View File

@ -48,6 +48,11 @@ make
You should get `game.gba` spat out in the project root. You can then run that
on your flashcart or in an emulator and it should just work™.
If you modified graphics at all, you *must* regenerate the bin files manually
(using `grit <file>.png -ff` or `grit <file>.png -ff<file>_f<frame>.grit` for
animations) and place them in the graphics folder. `make` will take care of
creating the GBFS file and adding it to the finished ROM for you though.
### repo layout
I don't expect anyone else to work on this, so it's more for my reference than
anyone else's.

View File

@ -15,6 +15,8 @@ LIBTONC := $(DEVKITPRO)/libtonc
@$(OBJCOPY) -O binary $< $@
@echo built ... $(notdir $@)
@gbafix $@
padbin 256 $@
cat $@ data.gbfs >> $@
#---------------------------------------------------------------------------------
%_mb.elf: