Updated *most* examples to compile with grrlib 4.1.0

This commit is contained in:
csBlueChip 2009-08-20 22:05:44 +00:00
parent 25900af95f
commit c493224a34
13 changed files with 842 additions and 853 deletions

View file

@ -10,4 +10,4 @@ clean:
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done; @for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
dist: clean dist: clean
@tar --exclude=*CVS* -cvjf wii-examples-$(DATESTRING).tar.bz2 * @tar --exclude=.svn -cvjf wii-examples-$(DATESTRING).tar.bz2 *

View file

@ -1,140 +1,139 @@
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# Clear the implicit built in rules # Clear the implicit built in rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
.SUFFIXES: .SUFFIXES:
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),) ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC)
endif endif
include $(DEVKITPPC)/wii_rules include $(DEVKITPPC)/wii_rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# TARGET is the name of the output # TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed # BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code # SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files # INCLUDES is a list of directories containing extra header files
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
GRRLIB := ../../GRRLIB TARGET := $(notdir $(CURDIR))
TARGET := $(notdir $(CURDIR)) BUILD := build
BUILD := build SOURCES := source source/gfx
SOURCES := source source/gfx $(GRRLIB)/GRRLIB $(GRRLIB)/lib/libpng/pngu DATA := data
DATA := data INCLUDES :=
INCLUDES :=
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # options for code generation
# options for code generation #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE)
CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE) CXXFLAGS = $(CFLAGS)
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project
# any extra libraries we wish to link with the project #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- LIBS := -lgrrlib -lpngu -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
LIBS := -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing
# list of directories containing libraries, this must be the top level containing # include and lib
# include and lib #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- LIBDIRS := $(CURDIR)/$(GRRLIB)
LIBDIRS := $(CURDIR)/$(GRRLIB)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional
# no real need to edit anything past this point unless you need to add additional # rules for different file extensions
# rules for different file extensions #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- ifneq ($(BUILD),$(notdir $(CURDIR)))
ifneq ($(BUILD),$(notdir $(CURDIR))) #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ $(foreach dir,$(DATA),$(CURDIR)/$(dir))
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
export DEPSDIR := $(CURDIR)/$(BUILD)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # automatically build a list of object files for our project
# automatically build a list of object files for our project #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C
# use CXX for linking C++ projects, CC for standard C #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- ifeq ($(strip $(CPPFILES)),)
ifeq ($(strip $(CPPFILES)),) export LD := $(CC)
export LD := $(CC) else
else export LD := $(CXX)
export LD := $(CXX) endif
endif
export OFILES := $(addsuffix .o,$(BINFILES)) \
export OFILES := $(addsuffix .o,$(BINFILES)) \ $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ $(sFILES:.s=.o) $(SFILES:.S=.o)
$(sFILES:.s=.o) $(SFILES:.S=.o)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # build a list of include paths
# build a list of include paths #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \ -I$(CURDIR)/$(BUILD) \
-I$(CURDIR)/$(BUILD) \ -I$(LIBOGC_INC)
-I$(LIBOGC_INC)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # build a list of library paths
# build a list of library paths #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ -L$(LIBOGC_LIB)
-L$(LIBOGC_LIB)
export OUTPUT := $(CURDIR)/$(TARGET)
export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- $(BUILD):
$(BUILD): @[ -d $@ ] || mkdir -p $@
@[ -d $@ ] || mkdir -p $@ @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- clean:
clean: @echo clean ...
@echo clean ... @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- run:
run: psoload $(TARGET).dol
psoload $(TARGET).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- reload:
reload: psoload -r $(TARGET).dol
psoload -r $(TARGET).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- else
else
DEPENDS := $(OFILES:.o=.d)
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # main targets
# main targets #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- $(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES)
$(OUTPUT).elf: $(OFILES)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # This rule links in binary data with the .jpg extension
# This rule links in binary data with the .jpg extension #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- %.jpg.o : %.jpg
%.jpg.o : %.jpg #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- @echo $(notdir $<)
@echo $(notdir $<) $(bin2o)
$(bin2o)
-include $(DEPENDS)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- endif
endif #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------

