From 27445c54a1eef88482e8f6afb9d55013f958fdaa Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Tue, 28 Feb 2017 12:52:37 +0000 Subject: [PATCH] fix parallel builds --- audio/modplay/Makefile | 12 ++++-- audio/mp3player/Makefile | 16 +++++--- audio/oggplayer/Makefile | 31 ++++++++------- graphics/gx/gxSprites/Makefile | 13 ++++--- graphics/gx/neheGX/lesson01/Makefile | 36 ++++++++++++------ graphics/gx/neheGX/lesson02/Makefile | 38 +++++++++++++++---- graphics/gx/neheGX/lesson03/Makefile | 38 +++++++++++++++---- graphics/gx/neheGX/lesson04/Makefile | 38 +++++++++++++++---- graphics/gx/neheGX/lesson05/Makefile | 38 +++++++++++++++---- graphics/gx/neheGX/lesson06/Makefile | 22 ++++++++--- graphics/gx/neheGX/lesson07/Makefile | 22 ++++++++--- graphics/gx/neheGX/lesson08/Makefile | 22 ++++++++--- graphics/gx/neheGX/lesson09/Makefile | 24 +++++++++--- graphics/gx/neheGX/lesson10/Makefile | 19 ++++++---- graphics/gx/neheGX/lesson10/source/lesson10.c | 32 ++++++++-------- graphics/gx/neheGX/lesson11/Makefile | 21 ++++++---- graphics/gx/neheGX/lesson12/Makefile | 19 +++++++--- graphics/gx/neheGX/lesson19/Makefile | 25 +++++++++--- graphics/gx/triangle/Makefile | 1 + template/Makefile | 12 ++++-- 20 files changed, 340 insertions(+), 139 deletions(-) diff --git a/audio/modplay/Makefile b/audio/modplay/Makefile index 4226fe0..29ecc54 100644 --- a/audio/modplay/Makefile +++ b/audio/modplay/Makefile @@ -73,9 +73,12 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +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))) + #--------------------------------------------------------------------------------- # build a list of include paths @@ -120,10 +123,11 @@ DEPENDS := $(OFILES:.o=.d) $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) #--------------------------------------------------------------------------------- # This rule links in binary data with the .mod extension #--------------------------------------------------------------------------------- -%.mod.o : %.mod +%.mod.o %_mod.h : %.mod #--------------------------------------------------------------------------------- @echo $(notdir $<) $(bin2o) diff --git a/audio/mp3player/Makefile b/audio/mp3player/Makefile index a4b762e..b00bac6 100644 --- a/audio/mp3player/Makefile +++ b/audio/mp3player/Makefile @@ -73,9 +73,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +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))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -106,7 +108,7 @@ clean: #--------------------------------------------------------------------------------- run: - wiiload $(OUTPUT).dol + wiiload $(TARGET).dol #--------------------------------------------------------------------------------- @@ -120,10 +122,12 @@ DEPENDS := $(OFILES:.o=.d) $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) + #--------------------------------------------------------------------------------- -# This rule links in binary data with the .mp3 extension +# This rule links in binary data with the .jpg extension #--------------------------------------------------------------------------------- -%.mp3.o : %.mp3 +%.mp3.o %_mp3.h : %.mp3 #--------------------------------------------------------------------------------- @echo $(notdir $<) $(bin2o) diff --git a/audio/oggplayer/Makefile b/audio/oggplayer/Makefile index a7c5724..51932f0 100644 --- a/audio/oggplayer/Makefile +++ b/audio/oggplayer/Makefile @@ -33,13 +33,13 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lwiiuse -lbte -lvorbisidec -lasnd -logc -lm +LIBS := -lwiiuse -lbte -lvorbisdec -lasnd -logc -lm #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- -LIBDIRS := $(PORTLIBS) +LIBDIRS := #--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional @@ -73,23 +73,25 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +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))) #--------------------------------------------------------------------------------- # build a list of include paths #--------------------------------------------------------------------------------- export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ - $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) \ - -I$(LIBOGC_INC) + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ - -L$(LIBOGC_LIB) + -L$(LIBOGC_LIB) export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean @@ -102,7 +104,6 @@ $(BUILD): @echo "Please install libtremor from https://sourceforge.net/projects/devkitpro/files/portlibs/ppc/" @echo "*------------------------------------------------------------------------------------------*" @echo - else #--------------------------------------------------------------------------------- @@ -120,7 +121,7 @@ clean: #--------------------------------------------------------------------------------- run: - wiiload $(OUTPUT).dol + wiiload $(TARGET).dol #--------------------------------------------------------------------------------- @@ -134,13 +135,15 @@ DEPENDS := $(OFILES:.o=.d) $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) + #--------------------------------------------------------------------------------- -# This rule links in binary data with the .ogg extension +# This rule links in binary data with the .jpg extension #--------------------------------------------------------------------------------- -%.ogg.o : %.ogg +%.ogg.o %_ogg.h : %.ogg #--------------------------------------------------------------------------------- @echo $(notdir $<) - @$(bin2o) + $(bin2o) -include $(DEPENDS) diff --git a/graphics/gx/gxSprites/Makefile b/graphics/gx/gxSprites/Makefile index 2d4a7d1..e54e57d 100644 --- a/graphics/gx/gxSprites/Makefile +++ b/graphics/gx/gxSprites/Makefile @@ -83,10 +83,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(addsuffix .o,$(TPLFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +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))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -127,6 +128,8 @@ else $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) + #--------------------------------------------------------------------------------- # This rule links in binary data with the .bin extension #--------------------------------------------------------------------------------- @@ -136,7 +139,7 @@ $(OUTPUT).elf: $(OFILES) $(bin2o) #--------------------------------------------------------------------------------- -%.tpl.o : %.tpl +%.tpl.o %_tpl.h : %.tpl #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) diff --git a/graphics/gx/neheGX/lesson01/Makefile b/graphics/gx/neheGX/lesson01/Makefile index 16c5b3b..eb9a29b 100644 --- a/graphics/gx/neheGX/lesson01/Makefile +++ b/graphics/gx/neheGX/lesson01/Makefile @@ -2,6 +2,7 @@ # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: +.SECONDARY: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") @@ -18,7 +19,8 @@ include $(DEVKITPPC)/wii_rules TARGET := $(notdir $(CURDIR)) BUILD := build SOURCES := source -DATA := data +DATA := +TEXTURES := textures INCLUDES := #--------------------------------------------------------------------------------- @@ -51,7 +53,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) @@ -63,6 +66,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 @@ -73,9 +78,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +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))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -110,23 +117,30 @@ run: #--------------------------------------------------------------------------------- else -DEPENDS := $(OFILES:.o=.d) - #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .bin extension #--------------------------------------------------------------------------------- -# This rule links in binary data with the .jpg extension +%.bin.o %_bin.h : %.bin #--------------------------------------------------------------------------------- -%.jpg.o : %.jpg + @echo $(notdir $<) + @$(bin2o) + +#--------------------------------------------------------------------------------- +%.tpl.o %_tpl.h : %.tpl #--------------------------------------------------------------------------------- @echo $(notdir $<) - $(bin2o) + @$(bin2o) + --include $(DEPENDS) +-include $(DEPSDIR)/*.d #--------------------------------------------------------------------------------- endif diff --git a/graphics/gx/neheGX/lesson02/Makefile b/graphics/gx/neheGX/lesson02/Makefile index e187525..eb9a29b 100644 --- a/graphics/gx/neheGX/lesson02/Makefile +++ b/graphics/gx/neheGX/lesson02/Makefile @@ -2,6 +2,7 @@ # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: +.SECONDARY: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") @@ -18,7 +19,8 @@ include $(DEVKITPPC)/wii_rules TARGET := $(notdir $(CURDIR)) BUILD := build SOURCES := source -DATA := data +DATA := +TEXTURES := textures INCLUDES := #--------------------------------------------------------------------------------- @@ -51,7 +53,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) @@ -63,6 +66,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 @@ -73,9 +78,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +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))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -110,15 +117,30 @@ run: #--------------------------------------------------------------------------------- else -DEPENDS := $(OFILES:.o=.d) - #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) --include $(DEPENDS) +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .bin extension +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + +#--------------------------------------------------------------------------------- +%.tpl.o %_tpl.h : %.tpl +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + + +-include $(DEPSDIR)/*.d #--------------------------------------------------------------------------------- endif diff --git a/graphics/gx/neheGX/lesson03/Makefile b/graphics/gx/neheGX/lesson03/Makefile index e187525..eb9a29b 100644 --- a/graphics/gx/neheGX/lesson03/Makefile +++ b/graphics/gx/neheGX/lesson03/Makefile @@ -2,6 +2,7 @@ # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: +.SECONDARY: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") @@ -18,7 +19,8 @@ include $(DEVKITPPC)/wii_rules TARGET := $(notdir $(CURDIR)) BUILD := build SOURCES := source -DATA := data +DATA := +TEXTURES := textures INCLUDES := #--------------------------------------------------------------------------------- @@ -51,7 +53,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) @@ -63,6 +66,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 @@ -73,9 +78,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +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))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -110,15 +117,30 @@ run: #--------------------------------------------------------------------------------- else -DEPENDS := $(OFILES:.o=.d) - #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) --include $(DEPENDS) +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .bin extension +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + +#--------------------------------------------------------------------------------- +%.tpl.o %_tpl.h : %.tpl +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + + +-include $(DEPSDIR)/*.d #--------------------------------------------------------------------------------- endif diff --git a/graphics/gx/neheGX/lesson04/Makefile b/graphics/gx/neheGX/lesson04/Makefile index e187525..eb9a29b 100644 --- a/graphics/gx/neheGX/lesson04/Makefile +++ b/graphics/gx/neheGX/lesson04/Makefile @@ -2,6 +2,7 @@ # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: +.SECONDARY: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") @@ -18,7 +19,8 @@ include $(DEVKITPPC)/wii_rules TARGET := $(notdir $(CURDIR)) BUILD := build SOURCES := source -DATA := data +DATA := +TEXTURES := textures INCLUDES := #--------------------------------------------------------------------------------- @@ -51,7 +53,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) @@ -63,6 +66,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 @@ -73,9 +78,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +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))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -110,15 +117,30 @@ run: #--------------------------------------------------------------------------------- else -DEPENDS := $(OFILES:.o=.d) - #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) --include $(DEPENDS) +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .bin extension +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + +#--------------------------------------------------------------------------------- +%.tpl.o %_tpl.h : %.tpl +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + + +-include $(DEPSDIR)/*.d #--------------------------------------------------------------------------------- endif diff --git a/graphics/gx/neheGX/lesson05/Makefile b/graphics/gx/neheGX/lesson05/Makefile index e187525..eb9a29b 100644 --- a/graphics/gx/neheGX/lesson05/Makefile +++ b/graphics/gx/neheGX/lesson05/Makefile @@ -2,6 +2,7 @@ # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: +.SECONDARY: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") @@ -18,7 +19,8 @@ include $(DEVKITPPC)/wii_rules TARGET := $(notdir $(CURDIR)) BUILD := build SOURCES := source -DATA := data +DATA := +TEXTURES := textures INCLUDES := #--------------------------------------------------------------------------------- @@ -51,7 +53,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) @@ -63,6 +66,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 @@ -73,9 +78,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +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))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -110,15 +117,30 @@ run: #--------------------------------------------------------------------------------- else -DEPENDS := $(OFILES:.o=.d) - #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) --include $(DEPENDS) +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .bin extension +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + +#--------------------------------------------------------------------------------- +%.tpl.o %_tpl.h : %.tpl +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + + +-include $(DEPSDIR)/*.d #--------------------------------------------------------------------------------- endif diff --git a/graphics/gx/neheGX/lesson06/Makefile b/graphics/gx/neheGX/lesson06/Makefile index ef8bb47..eb9a29b 100644 --- a/graphics/gx/neheGX/lesson06/Makefile +++ b/graphics/gx/neheGX/lesson06/Makefile @@ -2,6 +2,7 @@ # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: +.SECONDARY: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") @@ -77,10 +78,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(addsuffix .o,$(TPLFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +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))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -121,8 +123,18 @@ else $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .bin extension +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + #--------------------------------------------------------------------------------- -%.tpl.o : %.tpl +%.tpl.o %_tpl.h : %.tpl #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) diff --git a/graphics/gx/neheGX/lesson07/Makefile b/graphics/gx/neheGX/lesson07/Makefile index ef8bb47..eb9a29b 100644 --- a/graphics/gx/neheGX/lesson07/Makefile +++ b/graphics/gx/neheGX/lesson07/Makefile @@ -2,6 +2,7 @@ # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: +.SECONDARY: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") @@ -77,10 +78,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(addsuffix .o,$(TPLFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +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))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -121,8 +123,18 @@ else $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .bin extension +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + #--------------------------------------------------------------------------------- -%.tpl.o : %.tpl +%.tpl.o %_tpl.h : %.tpl #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) diff --git a/graphics/gx/neheGX/lesson08/Makefile b/graphics/gx/neheGX/lesson08/Makefile index 8fa3e83..583e93c 100644 --- a/graphics/gx/neheGX/lesson08/Makefile +++ b/graphics/gx/neheGX/lesson08/Makefile @@ -2,6 +2,7 @@ # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: +.SECONDARY: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") @@ -77,10 +78,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(addsuffix .o,$(TPLFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +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))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -121,8 +123,18 @@ else $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .bin extension + #--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + #--------------------------------------------------------------------------------- -%.tpl.o : %.tpl +%.tpl.o %_tpl.h : %.tpl #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) diff --git a/graphics/gx/neheGX/lesson09/Makefile b/graphics/gx/neheGX/lesson09/Makefile index f9f0a72..eb9a29b 100644 --- a/graphics/gx/neheGX/lesson09/Makefile +++ b/graphics/gx/neheGX/lesson09/Makefile @@ -2,6 +2,7 @@ # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: +.SECONDARY: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") @@ -26,7 +27,7 @@ INCLUDES := # options for code generation #--------------------------------------------------------------------------------- -CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) CXXFLAGS = $(CFLAGS) LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map @@ -77,10 +78,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(addsuffix .o,$(TPLFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +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))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -121,8 +123,18 @@ else $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .bin extension +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + #--------------------------------------------------------------------------------- -%.tpl.o : %.tpl +%.tpl.o %_tpl.h : %.tpl #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) diff --git a/graphics/gx/neheGX/lesson10/Makefile b/graphics/gx/neheGX/lesson10/Makefile index 38157d4..616435d 100644 --- a/graphics/gx/neheGX/lesson10/Makefile +++ b/graphics/gx/neheGX/lesson10/Makefile @@ -2,6 +2,7 @@ # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: +.SECONDARY: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") @@ -26,7 +27,7 @@ INCLUDES := # options for code generation #--------------------------------------------------------------------------------- -CFLAGS = -g -O2 -std=gnu99 $(MACHDEP) $(INCLUDE) +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) CXXFLAGS = $(CFLAGS) LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map @@ -77,10 +78,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(addsuffix .o,$(TPLFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +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))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -121,18 +123,21 @@ else $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) + #--------------------------------------------------------------------------------- -%.tpl.o : %.tpl +%.txt.o %_txt.h : %.txt #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) #--------------------------------------------------------------------------------- -%.txt.o : %.txt +%.tpl.o %_tpl.h : %.tpl #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) + -include $(DEPSDIR)/*.d #--------------------------------------------------------------------------------- diff --git a/graphics/gx/neheGX/lesson10/source/lesson10.c b/graphics/gx/neheGX/lesson10/source/lesson10.c index 1ea5e43..551e4b5 100644 --- a/graphics/gx/neheGX/lesson10/source/lesson10.c +++ b/graphics/gx/neheGX/lesson10/source/lesson10.c @@ -43,9 +43,9 @@ float xpos, zpos; f32 zdepth=0.0f; // depth into the screen static GXColor LightColors[] = { - { 0xFF, 0xFF, 0xFF, 0xFF }, // Light color 1 - { 0x80, 0x80, 0x80, 0xFF }, // Ambient 1 - { 0x80, 0x80, 0x80, 0xFF } // Material 1 + { 0xFF, 0xFF, 0xFF, 0xFF }, // Light color 1 + { 0x80, 0x80, 0x80, 0xFF }, // Ambient 1 + { 0x80, 0x80, 0x80, 0xFF } // Material 1 }; // A vertex is the basic element of our room. @@ -132,12 +132,12 @@ int main( int argc, char **argv ){ GX_SetDispCopyDst(rmode->fbWidth,xfbHeight); GX_SetCopyFilter(rmode->aa,rmode->sample_pattern,GX_TRUE,rmode->vfilter); GX_SetFieldMode(rmode->field_rendering,((rmode->viHeight==2*rmode->xfbHeight)?GX_ENABLE:GX_DISABLE)); - - if (rmode->aa) - GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR); - else - GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR); - + + if (rmode->aa) + GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR); + else + GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR); + GX_SetCullMode(GX_CULL_NONE); GX_CopyDisp(frameBuffer[fb],GX_TRUE); GX_SetDispCopyGamma(GX_GM_1_0); @@ -148,7 +148,7 @@ int main( int argc, char **argv ){ // so for ex. in the first call we are sending position data with // 3 values X,Y,Z of size F32. scale sets the number of fractional // bits for non float data. - GX_InvVtxCache(); + GX_InvVtxCache(); GX_ClearVtxDesc(); GX_SetVtxDesc(GX_VA_POS, GX_DIRECT); GX_SetVtxDesc(GX_VA_NRM, GX_DIRECT); @@ -165,9 +165,9 @@ int main( int argc, char **argv ){ f32 w = rmode->viWidth; f32 h = rmode->viHeight; guLightPerspective(mv,45, (f32)w/h, 1.05F, 1.0F, 0.0F, 0.0F); - guMtxTrans(mr, 0.0F, 0.0F, -1.0F); - guMtxConcat(mv, mr, mv); - GX_LoadTexMtxImm(mv, GX_TEXMTX0, GX_MTX3x4); + guMtxTrans(mr, 0.0F, 0.0F, -1.0F); + guMtxConcat(mv, mr, mv); + GX_LoadTexMtxImm(mv, GX_TEXMTX0, GX_MTX3x4); GX_InvalidateTexAll(); TPL_OpenTPLFromMemory(&mudTPL, (void *)mud_tpl,mud_tpl_size); @@ -374,9 +374,9 @@ void SetLight(Mtx view,GXColor litcol, GXColor ambcol,GXColor matcol) // set number of rasterized color channels GX_SetNumChans(1); - GX_SetChanCtrl(GX_COLOR0A0,GX_ENABLE,GX_SRC_REG,GX_SRC_REG,GX_LIGHT0,GX_DF_CLAMP,GX_AF_NONE); - GX_SetChanAmbColor(GX_COLOR0A0,ambcol); - GX_SetChanMatColor(GX_COLOR0A0,matcol); + GX_SetChanCtrl(GX_COLOR0A0,GX_ENABLE,GX_SRC_REG,GX_SRC_REG,GX_LIGHT0,GX_DF_CLAMP,GX_AF_NONE); + GX_SetChanAmbColor(GX_COLOR0A0,ambcol); + GX_SetChanMatColor(GX_COLOR0A0,matcol); } // Read in and parse world info. diff --git a/graphics/gx/neheGX/lesson11/Makefile b/graphics/gx/neheGX/lesson11/Makefile index 72be642..6084e95 100644 --- a/graphics/gx/neheGX/lesson11/Makefile +++ b/graphics/gx/neheGX/lesson11/Makefile @@ -2,6 +2,7 @@ # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: +.SECONDARY: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") @@ -26,7 +27,7 @@ INCLUDES := # options for code generation #--------------------------------------------------------------------------------- -CFLAGS = -g -O2 -std=gnu99 -Wall $(MACHDEP) $(INCLUDE) +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) CXXFLAGS = $(CFLAGS) LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map @@ -77,10 +78,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(addsuffix .o,$(TPLFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +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))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -121,18 +123,23 @@ else $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) + #--------------------------------------------------------------------------------- -%.tpl.o : %.tpl +# This rule links in binary data with the .bin extension +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) #--------------------------------------------------------------------------------- -%.txt.o : %.txt +%.tpl.o %_tpl.h : %.tpl #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) + -include $(DEPSDIR)/*.d #--------------------------------------------------------------------------------- diff --git a/graphics/gx/neheGX/lesson12/Makefile b/graphics/gx/neheGX/lesson12/Makefile index d0dc479..683e301 100644 --- a/graphics/gx/neheGX/lesson12/Makefile +++ b/graphics/gx/neheGX/lesson12/Makefile @@ -2,6 +2,7 @@ # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: +.SECONDARY: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") @@ -77,10 +78,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(addsuffix .o,$(TPLFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +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))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -121,18 +123,23 @@ else $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) + #--------------------------------------------------------------------------------- -%.tpl.o : %.tpl +# This rule links in binary data with the .bin extension +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) #--------------------------------------------------------------------------------- -%.txt.o : %.txt +%.tpl.o %_tpl.h : %.tpl #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) + -include $(DEPSDIR)/*.d #--------------------------------------------------------------------------------- diff --git a/graphics/gx/neheGX/lesson19/Makefile b/graphics/gx/neheGX/lesson19/Makefile index d0c771b..eb9a29b 100644 --- a/graphics/gx/neheGX/lesson19/Makefile +++ b/graphics/gx/neheGX/lesson19/Makefile @@ -2,6 +2,7 @@ # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: +.SECONDARY: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") @@ -26,7 +27,7 @@ INCLUDES := # options for code generation #--------------------------------------------------------------------------------- -CFLAGS = -g -O0 -Wall -std=gnu99 $(MACHDEP) $(INCLUDE) +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) CXXFLAGS = $(CFLAGS) LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map @@ -77,10 +78,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(addsuffix .o,$(TPLFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +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))) $(addsuffix .h,$(subst .,_,$(TPLFILES))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -121,12 +123,23 @@ else $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .bin extension #--------------------------------------------------------------------------------- -%.tpl.o : %.tpl +%.bin.o %_bin.h : %.bin #--------------------------------------------------------------------------------- @echo $(notdir $<) @$(bin2o) +#--------------------------------------------------------------------------------- +%.tpl.o %_tpl.h : %.tpl +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) + + -include $(DEPSDIR)/*.d #--------------------------------------------------------------------------------- diff --git a/graphics/gx/triangle/Makefile b/graphics/gx/triangle/Makefile index 4010934..3b062a2 100644 --- a/graphics/gx/triangle/Makefile +++ b/graphics/gx/triangle/Makefile @@ -2,6 +2,7 @@ # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: +.SECONDARY: #--------------------------------------------------------------------------------- # prevent deletion of implicit targets #--------------------------------------------------------------------------------- diff --git a/template/Makefile b/template/Makefile index f2f8bf6..3365f9e 100644 --- a/template/Makefile +++ b/template/Makefile @@ -73,9 +73,11 @@ else export LD := $(CXX) endif -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ - $(sFILES:.s=.o) $(SFILES:.S=.o) +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) +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))) #--------------------------------------------------------------------------------- # build a list of include paths @@ -120,10 +122,12 @@ DEPENDS := $(OFILES:.o=.d) $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) +$(OFILES_SOURCES) : $(HFILES) + #--------------------------------------------------------------------------------- # This rule links in binary data with the .jpg extension #--------------------------------------------------------------------------------- -%.jpg.o : %.jpg +%.jpg.o %_jpg.h : %.jpg #--------------------------------------------------------------------------------- @echo $(notdir $<) $(bin2o)