Skip to content

ps2.yaml

The build definition ps2build reads. A minimal one, from ps2build init:

yaml
project: my-game

targets:
  - name: my-game
    type: ee
    sources: [src/main.c]

Target types

Every target has a type: ee, iop, ee_lib, or iop_lib.

  • ee - a bootable .elf. The standard kernel/cglue/cdvd libraries are already linked automatically - only list extra libraries in libs:. Set output_bin: true to also produce a flat .bin, or pack: true to produce a compressed, self-extracting <name>-packed.elf.
  • iop - a relocatable .irx module. Linked specially (-nostdlib -dc -r), stripped, then passed through the iopfixup tool.
  • ee_lib / iop_lib - compiles like an ee/iop target but archives into lib<name>.a instead of linking - never itself linked. An ee target links against an ee_lib (and iop against iop_lib) by listing its target name (not lib<name>.a) in its own libs:, alongside any external library names, in the same list - order matters, since static link order is preserved exactly as written.

An ee target's final link automatically switches to the C++ link driver whenever C++ runtime support is needed - its own sources contain a .cpp/.cc/.cxx file, or it links an ee_lib that does. You never need to do anything to trigger this.

Embedding an IOP module (embed_irx)

An ee target can list iop targets by name in embed_irx:. For each one, ps2build runs bin2c on the built .irx and links the result in:

c
extern unsigned char <name>_irx[];
extern unsigned int size_<name>_irx;
SifExecModuleBuffer(<name>_irx, size_<name>_irx, 0, NULL, NULL);

If two ee targets embed the same iop module, it's only built once and shared.

Fields

FieldApplies toMeaning
projectrootProject name (documentation only)
targetsrootThe list of build targets
nametargetUnique name - the ninja alias, and how other targets reference it
typetargetee / iop / ee_lib / iop_lib
sourcestargetExplicit source file paths (.c/.cpp/.s/.S)
include_dirstargetExtra -I dirs
definestargetExtra preprocessor defines
cflagstargetExtra compile flags
ldflagstargetExtra link flags (ee/iop only)
libstargetExtra libraries and/or same-file ee_lib/iop_lib names (ee/iop only)
headerstargetInstalled packages whose headers this target compiles against - no linking. Valid on every target type, including ee_lib/iop_lib
linkfiletargetOverride the default linker script (ee/iop only)
opttargetOverride the optimization flag (default -O2 ee, -Os iop)
debugtargetAdd -gdwarf-2 -gz
embed_irxtargetee only - iop targets to embed via bin2c
output_bintargetee only - also emit a flat .bin
packtargetee only - also run ps2pack to produce a compressed, self-extracting <name>-packed.elf
imports_lsttargetiop only - path to an imports.lst file
exports_tabtargetiop only - path to an exports.tab file

Guaranteed to be correct - the full JSON Schema comes straight from the tool itself:

bash
ps2build schema