Skip to content

About this page

On this page

ps2.yaml ​

The build definition ps2build reads. ps2build init creates a minimal one:

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 and cdvd libraries are linked automatically. List only additional 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 with -nostdlib -dc -r, stripped, then processed by iopfixup.
  • ee_lib / iop_lib - compiles like an ee or iop target but produces lib<name>.a and is not linked itself. An ee target links an ee_lib (and iop an iop_lib) by listing the target name, without lib<name>.a, in its libs: next to any external library names. Link order is preserved as written, so order matters.

An ee target's final link automatically switches to the C++ link driver when the target has a .cpp, .cc or .cxx source, or links an ee_lib that does. No configuration is needed.

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 is built once.

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

The tool prints the full JSON Schema:

bash
ps2build schema