Files
PS5_RetroArch/Makefile
T
MihawkandClaude Opus 5.5 5327e4832a Build with my payload SDK fork, and adopt its platform layer
The title and its cores build with ../PS5_PayloadSDK at a pinned
revision (tools/setup-native-dependencies.sh): the v0.42 release with
the fork's headers and platform layer installed over it. The builder
links SDK archives by name (APP_SDK_ARCHIVES); the core stamps include
the fork's revision.

- The machine context: the fork's sys/_ucontext.h is the console's
  layout, so the crash reporter, the sampler and the Dolphin, PPSSPP
  and LRPS2 ports read uc_mcontext's fields; the six-word offset each
  carried is gone.
- The libc gaps: src/ps5_directory.cpp and most of src/libc_shims.c are
  the platform's ps5_* functions; src/platform_wraps.c binds the
  title's --wrap links to them and tools/core-imports.py a core's
  imports. The directory fixture test moved to the fork.
- Executable code and guest memory: Dolphin's, PPSSPP's and LRPS2's JIT
  code is the platform's executable direct memory near each core, at
  upstream cache sizes (Dolphin 128 + 64 MiB, LRPS2 305 MiB), and their
  arenas are the platform's direct-memory objects, views and ranges.
- A profiled run reports the platform's live counters after its memory
  line; the platform probe test aid gains the huge and full tests.
- docs/PLATFORM_FIRMWARE_ANALYSIS.md: the 10.01 modules' export tables
  against the SDK, and where the platform layer lives.
- tools/run_clang_tidy.sh tidies each C++ test with the flags its
  harness builds it with (the app-source pass still lacks the build's
  include paths; a separate task).

Console (docs/PHASE_LOG.md): Dolphin Profiles 0, 1 and 9 and Rogue
Leader, PPSSPP God of War and LRPS2's BIOS run with no crash; Dolphin
has 58 MiB more flexible memory in game and LRPS2 160 MiB more, with
the caches at upstream sizes; the platform's counters return to zero
when content closes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 01:02:30 -04:00

210 lines
7.5 KiB
Makefile

