Update Makefile to dynamically locate PRX files

This commit is contained in:
Kravickas authored and GitHub committed 2026-05-10 17:50:16 +02:00
1 parent 49f4373990
commit a231a35bb2
1 file changed
+27 -7
+27 -7
View File
@@ -77,19 +77,39 @@ $(CONTENT_ID).pkg: pkg.gp4
# "corrupted app" because the dynamic linker can't satisfy NEEDED libc.prx.
# libSceFios2.prx is the matching default file-IO library and is included
# by every OpenOrbis sample for the same reason.
pkg.gp4: eboot.bin sce_sys/param.sfo sce_sys/icon0.png \
sce_module/libc.prx sce_module/libSceFios2.prx
$(TOOLCHAIN)/bin/$(CDIR)/create-gp4 -out $@ \
--content-id=$(CONTENT_ID) --files "$^"
#
# Different OpenOrbis releases stash the prebuilt PRX files in different
# locations (bin/data/modules/, lib/, samples/_common/sce_module/, etc.),
# so we use `find` to locate them at make time rather than hardcoding.
LIBC_PRX_SRC := $(shell find $(TOOLCHAIN) -name libc.prx -type f 2>/dev/null | head -1)
LIBFIOS_PRX_SRC := $(shell find $(TOOLCHAIN) -name libSceFios2.prx -type f 2>/dev/null | head -1)
# Copy the SDK's prebuilt sce_module assets into our pkg tree.
# Build up gp4 dependencies and prx copy rules conditionally on whether the
# PRX files were located. If they're missing entirely the build still
# completes (with a warning) so the hello_world pipeline test isn't blocked.
GP4_DEPS := eboot.bin sce_sys/param.sfo sce_sys/icon0.png
ifneq ($(LIBC_PRX_SRC),)
GP4_DEPS += sce_module/libc.prx
sce_module/libc.prx:
@mkdir -p sce_module
cp $(TOOLCHAIN)/bin/data/modules/libc.prx $@
cp $(LIBC_PRX_SRC) $@
else
$(warning libc.prx not found in $(TOOLCHAIN) — eboot importing libc will fail at launch with "corrupted app")
endif
ifneq ($(LIBFIOS_PRX_SRC),)
GP4_DEPS += sce_module/libSceFios2.prx
sce_module/libSceFios2.prx:
@mkdir -p sce_module
cp $(TOOLCHAIN)/bin/data/modules/libSceFios2.prx $@
cp $(LIBFIOS_PRX_SRC) $@
else
$(warning libSceFios2.prx not found in $(TOOLCHAIN) — eboot importing FIOS2 will fail at launch)
endif
pkg.gp4: $(GP4_DEPS)
$(TOOLCHAIN)/bin/$(CDIR)/create-gp4 -out $@ \
--content-id=$(CONTENT_ID) --files "$^"
# param.sfo — built via PkgTool.Core
sce_sys/param.sfo: Makefile