From 6b65626a4979b5a281d16f03750c4c1fd5825032 Mon Sep 17 00:00:00 2001 From: Crayon2000 Date: Thu, 31 Oct 2024 20:02:10 -0400 Subject: [PATCH] Update template code --- examples/gamecube/template/Makefile | 18 +++++++++++++++--- examples/template/Makefile | 18 +++++++++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/examples/gamecube/template/Makefile b/examples/gamecube/template/Makefile index eb145d8..8b383ad 100644 --- a/examples/gamecube/template/Makefile +++ b/examples/gamecube/template/Makefile @@ -19,6 +19,7 @@ TARGET := $(notdir $(CURDIR)) BUILD := build SOURCES := source DATA := data +TEXTURES := textures INCLUDES := #--------------------------------------------------------------------------------- @@ -54,7 +55,8 @@ ifneq ($(BUILD),$(notdir $(CURDIR))) export OUTPUT := $(CURDIR)/$(TARGET) export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ - $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ + $(foreach dir,$(TEXTURES),$(CURDIR)/$(dir)) export DEPSDIR := $(CURDIR)/$(BUILD) @@ -66,6 +68,8 @@ CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) +SCFFILES := $(foreach dir,$(TEXTURES),$(notdir $(wildcard $(dir)/*.scf))) +TPLFILES := $(SCFFILES:.scf=.tpl) #--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C @@ -76,11 +80,11 @@ else export LD := $(CXX) endif -export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(TPLFILES)) export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) -export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -142,6 +146,14 @@ $(OFILES_SOURCES) : $(HFILES) @echo $(notdir $<) $(bin2o) +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .tpl extension +#--------------------------------------------------------------------------------- +%.tpl.o %_tpl.h : %.tpl +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + -include $(DEPENDS) #--------------------------------------------------------------------------------- diff --git a/examples/template/Makefile b/examples/template/Makefile index c62800a..45bfa8a 100644 --- a/examples/template/Makefile +++ b/examples/template/Makefile @@ -19,6 +19,7 @@ TARGET := $(notdir $(CURDIR)) BUILD := build SOURCES := source DATA := data +TEXTURES := textures INCLUDES := #--------------------------------------------------------------------------------- @@ -55,7 +56,8 @@ ifneq ($(BUILD),$(notdir $(CURDIR))) export OUTPUT := $(CURDIR)/$(TARGET) export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ - $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ + $(foreach dir,$(TEXTURES),$(CURDIR)/$(dir)) export DEPSDIR := $(CURDIR)/$(BUILD) @@ -67,6 +69,8 @@ CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) +SCFFILES := $(foreach dir,$(TEXTURES),$(notdir $(wildcard $(dir)/*.scf))) +TPLFILES := $(SCFFILES:.scf=.tpl) #--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C @@ -77,11 +81,11 @@ else export LD := $(CXX) endif -export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(TPLFILES)) export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o) export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) -export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) +export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -143,6 +147,14 @@ $(OFILES_SOURCES) : $(HFILES) @echo $(notdir $<) $(bin2o) +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .tpl extension +#--------------------------------------------------------------------------------- +%.tpl.o %_tpl.h : %.tpl +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + -include $(DEPENDS) #---------------------------------------------------------------------------------