View file

@ -4,7 +4,7 @@
How To use Bitmap FX How To use Bitmap FX
============================================*/ ============================================*/
#include "../../../GRRLIB/GRRLIB/GRRLIB.h" #include <grrlib.h>
#include <stdlib.h> #include <stdlib.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>

View file

@ -1,140 +1,139 @@
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# Clear the implicit built in rules # Clear the implicit built in rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
.SUFFIXES: .SUFFIXES:
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),) ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC)
endif endif
include $(DEVKITPPC)/wii_rules include $(DEVKITPPC)/wii_rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# TARGET is the name of the output # TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed # BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code # SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files # INCLUDES is a list of directories containing extra header files
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
GRRLIB := ../../GRRLIB TARGET := $(notdir $(CURDIR))
TARGET := $(notdir $(CURDIR)) BUILD := build
BUILD := build SOURCES := source source/gfx
SOURCES := source source/gfx $(GRRLIB)/GRRLIB $(GRRLIB)/lib/libpng/pngu DATA := data
DATA := data INCLUDES :=
INCLUDES :=
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # options for code generation
# options for code generation #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE)
CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE) CXXFLAGS = $(CFLAGS)
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project
# any extra libraries we wish to link with the project #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- LIBS := -lgrrlib -lpngu -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
LIBS := -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing
# list of directories containing libraries, this must be the top level containing # include and lib
# include and lib #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- LIBDIRS := $(CURDIR)/$(GRRLIB)
LIBDIRS := $(CURDIR)/$(GRRLIB)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional
# no real need to edit anything past this point unless you need to add additional # rules for different file extensions
# rules for different file extensions #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- ifneq ($(BUILD),$(notdir $(CURDIR)))
ifneq ($(BUILD),$(notdir $(CURDIR))) #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ $(foreach dir,$(DATA),$(CURDIR)/$(dir))
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
export DEPSDIR := $(CURDIR)/$(BUILD)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # automatically build a list of object files for our project
# automatically build a list of object files for our project #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C
# use CXX for linking C++ projects, CC for standard C #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- ifeq ($(strip $(CPPFILES)),)
ifeq ($(strip $(CPPFILES)),) export LD := $(CC)
export LD := $(CC) else
else export LD := $(CXX)
export LD := $(CXX) endif
endif
export OFILES := $(addsuffix .o,$(BINFILES)) \
export OFILES := $(addsuffix .o,$(BINFILES)) \ $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ $(sFILES:.s=.o) $(SFILES:.S=.o)
$(sFILES:.s=.o) $(SFILES:.S=.o)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # build a list of include paths
# build a list of include paths #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \ -I$(CURDIR)/$(BUILD) \
-I$(CURDIR)/$(BUILD) \ -I$(LIBOGC_INC)
-I$(LIBOGC_INC)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # build a list of library paths
# build a list of library paths #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ -L$(LIBOGC_LIB)
-L$(LIBOGC_LIB)
export OUTPUT := $(CURDIR)/$(TARGET)
export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- $(BUILD):
$(BUILD): @[ -d $@ ] || mkdir -p $@
@[ -d $@ ] || mkdir -p $@ @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- clean:
clean: @echo clean ...
@echo clean ... @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- run:
run: psoload $(TARGET).dol
psoload $(TARGET).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- reload:
reload: psoload -r $(TARGET).dol
psoload -r $(TARGET).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- else
else
DEPENDS := $(OFILES:.o=.d)
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # main targets
# main targets #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- $(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES)
$(OUTPUT).elf: $(OFILES)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # This rule links in binary data with the .jpg extension
# This rule links in binary data with the .jpg extension #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- %.jpg.o : %.jpg
%.jpg.o : %.jpg #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- @echo $(notdir $<)
@echo $(notdir $<) $(bin2o)
$(bin2o)
-include $(DEPENDS)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- endif
endif #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------

View file

