aboutsummaryrefslogtreecommitdiff
path: root/examples/graphics
diff options
context:
space:
mode:
authorJohn "Lameguy" Wilbert Villamor <lameguy64@gmail.com>2021-08-31 13:23:20 +0800
committerGitHub <noreply@github.com>2021-08-31 13:23:20 +0800
commitffa679d4d24b891cb59aba10946368f2ec00c391 (patch)
tree0cf6061915ebf48acdedf6d77b0c1b76eec5b8c3 /examples/graphics
parent317dc2b91d3afcdbaddb035f38611d12af161970 (diff)
parentf2fc18f82dd7900465d6ab3ae2080726d5589d39 (diff)
downloadpsn00bsdk-ffa679d4d24b891cb59aba10946368f2ec00c391.tar.gz
Merge pull request #36 from spicyjpeg/dynlink
Dynamic linker, gp-relative addressing, ldscripts and more
Diffstat (limited to 'examples/graphics')
-rw-r--r--examples/graphics/balls/makefile81
-rw-r--r--examples/graphics/billboard/makefile76
-rw-r--r--examples/graphics/fpscam/makefile76
-rw-r--r--examples/graphics/gte/makefile76
-rw-r--r--examples/graphics/hdtv/makefile77
-rw-r--r--examples/graphics/render2tex/makefile76
-rw-r--r--examples/graphics/rgb24/makefile76
7 files changed, 363 insertions, 175 deletions
diff --git a/examples/graphics/balls/makefile b/examples/graphics/balls/makefile
index 70f41bf..44d3d71 100644
--- a/examples/graphics/balls/makefile
+++ b/examples/graphics/balls/makefile
@@ -1,54 +1,65 @@
-include ../../examples-setup.mk
+# PSn00bSDK makefile template
+# Part of the PSn00bSDK Project
+# 2019 - 2021 Lameguy64 / Meido-Tek Productions
+
+## Settings
+
+PSN00BSDK_LIBS ?= ../../../libpsn00b
+
+# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's
+# root folder (it only depends on environment variables).
+include ../../../psn00bsdk-setup.mk
# Project target name
-TARGET = balls.elf
+TARGET = balls
+
+## Files
# Searches for C, C++ and S (assembler) files in local directory
-CFILES = $(notdir $(wildcard *.c))
-CPPFILES = $(notdir $(wildcard *.cpp))
-AFILES = $(notdir $(wildcard *.s))
+CFILES = $(notdir $(wildcard *.c))
+CPPFILES= $(notdir $(wildcard *.cpp))
+AFILES = $(notdir $(wildcard *.s))
-# Determine object files
-OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
- $(addprefix build/,$(CPPFILES:.cpp=.o)) \
- $(addprefix build/,$(AFILES:.s=.o))
+# Create names for object files
+OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
+ $(addprefix build/,$(CPPFILES:.cpp=.o)) \
+ $(addprefix build/,$(AFILES:.s=.o))
-# Project specific include and library directories
-# (use -I for include dirs, -L for library dirs)
-INCLUDE +=
-LIBDIRS +=
+# Project specific includes and libraries
+# (use -I for include dirs, -L for library dirs, -l for static libraries)
+INCLUDE +=
+LIBDIRS +=
+LIBS +=
-# Libraries to link
-LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
+## Build rules
-# C compiler flags
-CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
+#all: iso
+all: build/$(TARGET)
-# C++ compiler flags
-CPPFLAGS = $(CFLAGS) -fno-exceptions
+iso: build/$(TARGET) resources
+ $(MKPSXISO) -y -q iso.xml
-# Assembler flags
-AFLAGS = -g -msoft-float
+resources:
+ # Add commands to build/convert your assets here
+ #$(LZPACK) data.xml
-# Linker flags
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
- -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
+build/$(TARGET): $(OFILES)
+ @mkdir -p $(dir $@)
+ $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
+ $(NM) -f posix -l -n $@ >$@.map
+ $(ELF2X) -q $@ $@.exe
-all: $(OFILES)
- $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
- elf2x -q $(TARGET)
-
build/%.o: %.c
@mkdir -p $(dir $@)
- $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
-
+ $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
build/%.o: %.cpp
@mkdir -p $(dir $@)
- $(CXX) $(AFLAGS) $(INCLUDE) -c $< -o $@
-
+ $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
build/%.o: %.s
@mkdir -p $(dir $@)
- $(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@
-
+ $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
clean:
- rm -rf build $(TARGET) $(TARGET:.elf=.exe)
+ rm -rf build
diff --git a/examples/graphics/billboard/makefile b/examples/graphics/billboard/makefile
index 4f0fcf4..462e73c 100644
--- a/examples/graphics/billboard/makefile
+++ b/examples/graphics/billboard/makefile
@@ -1,35 +1,65 @@
-include ../../examples-setup.mk
+# PSn00bSDK makefile template
+# Part of the PSn00bSDK Project
+# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-TARGET = billboard.elf
+## Settings
-CFILES = $(notdir $(wildcard *.c))
-CPPFILES = $(notdir $(wildcard *.cpp))
-AFILES = $(notdir $(wildcard *.s))
+PSN00BSDK_LIBS ?= ../../../libpsn00b
-OFILES = $(addprefix build/,$(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(AFILES:.s=.o))
+# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's
+# root folder (it only depends on environment variables).
+include ../../../psn00bsdk-setup.mk
-INCLUDE +=
-LIBDIRS +=
+# Project target name
+TARGET = billboard
-LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
+## Files
-CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
-CPPFLAGS = $(CFLAGS) -fno-exceptions
-AFLAGS = -g -msoft-float
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
- -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
+# Searches for C, C++ and S (assembler) files in local directory
+CFILES = $(notdir $(wildcard *.c))
+CPPFILES= $(notdir $(wildcard *.cpp))
+AFILES = $(notdir $(wildcard *.s))
+
+# Create names for object files
+OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
+ $(addprefix build/,$(CPPFILES:.cpp=.o)) \
+ $(addprefix build/,$(AFILES:.s=.o))
+
+# Project specific includes and libraries
+# (use -I for include dirs, -L for library dirs, -l for static libraries)
+INCLUDE +=
+LIBDIRS +=
+LIBS +=
+
+## Build rules
+
+#all: iso
+all: build/$(TARGET)
+
+iso: build/$(TARGET) resources
+ $(MKPSXISO) -y -q iso.xml
+
+resources:
+ # Add commands to build/convert your assets here
+ #$(LZPACK) data.xml
+
+build/$(TARGET): $(OFILES)
+ @mkdir -p $(dir $@)
+ $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
+ $(NM) -f posix -l -n $@ >$@.map
+ $(ELF2X) -q $@ $@.exe
-all: $(OFILES)
- $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
- elf2x -q $(TARGET)
-
build/%.o: %.c
@mkdir -p $(dir $@)
- $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
-
+ $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
+build/%.o: %.cpp
+ @mkdir -p $(dir $@)
+ $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
build/%.o: %.s
@mkdir -p $(dir $@)
- $(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@
-
+ $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
clean:
- rm -rf build $(TARGET) $(TARGET:.elf=.exe)
+ rm -rf build
diff --git a/examples/graphics/fpscam/makefile b/examples/graphics/fpscam/makefile
index dac1d43..2ddb7fd 100644
--- a/examples/graphics/fpscam/makefile
+++ b/examples/graphics/fpscam/makefile
@@ -1,35 +1,65 @@
-include ../../examples-setup.mk
+# PSn00bSDK makefile template
+# Part of the PSn00bSDK Project
+# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-TARGET = fpscam.elf
+## Settings
-CFILES = $(notdir $(wildcard *.c))
-CPPFILES = $(notdir $(wildcard *.cpp))
-AFILES = $(notdir $(wildcard *.s))
+PSN00BSDK_LIBS ?= ../../../libpsn00b
-OFILES = $(addprefix build/,$(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(AFILES:.s=.o))
+# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's
+# root folder (it only depends on environment variables).
+include ../../../psn00bsdk-setup.mk
-INCLUDE +=
-LIBDIRS +=
+# Project target name
+TARGET = fpscam
-LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
+## Files
-CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
-CPPFLAGS = $(CFLAGS) -fno-exceptions
-AFLAGS = -g -msoft-float
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
- -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
+# Searches for C, C++ and S (assembler) files in local directory
+CFILES = $(notdir $(wildcard *.c))
+CPPFILES= $(notdir $(wildcard *.cpp))
+AFILES = $(notdir $(wildcard *.s))
+
+# Create names for object files
+OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
+ $(addprefix build/,$(CPPFILES:.cpp=.o)) \
+ $(addprefix build/,$(AFILES:.s=.o))
+
+# Project specific includes and libraries
+# (use -I for include dirs, -L for library dirs, -l for static libraries)
+INCLUDE +=
+LIBDIRS +=
+LIBS +=
+
+## Build rules
+
+#all: iso
+all: build/$(TARGET)
+
+iso: build/$(TARGET) resources
+ $(MKPSXISO) -y -q iso.xml
+
+resources:
+ # Add commands to build/convert your assets here
+ #$(LZPACK) data.xml
+
+build/$(TARGET): $(OFILES)
+ @mkdir -p $(dir $@)
+ $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
+ $(NM) -f posix -l -n $@ >$@.map
+ $(ELF2X) -q $@ $@.exe
-all: $(OFILES)
- $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
- elf2x -q $(TARGET)
-
build/%.o: %.c
@mkdir -p $(dir $@)
- $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
-
+ $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
+build/%.o: %.cpp
+ @mkdir -p $(dir $@)
+ $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
build/%.o: %.s
@mkdir -p $(dir $@)
- $(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@
-
+ $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
clean:
- rm -rf build $(TARGET) $(TARGET:.elf=.exe)
+ rm -rf build
diff --git a/examples/graphics/gte/makefile b/examples/graphics/gte/makefile
index 43b7c5b..f44e72b 100644
--- a/examples/graphics/gte/makefile
+++ b/examples/graphics/gte/makefile
@@ -1,35 +1,65 @@
-include ../../examples-setup.mk
+# PSn00bSDK makefile template
+# Part of the PSn00bSDK Project
+# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-TARGET = gte.elf
+## Settings
-CFILES = $(notdir $(wildcard *.c))
-CPPFILES = $(notdir $(wildcard *.cpp))
-AFILES = $(notdir $(wildcard *.s))
+PSN00BSDK_LIBS ?= ../../../libpsn00b
-OFILES = $(addprefix build/,$(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(AFILES:.s=.o))
+# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's
+# root folder (it only depends on environment variables).
+include ../../../psn00bsdk-setup.mk
-INCLUDE +=
-LIBDIRS +=
+# Project target name
+TARGET = gte
-LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
+## Files
-CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
-CPPFLAGS = $(CFLAGS) -fno-exceptions
-AFLAGS = -g -msoft-float
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
- -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
+# Searches for C, C++ and S (assembler) files in local directory
+CFILES = $(notdir $(wildcard *.c))
+CPPFILES= $(notdir $(wildcard *.cpp))
+AFILES = $(notdir $(wildcard *.s))
+
+# Create names for object files
+OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
+ $(addprefix build/,$(CPPFILES:.cpp=.o)) \
+ $(addprefix build/,$(AFILES:.s=.o))
+
+# Project specific includes and libraries
+# (use -I for include dirs, -L for library dirs, -l for static libraries)
+INCLUDE +=
+LIBDIRS +=
+LIBS +=
+
+## Build rules
+
+#all: iso
+all: build/$(TARGET)
+
+iso: build/$(TARGET) resources
+ $(MKPSXISO) -y -q iso.xml
+
+resources:
+ # Add commands to build/convert your assets here
+ #$(LZPACK) data.xml
+
+build/$(TARGET): $(OFILES)
+ @mkdir -p $(dir $@)
+ $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
+ $(NM) -f posix -l -n $@ >$@.map
+ $(ELF2X) -q $@ $@.exe
-all: $(OFILES)
- $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
- elf2x -q $(TARGET)
-
build/%.o: %.c
@mkdir -p $(dir $@)
- $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
-
+ $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
+build/%.o: %.cpp
+ @mkdir -p $(dir $@)
+ $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
build/%.o: %.s
@mkdir -p $(dir $@)
- $(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@
-
+ $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
clean:
- rm -rf build $(TARGET) $(TARGET:.elf=.exe)
+ rm -rf build
diff --git a/examples/graphics/hdtv/makefile b/examples/graphics/hdtv/makefile
index 2c7cb71..6659c98 100644
--- a/examples/graphics/hdtv/makefile
+++ b/examples/graphics/hdtv/makefile
@@ -1,36 +1,65 @@
-include ../../examples-setup.mk
+# PSn00bSDK makefile template
+# Part of the PSn00bSDK Project
+# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-TARGET = hdtv.elf
+## Settings
-CFILES = $(notdir $(wildcard *.c))
-CPPFILES = $(notdir $(wildcard *.cpp))
-AFILES = $(notdir $(wildcard *.s))
+PSN00BSDK_LIBS ?= ../../../libpsn00b
-OFILES = $(addprefix build/,$(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(AFILES:.s=.o))
+# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's
+# root folder (it only depends on environment variables).
+include ../../../psn00bsdk-setup.mk
-INCLUDE +=
-LIBDIRS +=
+# Project target name
+TARGET = hdtv
-LIBS = -lpsxetc -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
-LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
+## Files
-CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
-CPPFLAGS = $(CFLAGS) -fno-exceptions
-AFLAGS = -g -msoft-float
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
- -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
+# Searches for C, C++ and S (assembler) files in local directory
+CFILES = $(notdir $(wildcard *.c))
+CPPFILES= $(notdir $(wildcard *.cpp))
+AFILES = $(notdir $(wildcard *.s))
+
+# Create names for object files
+OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
+ $(addprefix build/,$(CPPFILES:.cpp=.o)) \
+ $(addprefix build/,$(AFILES:.s=.o))
+
+# Project specific includes and libraries
+# (use -I for include dirs, -L for library dirs, -l for static libraries)
+INCLUDE +=
+LIBDIRS +=
+LIBS +=
+
+## Build rules
+
+#all: iso
+all: build/$(TARGET)
+
+iso: build/$(TARGET) resources
+ $(MKPSXISO) -y -q iso.xml
+
+resources:
+ # Add commands to build/convert your assets here
+ #$(LZPACK) data.xml
+
+build/$(TARGET): $(OFILES)
+ @mkdir -p $(dir $@)
+ $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
+ $(NM) -f posix -l -n $@ >$@.map
+ $(ELF2X) -q $@ $@.exe
-all: $(OFILES)
- $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
- elf2x -q $(TARGET)
-
build/%.o: %.c
@mkdir -p $(dir $@)
- $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
-
+ $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
+build/%.o: %.cpp
+ @mkdir -p $(dir $@)
+ $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
build/%.o: %.s
@mkdir -p $(dir $@)
- $(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@
-
+ $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
clean:
- rm -rf build $(TARGET) $(TARGET:.elf=.exe)
+ rm -rf build
diff --git a/examples/graphics/render2tex/makefile b/examples/graphics/render2tex/makefile
index 52d650b..bb0ef3c 100644
--- a/examples/graphics/render2tex/makefile
+++ b/examples/graphics/render2tex/makefile
@@ -1,35 +1,65 @@
-include ../../examples-setup.mk
+# PSn00bSDK makefile template
+# Part of the PSn00bSDK Project
+# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-TARGET = render2tex.elf
+## Settings
-CFILES = $(notdir $(wildcard *.c))
-CPPFILES = $(notdir $(wildcard *.cpp))
-AFILES = $(notdir $(wildcard *.s))
+PSN00BSDK_LIBS ?= ../../../libpsn00b
-OFILES = $(addprefix build/,$(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(AFILES:.s=.o))
+# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's
+# root folder (it only depends on environment variables).
+include ../../../psn00bsdk-setup.mk
-INCLUDE +=
-LIBDIRS +=
+# Project target name
+TARGET = render2tex
-LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
+## Files
-CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
-CPPFLAGS = $(CFLAGS) -fno-exceptions
-AFLAGS = -g -msoft-float
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
- -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
+# Searches for C, C++ and S (assembler) files in local directory
+CFILES = $(notdir $(wildcard *.c))
+CPPFILES= $(notdir $(wildcard *.cpp))
+AFILES = $(notdir $(wildcard *.s))
+
+# Create names for object files
+OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
+ $(addprefix build/,$(CPPFILES:.cpp=.o)) \
+ $(addprefix build/,$(AFILES:.s=.o))
+
+# Project specific includes and libraries
+# (use -I for include dirs, -L for library dirs, -l for static libraries)
+INCLUDE +=
+LIBDIRS +=
+LIBS +=
+
+## Build rules
+
+#all: iso
+all: build/$(TARGET)
+
+iso: build/$(TARGET) resources
+ $(MKPSXISO) -y -q iso.xml
+
+resources:
+ # Add commands to build/convert your assets here
+ #$(LZPACK) data.xml
+
+build/$(TARGET): $(OFILES)
+ @mkdir -p $(dir $@)
+ $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
+ $(NM) -f posix -l -n $@ >$@.map
+ $(ELF2X) -q $@ $@.exe
-all: $(OFILES)
- $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
- elf2x -q $(TARGET)
-
build/%.o: %.c
@mkdir -p $(dir $@)
- $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
-
+ $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
+build/%.o: %.cpp
+ @mkdir -p $(dir $@)
+ $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
build/%.o: %.s
@mkdir -p $(dir $@)
- $(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@
-
+ $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
clean:
- rm -rf build $(TARGET) $(TARGET:.elf=.exe)
+ rm -rf build
diff --git a/examples/graphics/rgb24/makefile b/examples/graphics/rgb24/makefile
index 3ec9cfe..9fa35ec 100644
--- a/examples/graphics/rgb24/makefile
+++ b/examples/graphics/rgb24/makefile
@@ -1,37 +1,65 @@
-include ../../examples-setup.mk
+# PSn00bSDK makefile template
+# Part of the PSn00bSDK Project
+# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-TARGET = rgb24.elf
+## Settings
-CFILES = $(notdir $(wildcard *.c))
-CPPFILES = $(notdir $(wildcard *.cpp))
-AFILES = $(notdir $(wildcard *.s))
+PSN00BSDK_LIBS ?= ../../../libpsn00b
-OFILES = $(addprefix build/,$(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(AFILES:.s=.o))
+# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's
+# root folder (it only depends on environment variables).
+include ../../../psn00bsdk-setup.mk
-INCLUDE +=
-LIBDIRS +=
+# Project target name
+TARGET = rgb24
-LIBS = -lpsxgpu -lpsxetc -lpsxapi -lc
+## Files
-CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
-CPPFLAGS = $(CFLAGS) -fno-exceptions
-AFLAGS = -g -msoft-float
-LDFLAGS = -g -Ttext=0x80010000 -gc-sections \
- -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
+# Searches for C, C++ and S (assembler) files in local directory
+CFILES = $(notdir $(wildcard *.c))
+CPPFILES= $(notdir $(wildcard *.cpp))
+AFILES = $(notdir $(wildcard *.s))
+
+# Create names for object files
+OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
+ $(addprefix build/,$(CPPFILES:.cpp=.o)) \
+ $(addprefix build/,$(AFILES:.s=.o))
+
+# Project specific includes and libraries
+# (use -I for include dirs, -L for library dirs, -l for static libraries)
+INCLUDE +=
+LIBDIRS +=
+LIBS +=
+
+## Build rules
+
+#all: iso
+all: build/$(TARGET)
+
+iso: build/$(TARGET) resources
+ $(MKPSXISO) -y -q iso.xml
+
+resources:
+ # Add commands to build/convert your assets here
+ #$(LZPACK) data.xml
+
+build/$(TARGET): $(OFILES)
+ @mkdir -p $(dir $@)
+ $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
+ $(NM) -f posix -l -n $@ >$@.map
+ $(ELF2X) -q $@ $@.exe
-all: $(OFILES)
- $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
- elf2x -q $(TARGET)
-
build/%.o: %.c
@mkdir -p $(dir $@)
- $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
-
+ $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
+build/%.o: %.cpp
+ @mkdir -p $(dir $@)
+ $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
build/%.o: %.s
@mkdir -p $(dir $@)
- $(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.tim
+ $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
clean:
- rm -rf build $(TARGET) $(TARGET:.elf=.exe)
+ rm -rf build