aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-08-17 11:36:56 +0000
committerspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-08-17 11:36:56 +0000
commit89751f29467b359339a8c8b57c218cc3328bae43 (patch)
treef92eeff576fea528e6a5c5a984207aac9e0d2b8c /examples
parent5f5461879c73720359e87fa41cbfe8c452f5155e (diff)
downloadpsn00bsdk-89751f29467b359339a8c8b57c218cc3328bae43.tar.gz
Rewritten all Makefiles, set up proper GCC options, added iso.xml to template
Diffstat (limited to 'examples')
-rw-r--r--examples/beginner/cppdemo/makefile81
-rw-r--r--examples/beginner/hello/makefile81
-rw-r--r--examples/cdrom/cdbrowse/iso.xml33
-rw-r--r--examples/cdrom/cdbrowse/makefile80
-rw-r--r--examples/cdrom/cdxa/iso.xml29
-rw-r--r--examples/cdrom/cdxa/makefile80
-rw-r--r--examples/demos/n00bdemo/data.s2
-rw-r--r--examples/demos/n00bdemo/data.xml6
-rw-r--r--examples/demos/n00bdemo/makefile82
-rw-r--r--examples/examples-setup.mk64
-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
-rw-r--r--examples/makefile4
-rw-r--r--examples/system/childexec/child/child.c (renamed from examples/system/childexec/child.c)0
-rw-r--r--examples/system/childexec/child_exe.s2
-rw-r--r--examples/system/childexec/makefile105
-rw-r--r--examples/system/console/makefile81
-rw-r--r--examples/system/timer/makefile76
-rw-r--r--examples/system/tty/makefile81
24 files changed, 874 insertions, 551 deletions
diff --git a/examples/beginner/cppdemo/makefile b/examples/beginner/cppdemo/makefile
index 3e122ab..630a280 100644
--- a/examples/beginner/cppdemo/makefile
+++ b/examples/beginner/cppdemo/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 = cppdemo.elf
+TARGET = cppdemo
+
+## 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-builtin -fno-rtti -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) $(CPPFLAGS) $(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/beginner/hello/makefile b/examples/beginner/hello/makefile
index 3fce1ae..e4bed20 100644
--- a/examples/beginner/hello/makefile
+++ b/examples/beginner/hello/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 = hello.elf
+TARGET = hello
+
+## 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/cdrom/cdbrowse/iso.xml b/examples/cdrom/cdbrowse/iso.xml
index a828df1..5d8963d 100644
--- a/examples/cdrom/cdbrowse/iso.xml
+++ b/examples/cdrom/cdbrowse/iso.xml
@@ -1,33 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<iso_project image_name="cdbrowse.iso">
-
+<?xml version="1.0" encoding="utf-8"?>
+<iso_project
+ image_name="build/cdbrowse.bin"
+ cue_sheet="build/cdbrowse.cue"
+>
<track type="data">
-
<identifiers
system ="PLAYSTATION"
- application ="PLAYSTATION"
- volume ="PSN00BSDK"
- volume_set ="PSN00BSDK"
+ volume ="CDBROWSE"
+ volume_set ="CDBROWSE"
publisher ="MEIDOTEK"
+ data_preparer ="PSN00BSDK BUILD SCRIPT"
+ application ="PLAYSTATION"
+ copyright ="README.TXT;1"
/>
<directory_tree>
+ <file name="SYSTEM.CNF" type="data" source="system.cnf" />
+ <file name="CDBROWSE.EXE" type="data" source="build/cdbrowse.exe" />
+ <file name="CDBROWSE.MAP" type="data" source="build/cdbrowse.map" />
- <file name="system.cnf" type="data" source="system.cnf"/>
- <file name="cdbrowse.exe" type="data" source="cdbrowse.exe"/>
-
- <dir name="dira">
- <dir name="diraa">
+ <dir name="DIRA">
+ <dir name="DIRAA">
</dir>
</dir>
- <dir name="dirb">
+ <dir name="DIRB">
</dir>
<dummy sectors="1024"/>
-
</directory_tree>
-
</track>
+ <!--<track type="audio" source="track2.wav" />-->
</iso_project>
diff --git a/examples/cdrom/cdbrowse/makefile b/examples/cdrom/cdbrowse/makefile
index ee925d2..954408b 100644
--- a/examples/cdrom/cdbrowse/makefile
+++ b/examples/cdrom/cdbrowse/makefile
@@ -1,45 +1,65 @@
-include ../../examples-setup.mk
+# PSn00bSDK makefile template
+# Part of the PSn00bSDK Project
+# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-TARGET = cdbrowse.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
-LIBS = -lpsxcd -lpsxgpu -lpsxgte -lpsxspu -lpsxsio -lpsxetc -lpsxapi -lc
+# Project target name
+TARGET = cdbrowse
-CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
-CPPFLAGS = $(CFLAGS) \
- -fno-exceptions \
- -fno-rtti \
- -fno-unwind-tables \
- -fno-threadsafe-statics \
- -fno-use-cxa-atexit
+## Files
-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)
-
-iso:
- mkpsxiso -y -q iso.xml
-
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) $(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/cdrom/cdxa/iso.xml b/examples/cdrom/cdxa/iso.xml
index 840b414..9a6a206 100644
--- a/examples/cdrom/cdxa/iso.xml
+++ b/examples/cdrom/cdxa/iso.xml
@@ -1,29 +1,30 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<iso_project image_name="cdxa.iso">
-
+<?xml version="1.0" encoding="utf-8"?>
+<iso_project
+ image_name="build/cdxa.bin"
+ cue_sheet="build/cdxa.cue"
+>
<track type="data">
-
<identifiers
system ="PLAYSTATION"
- application ="PLAYSTATION"
- volume ="PSN00BSDK"
- volume_set ="PSN00BSDK"
+ volume ="CDXA"
+ volume_set ="CDXA"
publisher ="MEIDOTEK"
+ data_preparer ="PSN00BSDK BUILD SCRIPT"
+ application ="PLAYSTATION"
+ copyright ="README.TXT;1"
/>
<directory_tree>
+ <file name="SYSTEM.CNF" type="data" source="system.cnf" />
+ <file name="CDXA.EXE" type="data" source="build/cdxa.exe" />
+ <file name="CDXA.MAP" type="data" source="build/cdxa.map" />
- <file name="system.cnf" type="data" source="system.cnf"/>
- <file name="cdxa.exe" type="data" source="cdxa.exe"/>
-
<!-- CD-XA file, you'll have to provide your own to make this example work -->
- <file name="xasample.xa" type="xa" source="D:\str-temp\subcon.xa"/>
+ <file name="XASAMPLE.XA" type="mixed" source="xasample.xa"/>
<dummy sectors="1024"/>
-
</directory_tree>
-
</track>
+ <!--<track type="audio" source="track2.wav" />-->
</iso_project>
diff --git a/examples/cdrom/cdxa/makefile b/examples/cdrom/cdxa/makefile
index b95efa7..b1627f7 100644
--- a/examples/cdrom/cdxa/makefile
+++ b/examples/cdrom/cdxa/makefile
@@ -1,45 +1,65 @@
-include ../../examples-setup.mk
+# PSn00bSDK makefile template
+# Part of the PSn00bSDK Project
+# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-TARGET = cdxa.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
-LIBS = -lpsxcd -lpsxgpu -lpsxgte -lpsxspu -lpsxsio -lpsxetc -lpsxapi -lc
+# Project target name
+TARGET = cdxa
-CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
-CPPFLAGS = $(CFLAGS) \
- -fno-exceptions \
- -fno-rtti \
- -fno-unwind-tables \
- -fno-threadsafe-statics \
- -fno-use-cxa-atexit
+## Files
-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)
-
-iso:
- mkpsxiso -y -q iso.xml
-
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) $(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/demos/n00bdemo/data.s b/examples/demos/n00bdemo/data.s
index 3ca33cb..f3b2a83 100644
--- a/examples/demos/n00bdemo/data.s
+++ b/examples/demos/n00bdemo/data.s
@@ -3,7 +3,7 @@
.global lz_resources
.type lz_resources, @object
lz_resources:
- .incbin "data.lzp"
+ .incbin "build/data.lzp"
#.global smd_mtekdisk
#.type smd_mtekdisk, @object
diff --git a/examples/demos/n00bdemo/data.xml b/examples/demos/n00bdemo/data.xml
index 292a325..6761f16 100644
--- a/examples/demos/n00bdemo/data.xml
+++ b/examples/demos/n00bdemo/data.xml
@@ -1,6 +1,6 @@
<lzp_project>
- <create packname="textures.qlp" format="qlp">
+ <create packname="build/textures.qlp" format="qlp">
<file alias="petscum">data/petscum16c.tim</file>
<file alias="bungirl">data/bungirl.tim</file>
@@ -19,7 +19,7 @@
</create>
- <create packname="data.lzp" format="lzp">
+ <create packname="build/data.lzp" format="lzp">
<!-- intro assets -->
<file alias="mtekdisk">data/mtekdisk.smd</file>
@@ -42,7 +42,7 @@
<file alias="hatkid">data/hatkid.smd</file>
<!-- Global textures -->
- <file alias="textures">textures.qlp</file>
+ <file alias="textures">build/textures.qlp</file>
</create>
diff --git a/examples/demos/n00bdemo/makefile b/examples/demos/n00bdemo/makefile
index 7e3bd8e..9206e09 100644
--- a/examples/demos/n00bdemo/makefile
+++ b/examples/demos/n00bdemo/makefile
@@ -1,39 +1,65 @@
-include ../../examples-setup.mk
+# PSn00bSDK makefile template
+# Part of the PSn00bSDK Project
+# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-TARGET = demo.elf
+## Settings
-CFILES = $(notdir $(wildcard *.c))
-AFILES = $(notdir $(wildcard *.s))
+PSN00BSDK_LIBS ?= ../../../libpsn00b
-OFILES = $(addprefix build/,$(CFILES:.c=.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 += -I../../../libpsn00b/lzp
+# Project target name
+TARGET = demo
-LIBS = -llzp -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 += -llzp
+
+## Build rules
+
+#all: iso
+all: build/$(TARGET)
+
+iso: build/$(TARGET)
+ $(MKPSXISO) -y -q iso.xml
+
+resources:
+ $(LZPACK) data.xml
+ touch data.s
+
+build/$(TARGET): $(OFILES)
+ @mkdir -p $(dir $@)
+ $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
+ $(NM) -f posix -l -n $@ >$@.map
+ $(ELF2X) -q $@ $@.exe
-all: resources $(OFILES)
- $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
- elf2x -q $(TARGET)
-
build/%.o: %.c
@mkdir -p $(dir $@)
- $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.s
+ $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
+build/%.o: %.cpp
@mkdir -p $(dir $@)
- $(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@
-
-resources:
- lzpack data.xml
- touch data.s
-
-iso:
- mkpsxiso -y -q -o demo.iso iso.xml
-
+ $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
+build/%.o: %.s resources
+ @mkdir -p $(dir $@)
+ $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
clean:
- rm -rf build *.lzp *.qlp $(TARGET) $(TARGET:.elf=.exe) $(TARGET:.elf=.iso)
+ rm -rf build
diff --git a/examples/examples-setup.mk b/examples/examples-setup.mk
deleted file mode 100644
index 1fadd84..0000000
--- a/examples/examples-setup.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-# PSn00bSDK examples setup file
-# Part of the PSn00bSDK Project
-# 2019 - 2020 Lameguy64 / Meido-Tek Productions
-#
-# This is only for the PSn00bSDK example programs, not recommended
-# for use with user projects
-
-PREFIX = mipsel-unknown-elf
-
-ifndef GCC_VERSION
-
-GCC_VERSION = 7.4.0
-
-endif # GCC_VERSION
-
-# PSn00bSDK library/include path setup
-ifndef PSN00BSDK_LIBS
-
-# Default assumes libpsn00b is just in the parent dir of the examples dir
-
-LIBDIRS = -L../../../libpsn00b
-INCLUDE = -I../../../libpsn00b/include
-
-else
-
-LIBDIRS = -L$(PSN00BSDK_LIBS)
-INCLUDE = -I$(PSN00BSDK_LIBS)/include
-
-endif # PSN00BSDK_LIBS
-
-# PSn00bSDK toolchain path setup
-ifndef GCC_BASE
-
-ifndef PSN00BSDK_TC
-
-# Default assumes GCC toolchain is in root of C drive or /usr/local
-
-ifeq "$(OS)" "Windows_NT"
-
-GCC_BASE = /c/mipsel-unknown-elf
-GCC_BIN =
-
-else
-
-GCC_BASE = /usr/local/mipsel-unknown-elf
-GCC_BIN =
-
-endif
-
-else
-
-GCC_BASE = $(PSN00BSDK_TC)
-GCC_BIN = $(PSN00BSDK_TC)/bin/
-
-endif # PSN00BSDK_TC
-
-endif # GCC_BASE
-
-CC = $(GCC_BIN)$(PREFIX)-gcc
-CXX = $(GCC_BIN)$(PREFIX)-g++
-AS = $(GCC_BIN)$(PREFIX)-as
-AR = $(GCC_BIN)$(PREFIX)-ar
-LD = $(GCC_BIN)$(PREFIX)-ld
-RANLIB = $(GCC_BIN)$(PREFIX)-ranlib \ No newline at end of file
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
diff --git a/examples/makefile b/examples/makefile
index e02f7ba..bdc62ce 100644
--- a/examples/makefile
+++ b/examples/makefile
@@ -13,8 +13,8 @@ DIRS += graphics/balls graphics/billboard graphics/fpscam \
graphics/rgb24
# System related examples
-DIRS += system/childexec system/console system/timer \
- system/tty
+DIRS += system/childexec system/console system/dynlink \
+ system/timer system/tty
# Low-level examples
DIRS +=
diff --git a/examples/system/childexec/child.c b/examples/system/childexec/child/child.c
index 2ddfa73..2ddfa73 100644
--- a/examples/system/childexec/child.c
+++ b/examples/system/childexec/child/child.c
diff --git a/examples/system/childexec/child_exe.s b/examples/system/childexec/child_exe.s
index 842ac88..66bd0e2 100644
--- a/examples/system/childexec/child_exe.s
+++ b/examples/system/childexec/child_exe.s
@@ -3,4 +3,4 @@
.global child_exe # Insert spoopypasta
.type child_exe, @object
child_exe:
- .incbin "child.exe" \ No newline at end of file
+ .incbin "build/child/child.exe" \ No newline at end of file
diff --git a/examples/system/childexec/makefile b/examples/system/childexec/makefile
index 30229ae..e801739 100644
--- a/examples/system/childexec/makefile
+++ b/examples/system/childexec/makefile
@@ -1,36 +1,93 @@
-include ../../examples-setup.mk
+# PSn00bSDK makefile template
+# Part of the PSn00bSDK Project
+# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-INCLUDE +=
-LIBDIRS +=
+## Settings
-LIBS = -lpsxgpu -lpsxgte -lpsxspu -lpsxetc -lpsxapi -lc
+PSN00BSDK_LIBS ?= ../../../libpsn00b
-CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
-CPPFLAGS = $(CFLAGS) -fno-exceptions
-AFLAGS = -g -msoft-float
-LDFLAGS = -g -gc-sections \
- -T $(GCC_BASE)/$(PREFIX)/lib/ldscripts/elf32elmip.x
+# 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
-LDFLAGS_P = $(LDFLAGS) -Ttext=0x80010000
-LDFLAGS_C = $(LDFLAGS) -Ttext=0x80030000
+# Project target name
+#TARGET = childexec
-all: child parent
+## Files
-child: build/child.o
- $(LD) $(LDFLAGS_C) $(LIBDIRS) build/child.o $(LIBS) -o child.elf
- elf2x -q child.elf
+# Searches for C, C++ and S (assembler) files in local directory
+CFILES_PARENT = $(notdir $(wildcard *.c))
+CPPFILES_PARENT = $(notdir $(wildcard *.cpp))
+AFILES_PARENT = $(notdir $(wildcard *.s))
+
+CFILES_CHILD = $(notdir $(wildcard child/*.c))
+CPPFILES_CHILD = $(notdir $(wildcard child/*.cpp))
+AFILES_CHILD = $(notdir $(wildcard child/*.s))
+
+# Create names for object files
+OFILES_PARENT = $(addprefix build/,$(CFILES_PARENT:.c=.o)) \
+ $(addprefix build/,$(CPPFILES_PARENT:.cpp=.o)) \
+ $(addprefix build/,$(AFILES_PARENT:.s=.o))
+OFILES_CHILD = $(addprefix build/child/,$(CFILES_CHILD:.c=.o)) \
+ $(addprefix build/child/,$(CPPFILES_CHILD:.cpp=.o)) \
+ $(addprefix build/child/,$(AFILES_CHILD:.s=.o))
+
+# Project specific includes and libraries
+# (use -I for include dirs, -L for library dirs, -l for static libraries)
+INCLUDE +=
+LIBDIRS +=
+LIBS +=
+
+# Relocate the child executable to 0x30000
+LDFLAGS_CHILD = -Ttext=0x80030000
+
+## Build rules
+
+#all: iso
+all: build/child/child build/parent
+
+iso: build/child/child build/parent resources
+ $(MKPSXISO) -y -q iso.xml
+
+resources:
+ # Add commands to build/convert your assets here
+ #$(LZPACK) data.xml
+
+build/child/child: $(OFILES_CHILD)
+ @mkdir -p $(dir $@)
+ $(LD) $(LDFLAGS_EXE) $(LDFLAGS_CHILD) $(LIBDIRS) $^ $(LIBS) -o $@
+ $(NM) -f posix -l -n $@ >$@.map
+ $(ELF2X) -q $@ $@.exe
+
+build/parent: $(OFILES_PARENT)
+ @mkdir -p $(dir $@)
+ $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
+ $(NM) -f posix -l -n $@ >$@.map
+ $(ELF2X) -q $@ $@.exe
+
+build/child/%.o: child/%.c
+ @mkdir -p $(dir $@)
+ $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
+build/child/%.o: child/%.cpp
+ @mkdir -p $(dir $@)
+ $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
+
+build/child/%.o: child/%.s
+ @mkdir -p $(dir $@)
+ $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
-parent: build/parent.o build/child_exe.o
- $(LD) $(LDFLAGS_P) $(LIBDIRS) build/parent.o build/child_exe.o $(LIBS) -o parent.elf
- elf2x -q parent.elf
-
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 parent.elf parent.exe child.elf child.exe
+ rm -rf build
diff --git a/examples/system/console/makefile b/examples/system/console/makefile
index 1ee638f..addf02a 100644
--- a/examples/system/console/makefile
+++ b/examples/system/console/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 = console.elf
+TARGET = console
+
+## 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 = -lpsxsio -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/system/timer/makefile b/examples/system/timer/makefile
index a8defe7..c418af4 100644
--- a/examples/system/timer/makefile
+++ b/examples/system/timer/makefile
@@ -1,35 +1,65 @@
-include ../../examples-setup.mk
+# PSn00bSDK makefile template
+# Part of the PSn00bSDK Project
+# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-TARGET = timer.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 = timer
-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/system/tty/makefile b/examples/system/tty/makefile
index 43893d5..381aa41 100644
--- a/examples/system/tty/makefile
+++ b/examples/system/tty/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 = tty.elf
+TARGET = tty
+
+## 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