@ -5,8 +5,7 @@
This code shows how to draw This code shows how to draw
vectors using GRRLIB_DrawImgQuad. vectors using GRRLIB_DrawImgQuad.
============================================*/ ============================================*/
#include "../../../GRRLIB/GRRLIB/GRRLIB.h" #include <grrlib.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>

View file

@ -1,140 +1,139 @@
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# Clear the implicit built in rules # Clear the implicit built in rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
.SUFFIXES: .SUFFIXES:
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),) ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC)
endif endif
include $(DEVKITPPC)/wii_rules include $(DEVKITPPC)/wii_rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# TARGET is the name of the output # TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed # BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code # SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files # INCLUDES is a list of directories containing extra header files
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
GRRLIB := ../../GRRLIB TARGET := $(notdir $(CURDIR))
TARGET := $(notdir $(CURDIR)) BUILD := build
BUILD := build SOURCES := source source/gfx
SOURCES := source source/gfx $(GRRLIB)/GRRLIB $(GRRLIB)/lib/libpng/pngu DATA := data
DATA := data INCLUDES :=
INCLUDES :=
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # options for code generation
# options for code generation #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE)
CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE) CXXFLAGS = $(CFLAGS)
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project
# any extra libraries we wish to link with the project #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- LIBS := -lgrrlib -lpngu -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
LIBS := -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing
# list of directories containing libraries, this must be the top level containing # include and lib
# include and lib #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- LIBDIRS := $(CURDIR)/$(GRRLIB)
LIBDIRS := $(CURDIR)/$(GRRLIB)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional
# no real need to edit anything past this point unless you need to add additional # rules for different file extensions
# rules for different file extensions #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- ifneq ($(BUILD),$(notdir $(CURDIR)))
ifneq ($(BUILD),$(notdir $(CURDIR))) #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ $(foreach dir,$(DATA),$(CURDIR)/$(dir))
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
export DEPSDIR := $(CURDIR)/$(BUILD)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # automatically build a list of object files for our project
# automatically build a list of object files for our project #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C
# use CXX for linking C++ projects, CC for standard C #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- ifeq ($(strip $(CPPFILES)),)
ifeq ($(strip $(CPPFILES)),) export LD := $(CC)
export LD := $(CC) else
else export LD := $(CXX)
export LD := $(CXX) endif
endif
export OFILES := $(addsuffix .o,$(BINFILES)) \
export OFILES := $(addsuffix .o,$(BINFILES)) \ $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ $(sFILES:.s=.o) $(SFILES:.S=.o)
$(sFILES:.s=.o) $(SFILES:.S=.o)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # build a list of include paths
# build a list of include paths #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \ -I$(CURDIR)/$(BUILD) \
-I$(CURDIR)/$(BUILD) \ -I$(LIBOGC_INC)
-I$(LIBOGC_INC)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # build a list of library paths
# build a list of library paths #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ -L$(LIBOGC_LIB)
-L$(LIBOGC_LIB)
export OUTPUT := $(CURDIR)/$(TARGET)
export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- $(BUILD):
$(BUILD): @[ -d $@ ] || mkdir -p $@
@[ -d $@ ] || mkdir -p $@ @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- clean:
clean: @echo clean ...
@echo clean ... @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- run:
run: psoload $(TARGET).dol
psoload $(TARGET).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- reload:
reload: psoload -r $(TARGET).dol
psoload -r $(TARGET).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- else
else
DEPENDS := $(OFILES:.o=.d)
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # main targets
# main targets #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- $(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES)
$(OUTPUT).elf: $(OFILES)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # This rule links in binary data with the .jpg extension
# This rule links in binary data with the .jpg extension #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- %.jpg.o : %.jpg
%.jpg.o : %.jpg #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- @echo $(notdir $<)
@echo $(notdir $<) $(bin2o)
$(bin2o)
-include $(DEPENDS)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- endif
endif #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------

View file

@ -3,8 +3,7 @@
Bugged since Screen2texture conversion Bugged since Screen2texture conversion
loose color precision. loose color precision.
============================================*/ ============================================*/
#include "../../../GRRLIB/GRRLIB/GRRLIB.h" #include <grrlib.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>

View file