# ps5-native-app-boilerplate - Linux/WSL build entry points.
# Copyright (C) 2026 BlackBearReloaded
# SPDX-License-Identifier: GPL-3.0-or-later
SHELL := /bin/bash
.DEFAULT_GOAL := app
-include .env
APP_DEFINITIONS ?=
APP_INCLUDE_PATHS ?=
APP_STATIC_ARCHIVES ?=
APP_SDK_ARCHIVES ?=
APP_RUNTIME_MODULES ?=
PACBREW_PACKAGES ?=
PACBREW_INCLUDE_PATHS ?=
PACBREW_STATIC_ARCHIVES ?=
PS5_HOST ?=
FTP_PORT ?= 2121
DEPLOY_FORMAT ?= folder
PS5_FTP_USER ?= anonymous
PS5_FTP_PASSWORD ?= codex
DEPLOY_DRY_RUN ?= 0
TITLE_ID ?=
APP_NAME ?=
APP_CATEGORY ?= game
CONTENT_SUFFIX ?=
HOST_CXX ?= clang++
HOST_TEST_CXXFLAGS ?= -std=c++20 -O2 -Wall -Wextra -Wpedantic -Werror \
-ffunction-sections -fdata-sections
HOST_TEST_LDFLAGS ?= -Wl,--gc-sections
GTEST_ARGS ?=
export APP_DEFINITIONS APP_INCLUDE_PATHS APP_STATIC_ARCHIVES APP_SDK_ARCHIVES APP_RUNTIME_MODULES
export PACBREW_PACKAGES PACBREW_INCLUDE_PATHS PACBREW_STATIC_ARCHIVES
export PS5_HOST FTP_PORT DEPLOY_FORMAT PS5_FTP_USER PS5_FTP_PASSWORD DEPLOY_DRY_RUN
export TITLE_ID APP_NAME APP_CATEGORY CONTENT_SUFFIX
RUNTIME := runtime/libc.prx
RUNTIME_INPUTS := tools/rebuild-libc.sh \
$(wildcard tooling/native/*.cpp tooling/native/*.hpp) \
$(wildcard tooling/native/runtime/*.txt)
HOST_UNIT_TEST := build/tests/demo_renderer_tests
.PHONY: all app build init doctor test test-deps test-unit test-integration libc deps pacbrew pacbrew-list assets-check format format-check tidy lint check ffpkg ffpfsc packages deploy undeploy clean distclean help
all: app
build: app
.PHONY: genesis-plus-gx
genesis-plus-gx:
@bash tools/build-genesis-plus-gx.sh
.PHONY: fbneo
fbneo:
@bash tools/build-fbneo.sh
.PHONY: snes9x
snes9x:
@bash tools/build-snes9x.sh
.PHONY: mgba
mgba:
@bash tools/build-mgba.sh
.PHONY: fceumm
fceumm:
@bash tools/build-fceumm.sh
init:
@printf '%s\n' '==> [init] Configuring the application identity in sce_sys/param.json'
@bash tools/init-project.sh sce_sys/param.json
doctor:
@printf '%s\n' '==> [doctor] Checking the Linux/WSL host without changing it'
@bash tools/doctor.sh
test: test-unit
test-deps:
@printf '%s\n' '==> [test-deps] Nothing to fetch: the tests are host-native python'
@python3 -c 'import sys; print("==> [test-deps] python", sys.version.split()[0])'
# The template's GoogleTest target is gone with the template's demo renderer. What
# replaced it is tests/test_frontend.py, which is python and needs no build step:
# it compiles the frame-layout function out of src/display.cpp with the host
# compiler and reads the built object and the built artifact directly, so it can
# question what was made without a cross toolchain and without a console.
test-unit:
@printf '%s\n' '==> [test-unit] Running the host-native frontend tests'
@python3 -m unittest discover -s tests -p 'test_*.py' -v
test-integration: test-unit
deps: test-deps
@printf '%s\n' '==> [deps] Fetching declared native dependencies'
@bash tools/setup-native-dependencies.sh
@bash tools/setup-pacbrew-dependencies.sh --environment
pacbrew:
@printf '%s\n' '==> [pacbrew] Fetching the pinned prebuilt ports sysroot'
@bash tools/setup-pacbrew-dependencies.sh --all
pacbrew-list:
@printf '%s\n' '==> [pacbrew] Listing available pkg-config modules'
@bash tools/setup-pacbrew-dependencies.sh --list
assets-check:
@printf '%s\n' '==> [assets] Validating icon, backgrounds, and selection audio'
@bash tools/validate-assets.sh
libc:
@printf '%s\n' '==> [libc] Rebuilding and verifying the clean-room runtime'
@bash tools/rebuild-libc.sh
$(RUNTIME): $(RUNTIME_INPUTS)
@printf '%s\n' '==> [libc] Generating the missing or outdated runtime'
@bash tools/rebuild-libc.sh
app: $(RUNTIME)
@printf '%s\n' '==> [app] Compiling, linking, signing, and assembling the app folder'
@bash tools/build.sh Folder
ffpkg: $(RUNTIME)
@printf '%s\n' '==> [ffpkg] Building the app folder and UFS2 image'
@bash tools/build.sh Ffpkg
ffpfsc: $(RUNTIME)
@printf '%s\n' '==> [ffpfsc] Building the app folder and compressed image'
@bash tools/build.sh Ffpfsc
packages: $(RUNTIME)
@printf '%s\n' '==> [packages] Building the app folder and both package formats'
@bash tools/build.sh All
deploy:
@printf '%s\n' '==> [deploy] Building the title and publishing it over FTP'
@bash tools/build-title.sh
@python3 tools/deploy-title.py
deploy-check:
@printf '%s\n' '==> [deploy] Reading back what the console holds for this title'
@python3 tools/deploy-title.py --check
undeploy:
@printf '%s\n' '==> [undeploy] Removing staged development files for this title over FTP'
@python3 tools/deploy-title.py --clean
format:
@printf '%s\n' '==> [format] Formatting C and C++ sources'
@bash tools/run_clang_format.sh
format-check:
@printf '%s\n' '==> [format] Checking C and C++ formatting'
@bash tools/run_clang_format.sh --check
tidy:
@printf '%s\n' '==> [tidy] Running Clang static analysis'
@bash tools/run_clang_tidy.sh
lint:
@printf '%s\n' '==> [lint] Running source, metadata, and shell checks'
@bash tools/lint.sh
check: lint test app
clean:
@printf '%s\n' '==> [clean] Removing generated build outputs'
@rm -rf -- build dist
@rm -f -- $(RUNTIME)
distclean: clean
@printf '%s\n' '==> [distclean] Removing downloaded dependency caches'
@rm -rf -- .deps
help:
@printf '%s\n' \
'make Generate libc.prx and build the Hello World folder' \
'make init TITLE_ID=PPSA12345 APP_NAME="My App" Configure app identity' \
'make doctor Check required and optional Linux/WSL tools' \
'make test Run all host unit and integration tests' \
'make test-deps Fetch verified host-only GoogleTest source' \
'make test-unit Run host-native GoogleTest application tests' \
'make test-integration Run host tooling integration tests' \
'make deps Fetch native dependencies into .deps/' \
'make genesis-plus-gx Build and ABI-check the pinned PS5 Genesis Plus GX core' \
'make fbneo Build and ABI-check the pinned PS5 FBNeo core' \
'make snes9x Build and ABI-check the pinned PS5 Snes9x core' \
'make mgba Build and ABI-check the pinned PS5 mGBA core' \
'make fceumm Build and ABI-check the pinned PS5 FCEUmm core' \
'make pacbrew Fetch the pinned PacBrew ports sysroot' \
'make pacbrew-list List PacBrew pkg-config module names' \
'make assets-check Validate the current presentation assets' \
'make libc Force a deterministic runtime/libc.prx rebuild' \
'make format Apply the shared Clang formatting policy' \
'make format-check Check formatting without modifying files' \
'make tidy Run the shared Clang static-analysis policy' \
'make lint Run format, tidy, metadata, and shell checks' \
'make check Run lint and build the skeleton app' \
'make ffpkg Build the folder and UFS2 .ffpkg image' \
'make ffpfsc Build the folder and compressed .ffpfsc image' \
'make packages Build folder, .ffpkg, and .ffpfsc outputs' \
'make deploy PS5_HOST=<address> Build and FTP-deploy the app folder' \
'make undeploy PS5_HOST=<address> Remove this title from /data/homebrew' \
'Build variables: APP_DEFINITIONS, APP_INCLUDE_PATHS, APP_STATIC_ARCHIVES, APP_SDK_ARCHIVES, APP_RUNTIME_MODULES' \
'PacBrew variables: PACBREW_PACKAGES, PACBREW_INCLUDE_PATHS, PACBREW_STATIC_ARCHIVES' \
'Deploy variables: FTP_PORT=2121, DEPLOY_FORMAT=folder|ffpfsc|ffpkg, DEPLOY_DRY_RUN=0|1' \
'Local defaults: Copy .env.example to the ignored .env file' \
'make clean Remove build/, dist/, and generated libc.prx' \
'make distclean Also remove the ignored .deps/ cache'