aboutsummaryrefslogtreecommitdiff
path: root/examples/demos
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/demos
parent5f5461879c73720359e87fa41cbfe8c452f5155e (diff)
downloadpsn00bsdk-89751f29467b359339a8c8b57c218cc3328bae43.tar.gz
Rewritten all Makefiles, set up proper GCC options, added iso.xml to template
Diffstat (limited to 'examples/demos')
-rw-r--r--examples/demos/n00bdemo/data.s2
-rw-r--r--examples/demos/n00bdemo/data.xml6
-rw-r--r--examples/demos/n00bdemo/makefile82
3 files changed, 58 insertions, 32 deletions
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