@ -1,140 +1,139 @@
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# Clear the implicit built in rules # Clear the implicit built in rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
.SUFFIXES: .SUFFIXES:
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),) ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC)
endif endif
include $(DEVKITPPC)/wii_rules include $(DEVKITPPC)/wii_rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# TARGET is the name of the output # TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed # BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code # SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files # INCLUDES is a list of directories containing extra header files
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
GRRLIB := ../../GRRLIB TARGET := $(notdir $(CURDIR))
TARGET := $(notdir $(CURDIR)) BUILD := build
BUILD := build SOURCES := source source/gfx
SOURCES := source source/gfx $(GRRLIB)/GRRLIB $(GRRLIB)/lib/libpng/pngu DATA := data
DATA := data INCLUDES :=
INCLUDES :=
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # options for code generation
# options for code generation #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE)
CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE) CXXFLAGS = $(CFLAGS)
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project
# any extra libraries we wish to link with the project #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- LIBS := -lgrrlib -lpngu -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
LIBS := -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing
# list of directories containing libraries, this must be the top level containing # include and lib
# include and lib #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- LIBDIRS := $(CURDIR)/$(GRRLIB)
LIBDIRS := $(CURDIR)/$(GRRLIB)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional
# no real need to edit anything past this point unless you need to add additional # rules for different file extensions
# rules for different file extensions #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- ifneq ($(BUILD),$(notdir $(CURDIR)))
ifneq ($(BUILD),$(notdir $(CURDIR))) #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ $(foreach dir,$(DATA),$(CURDIR)/$(dir))
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
export DEPSDIR := $(CURDIR)/$(BUILD)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # automatically build a list of object files for our project
# automatically build a list of object files for our project #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C
# use CXX for linking C++ projects, CC for standard C #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- ifeq ($(strip $(CPPFILES)),)
ifeq ($(strip $(CPPFILES)),) export LD := $(CC)
export LD := $(CC) else
else export LD := $(CXX)
export LD := $(CXX) endif
endif
export OFILES := $(addsuffix .o,$(BINFILES)) \
export OFILES := $(addsuffix .o,$(BINFILES)) \ $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ $(sFILES:.s=.o) $(SFILES:.S=.o)
$(sFILES:.s=.o) $(SFILES:.S=.o)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # build a list of include paths
# build a list of include paths #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \ -I$(CURDIR)/$(BUILD) \
-I$(CURDIR)/$(BUILD) \ -I$(LIBOGC_INC)
-I$(LIBOGC_INC)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # build a list of library paths
# build a list of library paths #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ -L$(LIBOGC_LIB)
-L$(LIBOGC_LIB)
export OUTPUT := $(CURDIR)/$(TARGET)
export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- $(BUILD):
$(BUILD): @[ -d $@ ] || mkdir -p $@
@[ -d $@ ] || mkdir -p $@ @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- clean:
clean: @echo clean ...
@echo clean ... @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- run:
run: psoload $(TARGET).dol
psoload $(TARGET).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- reload:
reload: psoload -r $(TARGET).dol
psoload -r $(TARGET).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- else
else
DEPENDS := $(OFILES:.o=.d)
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # main targets
# main targets #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- $(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES)
$(OUTPUT).elf: $(OFILES)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # This rule links in binary data with the .jpg extension
# This rule links in binary data with the .jpg extension #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- %.jpg.o : %.jpg
%.jpg.o : %.jpg #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- @echo $(notdir $<)
@echo $(notdir $<) $(bin2o)
$(bin2o)
-include $(DEPENDS)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- endif
endif #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------

View file

