Added assets and started assets convertions in the Makefile
This commit is contained in:
parent
e5f548a327
commit
bde92a7e34
17
Makefile
17
Makefile
|
@ -4,18 +4,23 @@ BUILD_DIR = build
|
|||
# Source files
|
||||
SOURCES = \
|
||||
src/main.cpp \
|
||||
src/bin.cpp
|
||||
src/game_data.cpp
|
||||
|
||||
# Output file name
|
||||
# Assets files
|
||||
ASSETS = \
|
||||
assets/player-sheets/player_idle_sheet.png \
|
||||
assets/player-sheets/player_run_sheet.png
|
||||
|
||||
# Output target name
|
||||
OUTPUT = 2D_Engine_Casio_Tool
|
||||
|
||||
# Compiler and flags
|
||||
CXX = g++
|
||||
CXXFLAGS = -std=c++17 -g
|
||||
CXXFLAGS = -std=c++17 -g -I.
|
||||
LDFLAGS =
|
||||
|
||||
# Deduce objects
|
||||
OBJECTS = $(SOURCES:%.cpp=$(BUILD_DIR)/%.o)
|
||||
OBJECTS = $(SOURCES:%.cpp=$(BUILD_DIR)/%.o) $(ASSETS:%=$(BUILD_DIR)/%.o)
|
||||
|
||||
# Verbose mode
|
||||
ifeq ($(VERBOSE), 1)
|
||||
|
@ -53,6 +58,10 @@ $(BUILD_DIR)/%.o: %.cpp
|
|||
$(Q)mkdir -p $(dir $@)
|
||||
$(Q)$(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@
|
||||
|
||||
# Convert .png.o from .png
|
||||
$(BUILD_DIR)/%.png.o: %.png
|
||||
fxconv --toolchain=GNU --cg $< -o $@
|
||||
|
||||
# Source files dependencies
|
||||
-include $(OBJECTS:.o=.d)
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
*.png:
|
||||
type: bopti-image
|
||||
name_regex: (.*)\.png img_\1
|
|
@ -0,0 +1,3 @@
|
|||
*.png:
|
||||
type: bopti-image
|
||||
name_regex: (.*)\.png img_\1
|
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
|
@ -1211,18 +1211,6 @@ def elf(data, output, symbol, toolchain=None, arch=None, section=None,
|
|||
The symbol name must have a leading underscore if it is to be declared and
|
||||
used from a C program.
|
||||
|
||||
The toolchain can be any target triplet for which the compiler is
|
||||
available. The architecture is deduced from some typical triplets;
|
||||
otherwise it can be set, usually as "sh3" or "sh4-nofpu". This affects the
|
||||
--binary-architecture flag of objcopy. If arch is set to "fx" or "cg", this
|
||||
function tries to be smart and:
|
||||
|
||||
* Uses the name of the compiler if it contains a full architecture name
|
||||
such as "sh3", "sh4" or "sh4-nofpu";
|
||||
* Uses "sh3" for fx9860g and "sh4-nofpu" for fxcg50 if the toolchain is
|
||||
"sh-elf", which is a custom set;
|
||||
* Fails otherwise.
|
||||
|
||||
The section name can be specified, along with its flags. A typical example
|
||||
would be section=".rodata,contents,alloc,load,readonly,data", which is the
|
||||
default.
|
||||
|
@ -1254,19 +1242,14 @@ def elf(data, output, symbol, toolchain=None, arch=None, section=None,
|
|||
# Toolchain parameters
|
||||
|
||||
if toolchain is None:
|
||||
toolchain = "sh3eb-elf"
|
||||
toolchain = "GNU"
|
||||
if section is None:
|
||||
section = ".rodata,contents,alloc,load,readonly,data"
|
||||
|
||||
if arch in ["fx", "cg", None] and toolchain in ["sh3eb-elf", "sh4eb-elf",
|
||||
"sh4eb-nofpu-elf"]:
|
||||
arch = toolchain.replace("eb-", "-")[:-4]
|
||||
|
||||
elif arch == "fx" and toolchain == "sh-elf":
|
||||
if arch == "fx" and toolchain == "GNU":
|
||||
arch = "sh3"
|
||||
elif arch == "cg" and toolchain == "sh-elf":
|
||||
elif arch == "cg" and toolchain == "GNU":
|
||||
arch = "sh4-nofpu"
|
||||
|
||||
elif arch in ["fx", "cg", None]:
|
||||
raise FxconvError(f"non-trivial architecture for {toolchain} must be "+
|
||||
"specified")
|
||||
|
@ -1287,7 +1270,7 @@ def elf(data, output, symbol, toolchain=None, arch=None, section=None,
|
|||
|
||||
sybl = "_binary_" + fp_obj.name.replace("/", "_")
|
||||
objcopy_args = [
|
||||
f"{toolchain}-objcopy", "-I", "binary", "-O", "elf32-sh",
|
||||
f"objcopy", "-I", "binary", "-O", "elf64-sh",
|
||||
"--binary-architecture", arch, "--file-alignment", "4",
|
||||
"--rename-section", f".data={section}",
|
||||
"--redefine-sym", f"{sybl}_start={symbol}",
|
||||
|
|
Loading…
Reference in New Issue