@ -4,14 +4,11 @@
Minimum Code To Use GRRLIB Minimum Code To Use GRRLIB
============================================*/ ============================================*/
#include "../../../GRRLIB/GRRLIB/GRRLIB.h" #include <grrlib.h>
#include <stdlib.h> #include <stdlib.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
int main() { int main() {
u32 WPADDown; u32 WPADDown;

View file

@ -1,140 +1,139 @@
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# Clear the implicit built in rules # Clear the implicit built in rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
.SUFFIXES: .SUFFIXES:
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),) ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC)
endif endif
include $(DEVKITPPC)/wii_rules include $(DEVKITPPC)/wii_rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# TARGET is the name of the output # TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed # BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code # SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files # INCLUDES is a list of directories containing extra header files
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
GRRLIB := ../../GRRLIB TARGET := $(notdir $(CURDIR))
TARGET := $(notdir $(CURDIR)) BUILD := build
BUILD := build SOURCES := source source/gfx
SOURCES := source source/gfx $(GRRLIB)/GRRLIB $(GRRLIB)/lib/libpng/pngu DATA := data
DATA := data INCLUDES :=
INCLUDES :=
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # options for code generation
# options for code generation #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE)
CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE) CXXFLAGS = $(CFLAGS)
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project
# any extra libraries we wish to link with the project #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- LIBS := -lgrrlib -lpngu -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
LIBS := -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing
# list of directories containing libraries, this must be the top level containing # include and lib
# include and lib #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- LIBDIRS := $(CURDIR)/$(GRRLIB)
LIBDIRS := $(CURDIR)/$(GRRLIB)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional
# no real need to edit anything past this point unless you need to add additional # rules for different file extensions
# rules for different file extensions #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- ifneq ($(BUILD),$(notdir $(CURDIR)))
ifneq ($(BUILD),$(notdir $(CURDIR))) #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ $(foreach dir,$(DATA),$(CURDIR)/$(dir))
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
export DEPSDIR := $(CURDIR)/$(BUILD)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # automatically build a list of object files for our project
# automatically build a list of object files for our project #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C
# use CXX for linking C++ projects, CC for standard C #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- ifeq ($(strip $(CPPFILES)),)
ifeq ($(strip $(CPPFILES)),) export LD := $(CC)
export LD := $(CC) else
else export LD := $(CXX)
export LD := $(CXX) endif
endif
export OFILES := $(addsuffix .o,$(BINFILES)) \
export OFILES := $(addsuffix .o,$(BINFILES)) \ $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ $(sFILES:.s=.o) $(SFILES:.S=.o)
$(sFILES:.s=.o) $(SFILES:.S=.o)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # build a list of include paths
# build a list of include paths #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \ -I$(CURDIR)/$(BUILD) \
-I$(CURDIR)/$(BUILD) \ -I$(LIBOGC_INC)
-I$(LIBOGC_INC)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # build a list of library paths
# build a list of library paths #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ -L$(LIBOGC_LIB)
-L$(LIBOGC_LIB)
export OUTPUT := $(CURDIR)/$(TARGET)
export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- $(BUILD):
$(BUILD): @[ -d $@ ] || mkdir -p $@
@[ -d $@ ] || mkdir -p $@ @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- clean:
clean: @echo clean ...
@echo clean ... @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- run:
run: psoload $(TARGET).dol
psoload $(TARGET).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- reload:
reload: psoload -r $(TARGET).dol
psoload -r $(TARGET).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- else
else
DEPENDS := $(OFILES:.o=.d)
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # main targets
# main targets #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- $(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES)
$(OUTPUT).elf: $(OFILES)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # This rule links in binary data with the .jpg extension
# This rule links in binary data with the .jpg extension #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- %.jpg.o : %.jpg
%.jpg.o : %.jpg #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- @echo $(notdir $<)
@echo $(notdir $<) $(bin2o)
$(bin2o)
-include $(DEPENDS)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- endif
endif #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------

View file

@ -1,11 +1,11 @@
/*=========================================== /*===========================================
GRRLIB (GX Version) GRRLIB (GX Version)
Example code by Xane Example code by Xane
This example shows the different This example shows the different
new blending modes. new blending modes.
============================================*/ ============================================*/
#include "../../../GRRLIB/GRRLIB/GRRLIB.h" #include <grrlib.h>
#include <stdlib.h> #include <stdlib.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>

View file

@ -1,140 +1,139 @@
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# Clear the implicit built in rules # Clear the implicit built in rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
.SUFFIXES: .SUFFIXES:
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),) ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC)
endif endif
include $(DEVKITPPC)/wii_rules include $(DEVKITPPC)/wii_rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# TARGET is the name of the output # TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed # BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code # SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files # INCLUDES is a list of directories containing extra header files
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
GRRLIB := ../../GRRLIB TARGET := $(notdir $(CURDIR))
TARGET := $(notdir $(CURDIR)) BUILD := build
BUILD := build SOURCES := source source/gfx
SOURCES := source source/gfx $(GRRLIB)/GRRLIB $(GRRLIB)/lib/libpng/pngu DATA := data
DATA := data INCLUDES :=
INCLUDES :=
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # options for code generation
# options for code generation #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE)
CFLAGS = -g -O2 -mrvl -Wall $(MACHDEP) $(INCLUDE) CXXFLAGS = $(CFLAGS)
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project
# any extra libraries we wish to link with the project #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- LIBS := -lgrrlib -lpngu -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
LIBS := -lpng -ljpeg -lz -lfat -lwiiuse -lbte -logc -lm
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing
# list of directories containing libraries, this must be the top level containing # include and lib
# include and lib #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- LIBDIRS := $(CURDIR)/$(GRRLIB)
LIBDIRS := $(CURDIR)/$(GRRLIB)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # no real need to edit anything past this point unless you need to add additional
# no real need to edit anything past this point unless you need to add additional # rules for different file extensions
# rules for different file extensions #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- ifneq ($(BUILD),$(notdir $(CURDIR)))
ifneq ($(BUILD),$(notdir $(CURDIR))) #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export OUTPUT := $(CURDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ $(foreach dir,$(DATA),$(CURDIR)/$(dir))
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
export DEPSDIR := $(CURDIR)/$(BUILD)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # automatically build a list of object files for our project
# automatically build a list of object files for our project #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # use CXX for linking C++ projects, CC for standard C
# use CXX for linking C++ projects, CC for standard C #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- ifeq ($(strip $(CPPFILES)),)
ifeq ($(strip $(CPPFILES)),) export LD := $(CC)
export LD := $(CC) else
else export LD := $(CXX)
export LD := $(CXX) endif
endif
export OFILES := $(addsuffix .o,$(BINFILES)) \
export OFILES := $(addsuffix .o,$(BINFILES)) \ $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ $(sFILES:.s=.o) $(SFILES:.S=.o)
$(sFILES:.s=.o) $(SFILES:.S=.o)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # build a list of include paths
# build a list of include paths #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \ -I$(CURDIR)/$(BUILD) \
-I$(CURDIR)/$(BUILD) \ -I$(LIBOGC_INC)
-I$(LIBOGC_INC)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # build a list of library paths
# build a list of library paths #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ -L$(LIBOGC_LIB)
-L$(LIBOGC_LIB)
export OUTPUT := $(CURDIR)/$(TARGET)
export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- $(BUILD):
$(BUILD): @[ -d $@ ] || mkdir -p $@
@[ -d $@ ] || mkdir -p $@ @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- clean:
clean: @echo clean ...
@echo clean ... @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- run:
run: psoload $(TARGET).dol
psoload $(TARGET).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- reload:
reload: psoload -r $(TARGET).dol
psoload -r $(TARGET).dol
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- else
else
DEPENDS := $(OFILES:.o=.d)
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # main targets
# main targets #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- $(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES)
$(OUTPUT).elf: $(OFILES)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- # This rule links in binary data with the .jpg extension
# This rule links in binary data with the .jpg extension #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- %.jpg.o : %.jpg
%.jpg.o : %.jpg #---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- @echo $(notdir $<)
@echo $(notdir $<) $(bin2o)
$(bin2o)
-include $(DEPENDS)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
#--------------------------------------------------------------------------------- endif
endif #---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------

View file

@ -5,7 +5,7 @@
This example shows a basic particle This example shows a basic particle
engine creating a Smokebomb. engine creating a Smokebomb.
============================================*/ ============================================*/
#include "../../../GRRLIB/GRRLIB/GRRLIB.h" #include <grrlib.h>
#include <stdlib.h> #include <stdlib.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>