#!/usr/bin/env python3

###
# Generates build files for the project.
# This file also includes the project configuration,
# such as compiler flags and the object matching status.
#
# Usage:
#   python3 configure.py
#   ninja
#
# Append --help to see available options.
###

import sys
import argparse

from pathlib import Path
from tools.project import (
    Object,
    ProjectConfig,
    calculate_progress,
    generate_build,
    is_windows,
)

# Game versions
DEFAULT_VERSION = 1
VERSIONS = [
    "GZLJ01",  # 0
    "GZLE01",  # 1
    "GZLP01",  # 2
]

if len(VERSIONS) > 1:
    versions_str = ", ".join(VERSIONS[:-1]) + f" or {VERSIONS[-1]}"
else:
    versions_str = VERSIONS[0]

parser = argparse.ArgumentParser()
parser.add_argument(
    "mode",
    default="configure",
    help="configure or progress (default: configure)",
    nargs="?",
)
parser.add_argument(
    "--version",
    dest="version",
    default=VERSIONS[DEFAULT_VERSION],
    help=f"version to build ({versions_str})",
)
parser.add_argument(
    "--build-dir",
    dest="build_dir",
    type=Path,
    default=Path("build"),
    help="base build directory (default: build)",
)
parser.add_argument(
    "--compilers",
    dest="compilers",
    type=Path,
    help="path to compilers (optional)",
)
parser.add_argument(
    "--map",
    dest="map",
    action="store_true",
    help="generate map file(s)",
)
parser.add_argument(
    "--debug",
    dest="debug",
    action="store_true",
    help="build with debug info (non-matching)",
)
if not is_windows():
    parser.add_argument(
        "--wrapper",
        dest="wrapper",
        type=Path,
        help="path to wibo or wine (optional)",
    )
parser.add_argument(
    "--build-dtk",
    dest="build_dtk",
    type=Path,
    help="path to decomp-toolkit source (optional)",
)
parser.add_argument(
    "--sjiswrap",
    dest="sjiswrap",
    type=Path,
    help="path to sjiswrap.exe (optional)",
)
parser.add_argument(
    "--verbose",
    dest="verbose",
    action="store_true",
    help="print verbose output",
)
args = parser.parse_args()

config = ProjectConfig()
config.version = args.version.upper()
if config.version not in VERSIONS:
    sys.exit(f"Invalid version '{config.version}', expected {versions_str}")
version_num = VERSIONS.index(config.version)

# Apply arguments
config.build_dir = args.build_dir
config.build_dtk_path = args.build_dtk
config.compilers_path = args.compilers
config.debug = args.debug
config.generate_map = args.map
config.sjiswrap_path = args.sjiswrap
if not is_windows():
    config.wrapper = args.wrapper

# Tool versions
config.compilers_tag = "20230715"
config.dtk_tag = "v0.5.7"
config.sjiswrap_tag = "v1.1.1"
config.wibo_tag = "0.6.3"

# Project
config.config_path = Path("config") / config.version / "config.yml"
config.check_sha_path = Path("orig") / f"{config.version}.sha1"
config.linker_version = "GC/1.3.2"
config.ldflags = [
    "-fp hardware",
    "-nodefaults",
]

# Base flags, common to most GC/Wii games.
# Generally leave untouched, with overrides added below.
cflags_base = [
    "-nodefaults",
    "-proc gekko",
    "-align powerpc",
    "-enum int",
    "-fp hardware",
    "-Cpp_exceptions off",
    # "-W all",
    "-O4,p",
    "-inline auto",
    '-pragma "cats off"',
    '-pragma "warn_notinlined off"',
    "-maxerrors 1",
    "-nosyspath",
    "-RTTI off",
    "-fp_contract on",
    "-str reuse",
    "-multibyte",
    "-i include",
    f"-DVERSION={version_num}",
]
if config.debug:
    cflags_base.extend(["-sym on", "-DDEBUG=1"])
else:
    cflags_base.append("-DNDEBUG=1")

# Metrowerks library flags
cflags_runtime = [
    *cflags_base,
    "-use_lmw_stmw on",
    "-str reuse,pool,readonly",
    "-inline deferred,auto",
]

# Dolphin library flags
cflags_dolphin = [
    *cflags_base,
    "-use_lmw_stmw on",
    "-str reuse,pool,readonly",
    "-inline auto",
]

# Framework flags
cflags_framework = [
    *cflags_base,
    "-use_lmw_stmw off",
    "-str reuse,pool,readonly",
    "-inline noauto",
    "-O3,s",
    "-schedule off",
    "-sym on",
    "-fp_contract off",
]

# REL flags
cflags_rel = [
    *cflags_framework,
    "-sdata 0",
    "-sdata2 0",
]


# Helper function for single-object RELs
def Rel(status, rel_name, cpp_name, extra_cflags=[]):
    return {
        "lib": rel_name,
        "mw_version": "GC/1.3.2",
        "cflags": cflags_rel + extra_cflags,
        "host": True,
        "objects": [
            Object(status, cpp_name),
        ],
    }


# Helper function for actor RELs
def ActorRel(status, rel_name, extra_cflags=[]):
    return Rel(status, rel_name, f"d/actor/{rel_name}.cpp", extra_cflags=extra_cflags)


# Helper function for JSystem libraries
def JSystemLib(lib_name, objects):
    return {
        "lib": lib_name,
        "mw_version": "GC/1.3.2",
        "cflags": cflags_framework,
        "host": True,
        "objects": objects,
    }


# Helper function for Dolphin libraries
def DolphinLib(lib_name, objects):
    return {
        "lib": lib_name,
        "mw_version": "GC/1.2.5n",
        "cflags": cflags_dolphin, # TODO check
        "host": False,
        "objects": objects,
    }


Matching = True
NonMatching = False

config.warn_missing_config = True
config.warn_missing_source = False # TODO
config.libs = [
    {
        "lib": "framework",
        "mw_version": "GC/1.3.2",
        "cflags": cflags_framework,
        "host": True,
        "objects": [
            # machine
            Object(Matching,    "m_Do/m_Do_main.cpp"),
            Object(Matching,    "m_Do/m_Do_printf.cpp"),
            Object(NonMatching, "m_Do/m_Do_audio.cpp"),
            Object(NonMatching, "m_Do/m_Do_controller_pad.cpp"),
            Object(NonMatching, "m_Do/m_Do_graphic.cpp"),
            Object(Matching,    "m_Do/m_Do_machine.cpp"),
            Object(NonMatching, "m_Do/m_Do_mtx.cpp"),
            Object(NonMatching, "m_Do/m_Do_ext.cpp", extra_cflags=["-sym off"]),
            Object(NonMatching, "m_Do/m_Do_lib.cpp"),
            Object(Matching,    "m_Do/m_Do_hostIO.cpp"),
            Object(Matching,    "m_Do/m_Do_Reset.cpp"),
            Object(NonMatching, "m_Do/m_Do_dvd_thread.cpp"),
            Object(Matching,    "m_Do/m_Do_DVDError.cpp"),
            Object(NonMatching, "m_Do/m_Do_MemCard.cpp"),
            Object(NonMatching, "m_Do/m_Do_MemCardRWmng.cpp"),
            Object(NonMatching, "m_Do/m_Do_gba_com.cpp"),
            Object(Matching,    "m_Do/m_Do_machine_exception.cpp"),

            # c
            Object(NonMatching, "c/c_damagereaction.cpp"),
            Object(Matching,    "c/c_dylink.cpp"),

            # f_ap
            Object(NonMatching, "f_ap/f_ap_game.cpp"),

            # f_op
            Object(Matching,    "f_op/f_op_actor.cpp", extra_cflags=["-sym off"]),
            Object(Matching,    "f_op/f_op_actor_iter.cpp"),
            Object(Matching,    "f_op/f_op_actor_tag.cpp"),
            Object(NonMatching, "f_op/f_op_actor_mng.cpp"),
            Object(Matching,    "f_op/f_op_camera.cpp"),
            Object(Matching,    "f_op/f_op_camera_mng.cpp"),
            Object(Matching,    "f_op/f_op_overlap.cpp"),
            Object(Matching,    "f_op/f_op_overlap_mng.cpp"),
            Object(Matching,    "f_op/f_op_overlap_req.cpp"),
            Object(Matching,    "f_op/f_op_scene.cpp"),
            Object(Matching,    "f_op/f_op_scene_iter.cpp"),
            Object(Matching,    "f_op/f_op_scene_mng.cpp"),
            Object(Matching,    "f_op/f_op_scene_req.cpp"),
            Object(Matching,    "f_op/f_op_scene_tag.cpp"),
            Object(Matching,    "f_op/f_op_view.cpp"),
            Object(Matching,    "f_op/f_op_kankyo.cpp"),
            Object(Matching,    "f_op/f_op_msg.cpp"),
            Object(Matching,    "f_op/f_op_kankyo_mng.cpp"),
            Object(NonMatching, "f_op/f_op_msg_mng.cpp"),
            Object(Matching,    "f_op/f_op_draw_iter.cpp"),
            Object(Matching,    "f_op/f_op_draw_tag.cpp"),
            Object(Matching,    "f_op/f_op_scene_pause.cpp"),

            # f_pc
            Object(Matching,    "f_pc/f_pc_base.cpp"),
            Object(Matching,    "f_pc/f_pc_create_iter.cpp"),
            Object(Matching,    "f_pc/f_pc_create_req.cpp"),
            Object(Matching,    "f_pc/f_pc_create_tag.cpp"),
            Object(Matching,    "f_pc/f_pc_creator.cpp"),
            Object(Matching,    "f_pc/f_pc_delete_tag.cpp"),
            Object(Matching,    "f_pc/f_pc_deletor.cpp"),
            Object(Matching,    "f_pc/f_pc_draw_priority.cpp"),
            Object(Matching,    "f_pc/f_pc_executor.cpp"),
            Object(Matching,    "f_pc/f_pc_layer.cpp"),
            Object(Matching,    "f_pc/f_pc_leaf.cpp"),
            Object(Matching,    "f_pc/f_pc_layer_iter.cpp"),
            Object(Matching,    "f_pc/f_pc_layer_tag.cpp"),
            Object(Matching,    "f_pc/f_pc_line.cpp"),
            Object(Matching,    "f_pc/f_pc_load.cpp"),
            Object(NonMatching, "f_pc/f_pc_manager.cpp"),
            Object(Matching,    "f_pc/f_pc_method.cpp"),
            Object(Matching,    "f_pc/f_pc_node.cpp"),
            Object(Matching,    "f_pc/f_pc_node_req.cpp"),
            Object(Matching,    "f_pc/f_pc_priority.cpp"),
            Object(Matching,    "f_pc/f_pc_profile.cpp"),
            Object(Matching,    "f_pc/f_pc_searcher.cpp"),
            Object(Matching,    "f_pc/f_pc_line_tag.cpp"),
            Object(Matching,    "f_pc/f_pc_line_iter.cpp"),
            Object(Matching,    "f_pc/f_pc_method_iter.cpp"),
            Object(Matching,    "f_pc/f_pc_method_tag.cpp"),
            Object(Matching,    "f_pc/f_pc_pause.cpp"),
            Object(Matching,    "f_pc/f_pc_draw.cpp"),
            Object(Matching,    "f_pc/f_pc_fstcreate_req.cpp"),
            Object(Matching,    "f_pc/f_pc_stdcreate_req.cpp"),

            # dolzel
            Object(NonMatching, "d/d_stage.cpp"),
            Object(NonMatching, "d/d_map.cpp"),
            Object(NonMatching, "d/d_com_inf_game.cpp"),
            Object(Matching,    "d/d_com_lib_game.cpp"),
            Object(NonMatching, "d/d_com_static.cpp"),
            Object(NonMatching, "d/d_lib.cpp"),
            Object(NonMatching, "d/d_save.cpp"),
            Object(NonMatching, "d/d_save_init.cpp"),
            Object(NonMatching, "d/d_shop.cpp"),
            Object(NonMatching, "d/d_jnt_hit.cpp"),
            Object(NonMatching, "d/d_chain.cpp"),
            Object(NonMatching, "d/d_cloth_packet.cpp"),
            Object(NonMatching, "d/actor/d_a_obj.cpp"),
            Object(NonMatching, "d/d_a_obj_tribox_static.cpp"),
            Object(Matching,    "d/d_a_ship_static.cpp"),
            Object(Matching,    "d/d_a_boko_static.cpp"),
            Object(Matching,    "d/d_a_bomb_static.cpp"),
            Object(Matching,    "d/d_a_branch_static.cpp"),
            Object(NonMatching, "d/d_a_mgameboard_static.cpp"),
            Object(Matching,    "d/d_a_itembase_static.cpp"),
            Object(Matching,    "d/d_a_item_static.cpp"),
            Object(Matching,    "d/d_a_shop_item_static.cpp"),
            Object(NonMatching, "d/d_a_race_item_static.cpp"),
            Object(NonMatching, "d/d_a_leaflift_static.cpp"),
            Object(NonMatching, "d/d_demo.cpp"),
            Object(NonMatching, "d/d_door.cpp"),
            Object(NonMatching, "d/d_resorce.cpp"),
            Object(NonMatching, "d/d_material.cpp"),
            Object(NonMatching, "d/d_event.cpp"),
            Object(NonMatching, "d/d_event_data.cpp"),
            Object(NonMatching, "d/d_event_manager.cpp"),
            Object(NonMatching, "d/d_magma.cpp"),
            Object(NonMatching, "d/d_boss_magma.cpp"),
            Object(NonMatching, "d/d_grass.cpp"),
            Object(NonMatching, "d/d_tree.cpp"),
            Object(NonMatching, "d/d_particle.cpp"),
            Object(Matching,    "d/d_particle_name.cpp"),
            Object(Matching,    "d/d_path.cpp"),
            Object(NonMatching, "d/d_drawlist.cpp"),
            Object(Matching,    "d/d_kankyo_data.cpp"),
            Object(Matching,    "d/d_kankyo_wether.cpp"),
            Object(NonMatching, "d/d_kankyo_rain.cpp"),
            Object(Matching,    "d/d_kankyo_demo.cpp"),
            Object(NonMatching, "d/d_detect.cpp"),
            Object(NonMatching, "d/d_vibration.cpp"),
            Object(NonMatching, "d/d_vib_pattern.cpp"),
            Object(NonMatching, "d/d_attention.cpp"),
            Object(NonMatching, "d/d_att_dist.cpp"),
            Object(NonMatching, "d/d_bg_s.cpp"),
            Object(NonMatching, "d/d_bg_s_acch.cpp"),
            Object(NonMatching, "d/d_bg_s_func.cpp"),
            Object(Matching,    "d/d_bg_s_lin_chk.cpp"),
            Object(Matching,    "d/d_bg_s_movebg_actor.cpp"),
            Object(Matching,    "d/d_bg_s_spl_grp_chk.cpp"),
            Object(Matching,    "d/d_bg_s_wtr_chk.cpp"),
            Object(NonMatching, "d/d_bg_w.cpp"),
            Object(NonMatching, "d/d_bg_w_deform.cpp"),
            Object(NonMatching, "d/d_bg_w_hf.cpp"),
            Object(NonMatching, "d/d_bg_w_sv.cpp"),
            Object(NonMatching, "d/d_cc_d.cpp"),
            Object(NonMatching, "d/d_cc_mass_s.cpp"),
            Object(NonMatching, "d/d_cc_s.cpp"),
            Object(NonMatching, "d/d_cc_uty.cpp"),
            Object(NonMatching, "d/d_cam_param.cpp"),
            Object(NonMatching, "d/d_cam_type.cpp"),
            Object(NonMatching, "d/d_cam_style.cpp"),
            Object(NonMatching, "d/d_cam_type2.cpp"),
            Object(NonMatching, "d/d_ev_camera.cpp"),
            Object(NonMatching, "d/d_wood.cpp"),
            Object(NonMatching, "d/d_flower.cpp"),
            Object(Matching,    "d/d_item_data.cpp"),
            Object(Matching,    "d/d_seafightgame.cpp"),
            Object(NonMatching, "d/d_spline_path.cpp"),
            Object(NonMatching, "d/d_s_actor_data_mng.cpp"),
            Object(Matching,    "d/d_item.cpp"),
            Object(NonMatching, "d/d_2dnumber.cpp"),
            Object(NonMatching, "d/d_a_npc_cb1_static.cpp"),
            Object(NonMatching, "d/d_a_npc_mk_static.cpp"),
            Object(NonMatching, "d/d_salvage.cpp"),
            Object(NonMatching, "d/d_snap.cpp"),
            Object(Matching,    "d/d_point_wind.cpp"),
            Object(NonMatching, "d/actor/d_a_agb.cpp"),
            Object(Matching,    "d/actor/d_a_arrow.cpp", extra_cflags=["-sym off"]),
            Object(NonMatching, "d/actor/d_a_bg.cpp"),
            Object(NonMatching, "d/actor/d_a_bomb.cpp"),
            Object(NonMatching, "d/actor/d_a_bomb2.cpp"),
            Object(NonMatching, "d/actor/d_a_boomerang.cpp"),
            Object(NonMatching, "d/actor/d_a_dai_item.cpp"),
            Object(NonMatching, "d/actor/d_a_demo00.cpp"),
            Object(Matching,    "d/actor/d_a_disappear.cpp"),
            Object(NonMatching, "d/actor/d_a_esa.cpp"),
            Object(NonMatching, "d/actor/d_a_grid.cpp"),
            Object(NonMatching, "d/actor/d_a_himo2.cpp"),
            Object(NonMatching, "d/actor/d_a_hookshot.cpp"),
            Object(NonMatching, "d/actor/d_a_ib.cpp"),
            Object(NonMatching, "d/actor/d_a_item.cpp"),
            Object(Matching,    "d/actor/d_a_itembase.cpp"),
            Object(Matching,    "d/actor/d_a_nh.cpp"),
            Object(NonMatching, "d/actor/d_a_npc_fa1.cpp"),
            Object(NonMatching, "d/actor/d_a_obj_search.cpp"),
            Object(Matching,    "d/actor/d_a_player.cpp"),
            Object(NonMatching, "d/actor/d_a_player_main.cpp"),
            Object(NonMatching, "d/actor/d_a_player_npc.cpp"),
            Object(NonMatching, "d/actor/d_a_sea.cpp"),
            Object(NonMatching, "d/actor/d_a_spc_item01.cpp"),
            Object(NonMatching, "d/actor/d_a_vrbox.cpp"),
            Object(NonMatching, "d/actor/d_a_vrbox2.cpp"),
            Object(NonMatching, "d/d_auction_screen.cpp"),
            Object(Matching,    "d/d_place_name.cpp"),
            Object(NonMatching, "d/d_camera.cpp"),
            Object(NonMatching, "d/d_envse.cpp"),
            Object(NonMatching, "d/d_file_error.cpp"),
            Object(NonMatching, "d/d_file_select.cpp"),
            Object(NonMatching, "d/d_gameover.cpp"),
            Object(NonMatching, "d/d_kankyo.cpp"),
            Object(NonMatching, "d/d_kyeff.cpp"),
            Object(Matching,    "d/d_kyeff2.cpp"),
            Object(NonMatching, "d/d_ky_thunder.cpp"),
            Object(Matching,    "d/d_letter.cpp"),
            Object(NonMatching, "d/d_level_se.cpp"),
            Object(NonMatching, "d/d_menu_cloth.cpp"),
            Object(NonMatching, "d/d_menu_collect.cpp"),
            Object(NonMatching, "d/d_menu_dmap.cpp"),
            Object(NonMatching, "d/d_menu_fmap.cpp"),
            Object(NonMatching, "d/d_menu_fmap2.cpp"),
            Object(NonMatching, "d/d_menu_item.cpp"),
            Object(NonMatching, "d/d_menu_option.cpp"),
            Object(NonMatching, "d/d_menu_save.cpp"),
            Object(NonMatching, "d/d_menu_window.cpp"),
            Object(NonMatching, "d/d_mesg.cpp"),
            Object(NonMatching, "d/d_message.cpp"),
            Object(NonMatching, "d/d_message_paper.cpp"),
            Object(NonMatching, "d/d_meter.cpp"),
            Object(NonMatching, "d/d_minigame_starter.cpp"),
            Object(NonMatching, "d/d_minigame_terminater.cpp"),
            Object(NonMatching, "d/d_msg.cpp"),
            Object(NonMatching, "d/d_name.cpp"),
            Object(NonMatching, "d/d_npc.cpp"),
            Object(NonMatching, "d/d_operate_wind.cpp"),
            Object(NonMatching, "d/d_metronome.cpp"),
            Object(Matching,    "d/d_ovlp_fade.cpp"),
            Object(NonMatching, "d/d_ovlp_fade2.cpp"),
            Object(NonMatching, "d/d_ovlp_fade3.cpp"),
            Object(NonMatching, "d/d_ovlp_fade4.cpp"),
            Object(NonMatching, "d/d_picture_box.cpp"),
            Object(NonMatching, "d/d_s_logo.cpp"),
            Object(NonMatching, "d/d_s_menu.cpp"),
            Object(NonMatching, "d/d_s_name.cpp"),
            Object(Matching,    "d/d_s_open.cpp"),
            Object(NonMatching, "d/d_s_open_sub.cpp"),
            Object(NonMatching, "d/d_s_play.cpp"),
            Object(NonMatching, "d/d_s_room.cpp"),
            Object(Matching,    "d/d_s_title.cpp"),
            Object(NonMatching, "d/d_scope.cpp"),
            Object(Matching,    "d/d_throwstone.cpp"),
            Object(NonMatching, "d/d_timer.cpp"),
            Object(NonMatching, "d/d_water_mark.cpp"),
            Object(NonMatching, "d/d_wind_arrow.cpp"),
            Object(NonMatching, "d/d_wpillar.cpp"),
            Object(NonMatching, "d/d_wpot_water.cpp"),

            Object(Matching,    "DynamicLink.cpp"),
        ],
    },
    {
        "lib": "SSystem",
        "mw_version": "GC/1.3.2",
        "cflags": cflags_framework,
        "host": True,
        "objects": [
            Object(Matching,    "SSystem/SComponent/c_malloc.cpp"),
            Object(Matching,    "SSystem/SComponent/c_API.cpp"),
            Object(Matching,    "SSystem/SComponent/c_API_graphic.cpp"),
            Object(NonMatching, "SSystem/SComponent/c_cc_d.cpp"),
            Object(NonMatching, "SSystem/SComponent/c_cc_s.cpp"),
            Object(Matching,    "SSystem/SComponent/c_counter.cpp"),
            Object(Matching,    "SSystem/SComponent/c_list.cpp"),
            Object(Matching,    "SSystem/SComponent/c_list_iter.cpp"),
            Object(Matching,    "SSystem/SComponent/c_node.cpp"),
            Object(Matching,    "SSystem/SComponent/c_node_iter.cpp"),
            Object(Matching,    "SSystem/SComponent/c_tree.cpp"),
            Object(Matching,    "SSystem/SComponent/c_tree_iter.cpp"),
            Object(NonMatching, "SSystem/SComponent/c_phase.cpp"),
            Object(Matching,    "SSystem/SComponent/c_request.cpp"),
            Object(Matching,    "SSystem/SComponent/c_tag.cpp"),
            Object(Matching,    "SSystem/SComponent/c_tag_iter.cpp"),
            Object(Matching,    "SSystem/SComponent/c_xyz.cpp"),
            Object(Matching,    "SSystem/SComponent/c_sxyz.cpp"),
            Object(Matching,    "SSystem/SComponent/c_math.cpp"),
            Object(NonMatching, "SSystem/SComponent/c_bg_s.cpp"),
            Object(Matching,    "SSystem/SComponent/c_bg_s_chk.cpp"),
            Object(Matching,    "SSystem/SComponent/c_bg_s_gnd_chk.cpp"),
            Object(Matching,    "SSystem/SComponent/c_bg_s_lin_chk.cpp"),
            Object(NonMatching, "SSystem/SComponent/c_bg_w.cpp"),
            Object(Matching,    "SSystem/SComponent/c_m2d.cpp"),
            Object(NonMatching, "SSystem/SComponent/c_m2d_g_box.cpp"),
            Object(NonMatching, "SSystem/SComponent/c_m3d.cpp"),
            Object(Matching,    "SSystem/SComponent/c_m3d_g_aab.cpp"),
            Object(Matching,    "SSystem/SComponent/c_m3d_g_cyl.cpp"),
            Object(Matching,    "SSystem/SComponent/c_m3d_g_pla.cpp"),
            Object(Matching,    "SSystem/SComponent/c_m3d_g_sph.cpp"),
            Object(Matching,    "SSystem/SComponent/c_m3d_g_tri.cpp"),
            Object(Matching,    "SSystem/SComponent/c_lib.cpp"),
            Object(Matching,    "SSystem/SComponent/c_angle.cpp"),
            Object(Matching,    "SSystem/SComponent/c_data_tbl.cpp"),
            Object(Matching,    "SSystem/SStandard/s_basic.cpp"),
        ],
    },
    JSystemLib(
        "JFramework",
        [
            Object(NonMatching, "JSystem/JFramework/JFWDisplay.cpp"),
            Object(NonMatching, "JSystem/JFramework/JFWSystem.cpp"),
        ],
    ),
    JSystemLib(
        "J3DU",
        [
            Object(Matching,    "JSystem/J3DU/J3DUClipper.cpp"),
            Object(NonMatching, "JSystem/J3DU/J3DUMotion.cpp"),
            Object(Matching,    "JSystem/J3DU/J3DUDL.cpp"),
        ],
    ),
    JSystemLib(
        "JParticle",
        [
            Object(NonMatching, "JSystem/JParticle/JPABaseShape.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPAExtraShape.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPASweepShape.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPAExTexShape.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPADynamicsBlock.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPAFieldBlock.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPAKeyBlock.cpp"),
            Object(Matching,    "JSystem/JParticle/JPATexture.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPAResourceManager.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPAEmitterLoader.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPAMath.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPAField.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPAEmitter.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPAParticle.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPAEmitterManager.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPADrawVisitor.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPADraw.cpp"),
            Object(NonMatching, "JSystem/JParticle/JPADrawSetupTev.cpp"),
        ],
    ),
    JSystemLib(
        "JStage",
        [
            Object(NonMatching, "JSystem/JStage/JSGActor.cpp"),
            Object(NonMatching, "JSystem/JStage/JSGAmbientLight.cpp"),
            Object(NonMatching, "JSystem/JStage/JSGCamera.cpp"),
            Object(NonMatching, "JSystem/JStage/JSGFog.cpp"),
            Object(NonMatching, "JSystem/JStage/JSGLight.cpp"),
            Object(NonMatching, "JSystem/JStage/JSGObject.cpp"),
            Object(NonMatching, "JSystem/JStage/JSGSystem.cpp"),
        ],
    ),
    JSystemLib(
        "JStudio",
        [
            Object(NonMatching, "JSystem/JStudio/JStudio/jstudio-control.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio/jstudio-data.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio/jstudio-math.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio/jstudio-object.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio/functionvalue.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio/fvb.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio/fvb-data.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio/fvb-data-parse.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio/object-id.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio/stb.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio/stb-data.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio/stb-data-parse.cpp"),
        ],
    ),
    JSystemLib(
        "JStudio_JStage",
        [
            Object(NonMatching, "JSystem/JStudio/JStudio_JStage/control.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-actor.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-ambientlight.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-camera.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-fog.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-light.cpp"),
        ],
    ),
    JSystemLib(
        "JStudio_JAudio",
        [
            Object(NonMatching, "JSystem/JStudio/JStudio_JAudio/control.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio_JAudio/object-sound.cpp"),
        ],
    ),
    JSystemLib(
        "JStudio_JParticle",
        [
            Object(NonMatching, "JSystem/JStudio/JStudio_JParticle/control.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio_JParticle/object-particle.cpp"),
        ],
    ),
    JSystemLib(
        "JStudio_JMessage",
        [
            Object(NonMatching, "JSystem/JStudio/JStudio_JMessage/control.cpp"),
            Object(NonMatching, "JSystem/JStudio/JStudio_JMessage/object-message.cpp"),
        ],
    ),
    JSystemLib(
        "JStudioToolLibrary",
        [
            Object(NonMatching, "JSystem/JStudio/JStudioToolLibrary/console.cpp"),
        ],
    ),
    JSystemLib(
        "JAudio",
        [
            Object(NonMatching, "JSystem/JAudio/JASCalc.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASAiCtrl.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASDvdThread.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASCallback.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASRate.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASHardStream.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASHeapCtrl.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASResArcLoader.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASProbe.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASKernelDebug.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASCmdStack.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASSystemHeap.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASNoteMgr.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASOuterParam.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASPlayer_impl.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASRegisterParam.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASSeqCtrl.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASSeqParser.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASTrack.cpp"),
            Object(Matching,    "JSystem/JAudio/JASTrackInterrupt.cpp"),
            Object(Matching,    "JSystem/JAudio/JASTrackPort.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASBank.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASWaveBank.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASBasicBank.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASBasicInst.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASDrumSet.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASBasicWaveBank.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASSimpleWaveBank.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASInstEffect.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASInstSense.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASInstRand.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASWSParser.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASBNKParser.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASWaveArcLoader.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASWaveBankMgr.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASBankMgr.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASAudioThread.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASDSPBuf.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASDSPChannel.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASDSPInterface.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASDriverIF.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASChGlobal.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASChAllocQueue.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASChannel.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASChannelMgr.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASOscillator.cpp"),
            Object(NonMatching, "JSystem/JAudio/JASDriverTables.cpp"),
            Object(NonMatching, "JSystem/JAudio/dspproc.c"),
            Object(NonMatching, "JSystem/JAudio/dsptask.c"),
            Object(NonMatching, "JSystem/JAudio/osdsp.c"),
            Object(NonMatching, "JSystem/JAudio/osdsp_task.c"),
            Object(NonMatching, "JSystem/JAudio/JAIAnimation.cpp"),
            Object(NonMatching, "JSystem/JAudio/JAIBasic.cpp"),
            Object(NonMatching, "JSystem/JAudio/JAIBankWave.cpp"),
            Object(NonMatching, "JSystem/JAudio/JAIConst.cpp"),
            Object(NonMatching, "JSystem/JAudio/JAIDummyObject.cpp"),
            Object(NonMatching, "JSystem/JAudio/JAIFx.cpp"),
            Object(NonMatching, "JSystem/JAudio/JAIGlobalParameter.cpp"),
            Object(NonMatching, "JSystem/JAudio/JAIInitData.cpp"),
            Object(NonMatching, "JSystem/JAudio/JAISeMgr.cpp"),
            Object(NonMatching, "JSystem/JAudio/JAISequenceHeap.cpp"),
            Object(NonMatching, "JSystem/JAudio/JAISequenceMgr.cpp"),
            Object(NonMatching, "JSystem/JAudio/JAISound.cpp"),
            Object(NonMatching, "JSystem/JAudio/JAISoundTable.cpp"),
            Object(NonMatching, "JSystem/JAudio/JAIStreamMgr.cpp"),
            Object(NonMatching, "JSystem/JAudio/JAISystemInterface.cpp"),
        ],
    ),
    JSystemLib(
        "JMessage",
        [
            Object(NonMatching, "JSystem/JMessage/data.cpp"),
            Object(NonMatching, "JSystem/JMessage/control.cpp"),
            Object(NonMatching, "JSystem/JMessage/processor.cpp"),
            Object(NonMatching, "JSystem/JMessage/resource.cpp"),
        ],
    ),
    DolphinLib(
        "gba",
        [
            Object(Matching,    "dolphin/gba/GBA.c"),
            Object(Matching,    "dolphin/gba/GBAGetProcessStatus.c"),
            Object(NonMatching, "dolphin/gba/GBAJoyBoot.c"),
            Object(Matching,    "dolphin/gba/GBARead.c"),
            Object(Matching,    "dolphin/gba/GBAWrite.c"),
            Object(Matching,    "dolphin/gba/GBAXfer.c"),
        ],
    ),
    JSystemLib(
        "JAZelAudio",
        [
            Object(NonMatching, "JSystem/JAZelAudio/JAIZelBasic.cpp"),
            Object(NonMatching, "JSystem/JAZelAudio/JAIZelAnime.cpp"),
            Object(NonMatching, "JSystem/JAZelAudio/JAIZelAtmos.cpp"),
            Object(NonMatching, "JSystem/JAZelAudio/JAIZelInst.cpp"),
            Object(NonMatching, "JSystem/JAZelAudio/JAIZelParam.cpp"),
            Object(NonMatching, "JSystem/JAZelAudio/JAIZelCharVoiceTable.cpp"),
            Object(NonMatching, "JSystem/JAZelAudio/JAIZelScene.cpp"),
            Object(NonMatching, "JSystem/JAZelAudio/JAIZelSound.cpp"),
        ],
    ),
    DolphinLib(
        "gf",
        [
            Object(NonMatching, "dolphin/gf/GFGeometry.cpp"),
            Object(NonMatching, "dolphin/gf/GFLight.cpp"),
            Object(NonMatching, "dolphin/gf/GFPixel.cpp"),
            Object(NonMatching, "dolphin/gf/GFTev.cpp"),
            Object(NonMatching, "dolphin/gf/GFTransform.cpp"),
        ],
    ),
    JSystemLib(
        "JKernel",
        [
            Object(Matching,    "JSystem/JKernel/JKRHeap.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRStdHeap.cpp"),
            Object(NonMatching, "JSystem/JKernel/JKRExpHeap.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRSolidHeap.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRDisposer.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRThread.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRAram.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRAramHeap.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRAramBlock.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRAramPiece.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRAramStream.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRFileLoader.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRFileFinder.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRFileCache.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRArchivePub.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRArchivePri.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRMemArchive.cpp"),
            Object(NonMatching, "JSystem/JKernel/JKRAramArchive.cpp"),
            Object(NonMatching, "JSystem/JKernel/JKRDvdArchive.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRCompArchive.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRFile.cpp"),
            Object(NonMatching, "JSystem/JKernel/JKRDvdFile.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRDvdRipper.cpp"),
            Object(NonMatching, "JSystem/JKernel/JKRDvdAramRipper.cpp"),
            Object(Matching,    "JSystem/JKernel/JKRDecomp.cpp"),
        ],
    ),
    JSystemLib(
        "JSupport",
        [
            Object(Matching,    "JSystem/JSupport/JSUList.cpp"),
            Object(Matching,    "JSystem/JSupport/JSUInputStream.cpp"),
            Object(Matching,    "JSystem/JSupport/JSUMemoryStream.cpp"),
            Object(Matching,    "JSystem/JSupport/JSUFileStream.cpp"),
        ],
    ),
    JSystemLib(
        "JGadget",
        [
            Object(NonMatching, "JSystem/JGadget/binary.cpp"),
            Object(NonMatching, "JSystem/JGadget/linklist.cpp"),
            Object(NonMatching, "JSystem/JGadget/std-vector.cpp"),
        ],
    ),
    JSystemLib(
        "JUtility",
        [
            Object(Matching,    "JSystem/JUtility/JUTCacheFont.cpp"),
            Object(Matching,    "JSystem/JUtility/JUTResource.cpp"),
            Object(Matching,    "JSystem/JUtility/JUTTexture.cpp"),
            Object(Matching,    "JSystem/JUtility/JUTPalette.cpp"),
            Object(Matching,    "JSystem/JUtility/JUTNameTab.cpp"),
            Object(Matching,    "JSystem/JUtility/JUTGraphFifo.cpp"),
            Object(Matching,    "JSystem/JUtility/JUTFont.cpp"),
            Object(Matching,    "JSystem/JUtility/JUTResFont.cpp"),
            Object(Matching,    "JSystem/JUtility/JUTDbPrint.cpp"),
            Object(NonMatching, "JSystem/JUtility/JUTGamePad.cpp"),
            Object(NonMatching, "JSystem/JUtility/JUTException.cpp"),
            Object(NonMatching, "JSystem/JUtility/JUTDirectPrint.cpp"),
            Object(Matching,    "JSystem/JUtility/JUTAssert.cpp"),
            Object(Matching,    "JSystem/JUtility/JUTVideo.cpp"),
            Object(NonMatching, "JSystem/JUtility/JUTXfb.cpp"),
            Object(Matching,    "JSystem/JUtility/JUTFader.cpp"),
            Object(NonMatching, "JSystem/JUtility/JUTProcBar.cpp"),
            Object(NonMatching, "JSystem/JUtility/JUTConsole.cpp"),
            Object(Matching,    "JSystem/JUtility/JUTDirectFile.cpp"),
            Object(Matching,    "JSystem/JUtility/JUTGba.cpp"),
            Object(NonMatching, "JSystem/JUtility/JUTFontData_Ascfont_fix12.s"),
        ],
    ),
    JSystemLib(
        "J2DGraph",
        [
            Object(Matching,    "JSystem/J2DGraph/J2DGrafContext.cpp"),
            Object(Matching,    "JSystem/J2DGraph/J2DOrthoGraph.cpp"),
            Object(NonMatching, "JSystem/J2DGraph/J2DPrint.cpp"),
            Object(Matching,    "JSystem/J2DGraph/J2DPane.cpp"),
            Object(Matching,    "JSystem/J2DGraph/J2DScreen.cpp"),
            Object(NonMatching, "JSystem/J2DGraph/J2DWindow.cpp"),
            Object(NonMatching, "JSystem/J2DGraph/J2DPicture.cpp"),
            Object(NonMatching, "JSystem/J2DGraph/J2DTextBox.cpp"),
        ],
    ),
    JSystemLib(
        "JRenderer",
        [
            Object(NonMatching, "JSystem/JRenderer/JRenderer.cpp"),
        ],
    ),
    JSystemLib(
        "J3DGraphBase",
        [
            Object(NonMatching, "JSystem/J3DGraphBase/J3DGD.cpp"),
            Object(Matching,    "JSystem/J3DGraphBase/J3DSys.cpp"),
            Object(Matching,    "JSystem/J3DGraphBase/J3DVertex.cpp"),
            Object(NonMatching, "JSystem/J3DGraphBase/J3DTransform.cpp"),
            Object(Matching,    "JSystem/J3DGraphBase/J3DPacket.cpp"),
            Object(Matching,    "JSystem/J3DGraphBase/J3DShapeMtx.cpp"),
            Object(Matching,    "JSystem/J3DGraphBase/J3DShape.cpp"),
            Object(Matching,    "JSystem/J3DGraphBase/J3DMaterial.cpp"),
            Object(NonMatching, "JSystem/J3DGraphBase/J3DMatBlock.cpp"),
            Object(NonMatching, "JSystem/J3DGraphBase/J3DTevs.cpp"),
            Object(Matching,    "JSystem/J3DGraphBase/J3DDrawBuffer.cpp"),
        ],
    ),
    JSystemLib(
        "J3DGraphAnimator",
        [
            Object(Matching,    "JSystem/J3DGraphAnimator/J3DModelData.cpp"),
            Object(NonMatching, "JSystem/J3DGraphAnimator/J3DModel.cpp"),
            Object(NonMatching, "JSystem/J3DGraphAnimator/J3DAnimation.cpp"),
            Object(Matching,    "JSystem/J3DGraphAnimator/J3DMaterialAnm.cpp"),
            Object(Matching,    "JSystem/J3DGraphAnimator/J3DVisibility.cpp"),
            Object(NonMatching, "JSystem/J3DGraphAnimator/J3DCluster.cpp"),
            Object(NonMatching, "JSystem/J3DGraphAnimator/J3DJoint.cpp"),
            Object(Matching,    "JSystem/J3DGraphAnimator/J3DNode.cpp"),
            Object(NonMatching, "JSystem/J3DGraphAnimator/J3DMaterialAttach.cpp"),
        ],
    ),
    JSystemLib(
        "J3DGraphLoader",
        [
            Object(NonMatching, "JSystem/J3DGraphLoader/J3DMaterialFactory.cpp"),
            Object(NonMatching, "JSystem/J3DGraphLoader/J3DMaterialFactory_v21.cpp"),
            Object(NonMatching, "JSystem/J3DGraphLoader/J3DClusterLoader.cpp"),
            Object(NonMatching, "JSystem/J3DGraphLoader/J3DModelLoader.cpp"),
            Object(NonMatching, "JSystem/J3DGraphLoader/J3DModelLoaderCalcSize.cpp"),
            Object(NonMatching, "JSystem/J3DGraphLoader/J3DJointFactory.cpp"),
            Object(NonMatching, "JSystem/J3DGraphLoader/J3DShapeFactory.cpp"),
            Object(NonMatching, "JSystem/J3DGraphLoader/J3DAnmLoader.cpp"),
        ],
    ),
    JSystemLib(
        "JMath",
        [
            Object(NonMatching, "JSystem/JMath/JMath.cpp"),
            Object(NonMatching, "JSystem/JMath/random.cpp"),
        ],
    ),
    DolphinLib(
        "base",
        [
            Object(NonMatching, "dolphin/base/PPCArch.c"),
        ],
    ),
    DolphinLib(
        "os",
        [
            Object(NonMatching, "dolphin/os/__start.c"),
            Object(NonMatching, "dolphin/os/OS.c"),
            Object(NonMatching, "dolphin/os/OSAlarm.c"),
            Object(NonMatching, "dolphin/os/OSAlloc.c"),
            Object(NonMatching, "dolphin/os/OSArena.c"),
            Object(NonMatching, "dolphin/os/OSAudioSystem.c"),
            Object(NonMatching, "dolphin/os/OSCache.c"),
            Object(NonMatching, "dolphin/os/OSContext.c"),
            Object(NonMatching, "dolphin/os/OSError.c"),
            Object(NonMatching, "dolphin/os/OSFont.c"),
            Object(NonMatching, "dolphin/os/OSInterrupt.c"),
            Object(NonMatching, "dolphin/os/OSLink.c"),
            Object(NonMatching, "dolphin/os/OSMessage.c"),
            Object(NonMatching, "dolphin/os/OSMemory.c"),
            Object(NonMatching, "dolphin/os/OSMutex.c"),
            Object(NonMatching, "dolphin/os/OSReboot.c"),
            Object(NonMatching, "dolphin/os/OSReset.c"),
            Object(NonMatching, "dolphin/os/OSResetSW.c"),
            Object(NonMatching, "dolphin/os/OSRtc.c"),
            Object(NonMatching, "dolphin/os/OSSync.c"),
            Object(NonMatching, "dolphin/os/OSThread.c"),
            Object(NonMatching, "dolphin/os/OSTime.c"),
            Object(NonMatching, "dolphin/os/__ppc_eabi_init.cpp"),
        ],
    ),
    DolphinLib(
        "exi",
        [
            Object(NonMatching, "dolphin/exi/EXIBios.c"),
            Object(NonMatching, "dolphin/exi/EXIUart.c"),
        ],
    ),
    DolphinLib(
        "si",
        [
            Object(NonMatching, "dolphin/si/SIBios.c"),
            Object(NonMatching, "dolphin/si/SISamplingRate.c"),
        ],
    ),
    DolphinLib(
        "db",
        [
            Object(NonMatching, "dolphin/db/db.c"),
        ],
    ),
    DolphinLib(
        "mtx",
        [
            Object(NonMatching, "dolphin/mtx/mtx.c"),
            Object(NonMatching, "dolphin/mtx/mtxvec.c"),
            Object(NonMatching, "dolphin/mtx/mtx44.c"),
            Object(NonMatching, "dolphin/mtx/vec.c"),
            Object(NonMatching, "dolphin/mtx/quat.c"),
        ],
    ),
    DolphinLib(
        "dvd",
        [
            Object(NonMatching, "dolphin/dvd/dvdlow.c"),
            Object(NonMatching, "dolphin/dvd/dvdfs.c"),
            Object(NonMatching, "dolphin/dvd/dvd.c"),
            Object(NonMatching, "dolphin/dvd/dvdqueue.c"),
            Object(NonMatching, "dolphin/dvd/dvderror.c"),
            Object(NonMatching, "dolphin/dvd/dvdidutils.c"),
            Object(NonMatching, "dolphin/dvd/dvdFatal.c"),
            Object(NonMatching, "dolphin/dvd/fstload.c"),
        ],
    ),
    DolphinLib(
        "vi",
        [
            Object(NonMatching, "dolphin/vi/vi.c"),
        ],
    ),
    DolphinLib(
        "pad",
        [
            Object(NonMatching, "dolphin/pad/Padclamp.c"),
            Object(NonMatching, "dolphin/pad/Pad.c"),
        ],
    ),
    DolphinLib(
        "ai",
        [
            Object(NonMatching, "dolphin/ai/ai.c"),
            Object(NonMatching, "dolphin/ar/ar.c"),
        ],
    ),
    DolphinLib(
        "ar",
        [
            Object(NonMatching, "dolphin/ar/arq.c"),
        ],
    ),
    DolphinLib(
        "dsp",
        [
            Object(NonMatching, "dolphin/dsp/dsp.c"),
            Object(NonMatching, "dolphin/dsp/dsp_debug.c"),
            Object(NonMatching, "dolphin/dsp/dsp_task.c"),
        ],
    ),
    DolphinLib(
        "card",
        [
            Object(NonMatching, "dolphin/card/CARDBios.c"),
            Object(NonMatching, "dolphin/card/CARDUnlock.c"),
            Object(NonMatching, "dolphin/card/CARDRdwr.c"),
            Object(NonMatching, "dolphin/card/CARDBlock.c"),
            Object(NonMatching, "dolphin/card/CARDDir.c"),
            Object(NonMatching, "dolphin/card/CARDCheck.c"),
            Object(NonMatching, "dolphin/card/CARDMount.c"),
            Object(NonMatching, "dolphin/card/CARDFormat.c"),
            Object(NonMatching, "dolphin/card/CARDOpen.c"),
            Object(NonMatching, "dolphin/card/CARDCreate.c"),
            Object(NonMatching, "dolphin/card/CARDRead.c"),
            Object(NonMatching, "dolphin/card/CARDWrite.c"),
            Object(NonMatching, "dolphin/card/CARDStat.c"),
            Object(NonMatching, "dolphin/card/CARDNet.c"),
        ],
    ),
    DolphinLib(
        "gx",
        [
            Object(NonMatching, "dolphin/gx/GXInit.c"),
            Object(NonMatching, "dolphin/gx/GXFifo.c"),
            Object(NonMatching, "dolphin/gx/GXAttr.c"),
            Object(NonMatching, "dolphin/gx/GXMisc.c"),
            Object(NonMatching, "dolphin/gx/GXGeometry.c"),
            Object(NonMatching, "dolphin/gx/GXFrameBuf.c"),
            Object(NonMatching, "dolphin/gx/GXLight.c"),
            Object(NonMatching, "dolphin/gx/GXTexture.c"),
            Object(NonMatching, "dolphin/gx/GXBump.c"),
            Object(NonMatching, "dolphin/gx/GXTev.c"),
            Object(NonMatching, "dolphin/gx/GXPixel.c"),
            Object(NonMatching, "dolphin/gx/GXStubs.c"),
            Object(NonMatching, "dolphin/gx/GXDisplayList.c"),
            Object(NonMatching, "dolphin/gx/GXTransform.c"),
            Object(NonMatching, "dolphin/gx/GXPerf.c"),
        ],
    ),
    DolphinLib(
        "gd",
        [
            Object(NonMatching, "dolphin/gd/GDBase.c"),
            Object(NonMatching, "dolphin/gd/GDGeometry.c"),
        ],
    ),
    {
        "lib": "Runtime.PPCEABI.H",
        "mw_version": "GC/1.3.2",
        "cflags": cflags_runtime,
        "host": False,
        "objects": [
            Object(NonMatching, "Runtime.PPCEABI.H/__mem.c"),
            Object(Matching,    "Runtime.PPCEABI.H/__va_arg.c"),
            Object(Matching,    "Runtime.PPCEABI.H/global_destructor_chain.c"),
            Object(Matching,    "Runtime.PPCEABI.H/CPlusLibPPC.cp"),
            Object(NonMatching, "Runtime.PPCEABI.H/NMWException.cp"),
            Object(NonMatching, "Runtime.PPCEABI.H/ptmf.c"),
            Object(NonMatching, "Runtime.PPCEABI.H/runtime.c"),
            Object(Matching,    "Runtime.PPCEABI.H/__init_cpp_exceptions.cpp"),
            Object(Matching,    "Runtime.PPCEABI.H/Gecko_ExceptionPPC.cp"),
            Object(Matching,    "Runtime.PPCEABI.H/GCN_mem_alloc.c"),
        ],
    },
    {
        "lib": "MSL_C",
        "mw_version": "GC/1.3.2",
        "cflags": cflags_runtime,
        "host": False,
        "objects": [
            Object(NonMatching, "MSL_C/MSL_Common/abort_exit.c"),
            Object(NonMatching, "MSL_C/MSL_Common/alloc.c"),
            Object(NonMatching, "MSL_C/MSL_Common/errno.c"),
            Object(NonMatching, "MSL_C/MSL_Common/ansi_files.c"),
            Object(NonMatching, "MSL_C/MSL_Common_Embedded/ansi_fp.c"),
            Object(NonMatching, "MSL_C/MSL_Common/arith.c"),
            Object(NonMatching, "MSL_C/MSL_Common/buffer_io.c"),
            Object(NonMatching, "MSL_C/MSL_Common/ctype.c"),
            Object(NonMatching, "MSL_C/MSL_Common/direct_io.c"),
            Object(NonMatching, "MSL_C/MSL_Common/file_io.c"),
            Object(NonMatching, "MSL_C/MSL_Common/FILE_POS.c"),
            Object(NonMatching, "MSL_C/MSL_Common/mbstring.c"),
            Object(NonMatching, "MSL_C/MSL_Common/mem.c"),
            Object(NonMatching, "MSL_C/MSL_Common/mem_funcs.c"),
            Object(NonMatching, "MSL_C/MSL_Common/misc_io.c"),
            Object(NonMatching, "MSL_C/MSL_Common/printf.c"),
            Object(NonMatching, "MSL_C/MSL_Common/float.c"),
            Object(NonMatching, "MSL_C/MSL_Common/scanf.c"),
            Object(NonMatching, "MSL_C/MSL_Common/string.c"),
            Object(NonMatching, "MSL_C/MSL_Common/strtoul.c"),
            Object(NonMatching, "MSL_C/MSL_Common/uart_console_io.c"),
            Object(NonMatching, "MSL_C/MSL_Common/wchar_io.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/e_acos.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/e_asin.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/e_atan2.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/e_fmod.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/e_rem_pio2.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/k_cos.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/k_rem_pio2.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/k_sin.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/k_tan.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/s_atan.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/s_copysign.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/s_cos.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/s_floor.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/s_frexp.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/s_ldexp.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/s_modf.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/s_sin.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/s_tan.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/w_acos.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/w_asin.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/w_atan2.c"),
            Object(NonMatching, "MSL_C/Math/Double_precision/w_fmod.c"),
            Object(NonMatching, "MSL_C/PPC_EABI/math_ppc.c"),
        ],
    },
    {
        "lib": "TRK_MINNOW_DOLPHIN",
        "mw_version": "GC/1.3.2",
        "cflags": cflags_runtime,
        "host": False,
        "objects": [
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/mainloop.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/nubevent.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/nubinit.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/msg.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/msgbuf.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/serpoll.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/usr_put.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/dispatch.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/msghndlr.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/support.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/mutex_TRK.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/notify.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/ppc/Generic/flush_cache.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/mem_TRK.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/ppc/Generic/targimpl.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/ppc/Export/targsupp.s"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/ppc/Generic/__exception.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/ppc/Generic/mpc_7xx_603e.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/main_TRK.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk_glue.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Os/dolphin/targcont.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/Os/dolphin/target_options.c"),
            Object(NonMatching, "TRK_MINNOW_DOLPHIN/MetroTRK/Export/mslsupp.c"),
        ],
    },
    {
        "lib": "amcstubs",
        "mw_version": "GC/1.3.2",
        "cflags": cflags_runtime,
        "host": False,
        "objects": [
            Object(NonMatching, "amcstubs/AmcExi2Stubs.c"),
        ],
    },
    {
        "lib": "OdemuExi2",
        "mw_version": "GC/1.3.2",
        "cflags": cflags_runtime,
        "host": False,
        "objects": [
            Object(NonMatching, "OdemuExi2/DebuggerDriver.c"),
        ],
    },
    {
        "lib": "odenotstub",
        "mw_version": "GC/1.3.2",
        "cflags": cflags_runtime,
        "host": False,
        "objects": [
            Object(NonMatching, "odenotstub/odenotstub.c"),
        ],
    },

    # Begin RELs
    {
        "lib": "REL",
        "mw_version": "GC/1.3.2",
        "cflags": cflags_rel,
        "host": False,
        "objects": [
            Object(Matching, "REL/executor.c"),
            Object(
                Matching,
                "REL/global_destructor_chain.c",
                source="Runtime.PPCEABI.H/global_destructor_chain.c",
            ),
        ],
    },
    Rel(Matching, "f_pc_profile_lst", "f_pc/f_pc_profile_lst.cpp"),
    ActorRel(NonMatching, "d_a_agbsw0"),
    ActorRel(Matching,    "d_a_andsw0"),
    ActorRel(Matching,    "d_a_andsw2"),
    ActorRel(NonMatching, "d_a_att"),
    ActorRel(NonMatching, "d_a_bflower"),
    ActorRel(NonMatching, "d_a_bita"),
    ActorRel(NonMatching, "d_a_branch"),
    ActorRel(NonMatching, "d_a_bridge"),
    ActorRel(NonMatching, "d_a_coming2"),
    ActorRel(NonMatching, "d_a_coming3"),
    ActorRel(NonMatching, "d_a_demo_dk"),
    ActorRel(NonMatching, "d_a_demo_kmm"),
    ActorRel(NonMatching, "d_a_door10"),
    ActorRel(NonMatching, "d_a_dr"),
    ActorRel(NonMatching, "d_a_dr2"),
    ActorRel(NonMatching, "d_a_ep"),
    ActorRel(NonMatching, "d_a_floor"),
    ActorRel(Matching,    "d_a_grass"),
    ActorRel(NonMatching, "d_a_hitobj"),
    ActorRel(NonMatching, "d_a_hot_floor"),
    ActorRel(NonMatching, "d_a_ikari"),
    ActorRel(NonMatching, "d_a_jbo"),
    ActorRel(Matching,    "d_a_kaji"),
    ActorRel(NonMatching, "d_a_kanban"),
    ActorRel(NonMatching, "d_a_ki"),
    ActorRel(NonMatching, "d_a_knob00"),
    ActorRel(NonMatching, "d_a_kui"),
    ActorRel(NonMatching, "d_a_kytag00"),
    ActorRel(NonMatching, "d_a_kytag01"),
    ActorRel(NonMatching, "d_a_kytag02"),
    ActorRel(NonMatching, "d_a_kytag03"),
    ActorRel(Matching,    "d_a_kytag04"),
    ActorRel(Matching,    "d_a_kytag05"),
    ActorRel(Matching,    "d_a_kytag06"),
    ActorRel(NonMatching, "d_a_kytag07"),
    ActorRel(NonMatching, "d_a_lamp"),
    ActorRel(NonMatching, "d_a_lod_bg"),
    ActorRel(NonMatching, "d_a_lwood"),
    ActorRel(Matching,    "d_a_magma"),
    ActorRel(NonMatching, "d_a_majuu_flag"),
    ActorRel(NonMatching, "d_a_mdoor"),
    ActorRel(NonMatching, "d_a_msw"),
    ActorRel(NonMatching, "d_a_mtoge"),
    ActorRel(NonMatching, "d_a_obj_AjavW"),
    ActorRel(Matching,    "d_a_obj_Ygush00", extra_cflags=["-sym off"]),
    ActorRel(NonMatching, "d_a_obj_akabe"),
    ActorRel(NonMatching, "d_a_obj_barrel"),
    ActorRel(NonMatching, "d_a_obj_barrel2"),
    ActorRel(NonMatching, "d_a_obj_bscurtain"),
    ActorRel(NonMatching, "d_a_obj_cafelmp"),
    ActorRel(NonMatching, "d_a_obj_coming"),
    ActorRel(NonMatching, "d_a_obj_demo_barrel"),
    ActorRel(NonMatching, "d_a_obj_doguu"),
    ActorRel(NonMatching, "d_a_obj_doguu_demo"),
    ActorRel(NonMatching, "d_a_obj_gryw00"),
    ActorRel(NonMatching, "d_a_obj_hfuck1"),
    ActorRel(Matching,    "d_a_obj_hole", extra_cflags=["-sym off"]),
    ActorRel(NonMatching, "d_a_obj_ice"),
    ActorRel(NonMatching, "d_a_obj_ikada"),
    ActorRel(NonMatching, "d_a_obj_kanat"),
    ActorRel(NonMatching, "d_a_obj_leaves"),
    ActorRel(NonMatching, "d_a_obj_lpalm"),
    ActorRel(NonMatching, "d_a_obj_monument"),
    ActorRel(NonMatching, "d_a_obj_movebox"),
    ActorRel(NonMatching, "d_a_obj_mshokki"),
    ActorRel(NonMatching, "d_a_obj_ohatch"),
    ActorRel(NonMatching, "d_a_obj_otble"),
    ActorRel(NonMatching, "d_a_obj_pbco"),
    ActorRel(NonMatching, "d_a_obj_pirateship"),
    ActorRel(NonMatching, "d_a_obj_quake"),
    ActorRel(NonMatching, "d_a_obj_rcloud"),
    ActorRel(NonMatching, "d_a_obj_roten"),
    ActorRel(NonMatching, "d_a_obj_shelf"),
    ActorRel(NonMatching, "d_a_obj_shmrgrd"),
    ActorRel(NonMatching, "d_a_obj_swpush"),
    ActorRel(NonMatching, "d_a_obj_table"),
    ActorRel(NonMatching, "d_a_obj_tenmado"),
    ActorRel(NonMatching, "d_a_obj_tide"),
    ActorRel(NonMatching, "d_a_obj_timer"),
    ActorRel(NonMatching, "d_a_obj_toripost"),
    ActorRel(NonMatching, "d_a_obj_tousekiki"),
    ActorRel(NonMatching, "d_a_obj_warpt"),
    ActorRel(NonMatching, "d_a_obj_wood"),
    ActorRel(NonMatching, "d_a_pirate_flag"),
    ActorRel(NonMatching, "d_a_race_item"),
    ActorRel(NonMatching, "d_a_rd"),
    ActorRel(Matching,    "d_a_rectangle"),
    ActorRel(NonMatching, "d_a_salvage"),
    ActorRel(NonMatching, "d_a_sbox"),
    ActorRel(NonMatching, "d_a_sk"),
    ActorRel(NonMatching, "d_a_sk2"),
    ActorRel(Matching,    "d_a_spotbox"),
    ActorRel(NonMatching, "d_a_ssk"),
    ActorRel(NonMatching, "d_a_stone"),
    ActorRel(NonMatching, "d_a_stone2"),
    ActorRel(NonMatching, "d_a_swc00"),
    ActorRel(NonMatching, "d_a_swhit0"),
    ActorRel(NonMatching, "d_a_swtdoor"),
    ActorRel(NonMatching, "d_a_tag_attention"),
    ActorRel(NonMatching, "d_a_tag_ba1"),
    ActorRel(NonMatching, "d_a_tag_event"),
    ActorRel(NonMatching, "d_a_tag_evsw"),
    ActorRel(NonMatching, "d_a_tag_ghostship"),
    ActorRel(NonMatching, "d_a_tag_hint"),
    ActorRel(Matching,    "d_a_tag_kb_item"),
    ActorRel(NonMatching, "d_a_tag_kk1"),
    ActorRel(NonMatching, "d_a_tag_light"),
    ActorRel(Matching,    "d_a_tag_msg"),
    ActorRel(NonMatching, "d_a_tag_photo"),
    ActorRel(NonMatching, "d_a_tag_waterlevel"),
    ActorRel(NonMatching, "d_a_tama"),
    ActorRel(NonMatching, "d_a_tbox"),
    ActorRel(NonMatching, "d_a_tpota"),
    ActorRel(NonMatching, "d_a_tsubo"),
    ActorRel(NonMatching, "d_a_warpdm20"),
    ActorRel(NonMatching, "d_a_warphr"),
    ActorRel(NonMatching, "d_a_wbird"),
    ActorRel(NonMatching, "d_a_ykgr"),
    ActorRel(Matching,    "d_a_alldie"),
    ActorRel(Matching,    "d_a_am", extra_cflags=["-sym off"]),
    ActorRel(NonMatching, "d_a_am2"),
    ActorRel(NonMatching, "d_a_amiprop"),
    ActorRel(NonMatching, "d_a_arrow_iceeff"),
    ActorRel(NonMatching, "d_a_arrow_lighteff"),
    ActorRel(NonMatching, "d_a_beam"),
    ActorRel(NonMatching, "d_a_boko"),
    ActorRel(NonMatching, "d_a_canon"),
    ActorRel(NonMatching, "d_a_cc"),
    ActorRel(NonMatching, "d_a_dai"),
    ActorRel(NonMatching, "d_a_demo_item"),
    ActorRel(NonMatching, "d_a_door12"),
    ActorRel(NonMatching, "d_a_fallrock"),
    ActorRel(NonMatching, "d_a_ff"),
    ActorRel(NonMatching, "d_a_gy_ctrl"),
    ActorRel(NonMatching, "d_a_himo3"),
    ActorRel(NonMatching, "d_a_hmlif"),
    ActorRel(NonMatching, "d_a_hys"),
    ActorRel(NonMatching, "d_a_kamome"),
    ActorRel(NonMatching, "d_a_kantera"),
    ActorRel(NonMatching, "d_a_kn"),
    ActorRel(NonMatching, "d_a_kokiie"),
    ActorRel(NonMatching, "d_a_ks"),
    ActorRel(NonMatching, "d_a_kt"),
    ActorRel(NonMatching, "d_a_mflft"),
    ActorRel(NonMatching, "d_a_npc_cb1"),
    ActorRel(NonMatching, "d_a_npc_md"),
    ActorRel(NonMatching, "d_a_npc_so"),
    ActorRel(NonMatching, "d_a_nzg"),
    ActorRel(NonMatching, "d_a_obj_aygr"),
    ActorRel(NonMatching, "d_a_obj_balancelift"),
    ActorRel(NonMatching, "d_a_obj_barrier"),
    ActorRel(NonMatching, "d_a_obj_bemos"),
    ActorRel(NonMatching, "d_a_obj_canon"),
    ActorRel(NonMatching, "d_a_obj_eff"),
    ActorRel(NonMatching, "d_a_obj_magmarock"),
    ActorRel(NonMatching, "d_a_obj_majyuu_door"),
    ActorRel(NonMatching, "d_a_obj_stair"),
    ActorRel(NonMatching, "d_a_obj_swflat"),
    ActorRel(NonMatching, "d_a_obj_swhammer"),
    ActorRel(NonMatching, "d_a_obj_swheavy"),
    ActorRel(NonMatching, "d_a_obj_swlight"),
    ActorRel(NonMatching, "d_a_oq"),
    ActorRel(NonMatching, "d_a_pedestal"),
    ActorRel(NonMatching, "d_a_saku"),
    ActorRel(Matching,    "d_a_seatag"),
    ActorRel(NonMatching, "d_a_shand"),
    ActorRel(NonMatching, "d_a_ship"),
    ActorRel(NonMatching, "d_a_shop_item"),
    ActorRel(NonMatching, "d_a_sie_flag"),
    ActorRel(NonMatching, "d_a_sitem"),
    ActorRel(NonMatching, "d_a_ss"),
    ActorRel(NonMatching, "d_a_sss"),
    ActorRel(NonMatching, "d_a_syan"),
    ActorRel(NonMatching, "d_a_tag_md_cb"),
    ActorRel(NonMatching, "d_a_tag_mk"),
    ActorRel(NonMatching, "d_a_tag_so"),
    ActorRel(NonMatching, "d_a_tornado"),
    ActorRel(NonMatching, "d_a_warpf"),
    ActorRel(NonMatching, "d_a_wind_tag"),
    ActorRel(NonMatching, "d_a_acorn_leaf"),
    ActorRel(NonMatching, "d_a_atdoor"),
    ActorRel(NonMatching, "d_a_auction"),
    ActorRel(NonMatching, "d_a_bb"),
    ActorRel(NonMatching, "d_a_bdk"),
    ActorRel(NonMatching, "d_a_bdkobj"),
    ActorRel(NonMatching, "d_a_bgn"),
    ActorRel(NonMatching, "d_a_bgn2"),
    ActorRel(NonMatching, "d_a_bgn3"),
    ActorRel(NonMatching, "d_a_bigelf"),
    ActorRel(NonMatching, "d_a_bk"),
    ActorRel(NonMatching, "d_a_bl"),
    ActorRel(NonMatching, "d_a_bmd"),
    ActorRel(NonMatching, "d_a_bmdfoot"),
    ActorRel(NonMatching, "d_a_bmdhand"),
    ActorRel(NonMatching, "d_a_bo"),
    ActorRel(Matching,    "d_a_boss_item"),
    ActorRel(NonMatching, "d_a_bpw"),
    ActorRel(NonMatching, "d_a_bst"),
    ActorRel(NonMatching, "d_a_btd"),
    ActorRel(NonMatching, "d_a_bwd"),
    ActorRel(NonMatching, "d_a_bwdg"),
    ActorRel(NonMatching, "d_a_bwds"),
    ActorRel(NonMatching, "d_a_daiocta"),
    ActorRel(NonMatching, "d_a_daiocta_eye"),
    ActorRel(NonMatching, "d_a_deku_item"),
    ActorRel(NonMatching, "d_a_dk"),
    ActorRel(NonMatching, "d_a_dummy"),
    ActorRel(NonMatching, "d_a_fallrock_tag"),
    ActorRel(NonMatching, "d_a_fan"),
    ActorRel(NonMatching, "d_a_fganon"),
    ActorRel(NonMatching, "d_a_fgmahou"),
    ActorRel(NonMatching, "d_a_fire"),
    ActorRel(NonMatching, "d_a_fm"),
    ActorRel(NonMatching, "d_a_gm"),
    ActorRel(NonMatching, "d_a_gnd"),
    ActorRel(NonMatching, "d_a_goal_flag"),
    ActorRel(NonMatching, "d_a_gy"),
    ActorRel(NonMatching, "d_a_icelift"),
    ActorRel(NonMatching, "d_a_kb"),
    ActorRel(NonMatching, "d_a_kddoor"),
    ActorRel(NonMatching, "d_a_kita"),
    ActorRel(NonMatching, "d_a_klft"),
    ActorRel(NonMatching, "d_a_kmon"),
    ActorRel(NonMatching, "d_a_komore"),
    ActorRel(NonMatching, "d_a_lbridge"),
    ActorRel(NonMatching, "d_a_leaflift"),
    ActorRel(NonMatching, "d_a_lstair"),
    ActorRel(NonMatching, "d_a_machine"),
    ActorRel(NonMatching, "d_a_mant"),
    ActorRel(Matching,    "d_a_mbdoor"),
    ActorRel(NonMatching, "d_a_mgameboard"),
    ActorRel(NonMatching, "d_a_mmusic"),
    ActorRel(NonMatching, "d_a_mo2"),
    ActorRel(NonMatching, "d_a_mozo"),
    ActorRel(NonMatching, "d_a_mt"),
    ActorRel(NonMatching, "d_a_npc_ac1"),
    ActorRel(NonMatching, "d_a_npc_ah"),
    ActorRel(NonMatching, "d_a_npc_aj1"),
    ActorRel(NonMatching, "d_a_npc_auction"),
    ActorRel(NonMatching, "d_a_npc_ba1"),
    ActorRel(NonMatching, "d_a_npc_bj1"),
    ActorRel(NonMatching, "d_a_npc_bm1"),
    ActorRel(NonMatching, "d_a_npc_bmcon1"),
    ActorRel(NonMatching, "d_a_npc_bms1"),
    ActorRel(NonMatching, "d_a_npc_bmsw"),
    ActorRel(NonMatching, "d_a_npc_bs1"),
    ActorRel(NonMatching, "d_a_npc_btsw"),
    ActorRel(NonMatching, "d_a_npc_btsw2"),
    ActorRel(NonMatching, "d_a_npc_co1"),
    ActorRel(NonMatching, "d_a_npc_de1"),
    ActorRel(NonMatching, "d_a_npc_ds1"),
    ActorRel(NonMatching, "d_a_npc_gk1"),
    ActorRel(NonMatching, "d_a_npc_gp1"),
    ActorRel(NonMatching, "d_a_npc_hi1"),
    ActorRel(NonMatching, "d_a_npc_ho"),
    ActorRel(NonMatching, "d_a_npc_hr"),
    ActorRel(NonMatching, "d_a_npc_jb1"),
    ActorRel(NonMatching, "d_a_npc_ji1"),
    ActorRel(NonMatching, "d_a_npc_kamome"),
    ActorRel(NonMatching, "d_a_npc_kf1"),
    ActorRel(NonMatching, "d_a_npc_kg1"),
    ActorRel(NonMatching, "d_a_npc_kg2"),
    ActorRel(NonMatching, "d_a_npc_kk1"),
    ActorRel(NonMatching, "d_a_npc_km1"),
    ActorRel(NonMatching, "d_a_npc_ko1"),
    ActorRel(NonMatching, "d_a_npc_kp1"),
    ActorRel(NonMatching, "d_a_npc_ls1"),
    ActorRel(NonMatching, "d_a_npc_mk"),
    ActorRel(NonMatching, "d_a_npc_mn"),
    ActorRel(NonMatching, "d_a_npc_mt"),
    ActorRel(NonMatching, "d_a_npc_nz"),
    ActorRel(NonMatching, "d_a_npc_ob1"),
    ActorRel(NonMatching, "d_a_npc_os"),
    ActorRel(NonMatching, "d_a_npc_p1"),
    ActorRel(NonMatching, "d_a_npc_p2"),
    ActorRel(NonMatching, "d_a_npc_people"),
    ActorRel(NonMatching, "d_a_npc_pf1"),
    ActorRel(NonMatching, "d_a_npc_photo"),
    ActorRel(NonMatching, "d_a_npc_pm1"),
    ActorRel(NonMatching, "d_a_npc_roten"),
    ActorRel(NonMatching, "d_a_npc_rsh1"),
    ActorRel(NonMatching, "d_a_npc_sarace"),
    ActorRel(NonMatching, "d_a_npc_sv"),
    ActorRel(NonMatching, "d_a_npc_tc"),
    ActorRel(NonMatching, "d_a_npc_tt"),
    ActorRel(NonMatching, "d_a_npc_uk"),
    ActorRel(NonMatching, "d_a_npc_ym1"),
    ActorRel(NonMatching, "d_a_npc_yw1"),
    ActorRel(NonMatching, "d_a_npc_zk1"),
    ActorRel(NonMatching, "d_a_npc_zl1"),
    ActorRel(NonMatching, "d_a_nz"),
    ActorRel(NonMatching, "d_a_obj_Itnak"),
    ActorRel(NonMatching, "d_a_obj_Vds"),
    ActorRel(NonMatching, "d_a_obj_Vteng"),
    ActorRel(NonMatching, "d_a_obj_YLzou"),
    ActorRel(NonMatching, "d_a_obj_Yboil"),
    ActorRel(NonMatching, "d_a_obj_adnno"),
    ActorRel(NonMatching, "d_a_obj_ajav"),
    ActorRel(NonMatching, "d_a_obj_apzl"),
    ActorRel(NonMatching, "d_a_obj_ashut"),
    ActorRel(NonMatching, "d_a_obj_auzu"),
    ActorRel(NonMatching, "d_a_obj_buoyflag"),
    ActorRel(NonMatching, "d_a_obj_buoyrace"),
    ActorRel(NonMatching, "d_a_obj_correct"),
    ActorRel(NonMatching, "d_a_obj_dmgroom"),
    ActorRel(NonMatching, "d_a_obj_dragonhead"),
    ActorRel(NonMatching, "d_a_obj_drift"),
    ActorRel(NonMatching, "d_a_obj_eayogn"),
    ActorRel(NonMatching, "d_a_obj_ebomzo"),
    ActorRel(NonMatching, "d_a_obj_ekskz"),
    ActorRel(NonMatching, "d_a_obj_eskban"),
    ActorRel(NonMatching, "d_a_obj_ferris"),
    ActorRel(NonMatching, "d_a_obj_figure"),
    ActorRel(NonMatching, "d_a_obj_firewall"),
    ActorRel(NonMatching, "d_a_obj_flame"),
    ActorRel(NonMatching, "d_a_obj_ftree"),
    ActorRel(NonMatching, "d_a_obj_ganonbed"),
    ActorRel(NonMatching, "d_a_obj_gaship"),
    ActorRel(NonMatching, "d_a_obj_gaship2"),
    ActorRel(NonMatching, "d_a_obj_gnnbtltaki"),
    ActorRel(NonMatching, "d_a_obj_gnndemotakie"),
    ActorRel(NonMatching, "d_a_obj_gnndemotakis"),
    ActorRel(NonMatching, "d_a_obj_gong"),
    ActorRel(NonMatching, "d_a_obj_gtaki"),
    ActorRel(NonMatching, "d_a_obj_hami2"),
    ActorRel(NonMatching, "d_a_obj_hami3"),
    ActorRel(NonMatching, "d_a_obj_hami4"),
    ActorRel(NonMatching, "d_a_obj_hat"),
    ActorRel(NonMatching, "d_a_obj_hbrf1"),
    ActorRel(NonMatching, "d_a_obj_hcbh"),
    ActorRel(NonMatching, "d_a_obj_hha"),
    ActorRel(NonMatching, "d_a_obj_hlift"),
    ActorRel(NonMatching, "d_a_obj_homen"),
    ActorRel(NonMatching, "d_a_obj_homensmoke"),
    ActorRel(NonMatching, "d_a_obj_hsehi1"),
    ActorRel(NonMatching, "d_a_obj_htetu1"),
    ActorRel(NonMatching, "d_a_obj_iceisland"),
    ActorRel(NonMatching, "d_a_obj_jump"),
    ActorRel(NonMatching, "d_a_obj_kanoke"),
    ActorRel(NonMatching, "d_a_obj_ladder"),
    ActorRel(NonMatching, "d_a_obj_light"),
    ActorRel(NonMatching, "d_a_obj_mkie"),
    ActorRel(NonMatching, "d_a_obj_mkiek"),
    ActorRel(NonMatching, "d_a_obj_mknjd"),
    ActorRel(NonMatching, "d_a_obj_mmrr"),
    ActorRel(NonMatching, "d_a_obj_msdan"),
    ActorRel(NonMatching, "d_a_obj_msdan2"),
    ActorRel(NonMatching, "d_a_obj_msdan_sub"),
    ActorRel(NonMatching, "d_a_obj_msdan_sub2"),
    ActorRel(NonMatching, "d_a_obj_mtest"),
    ActorRel(NonMatching, "d_a_obj_nest"),
    ActorRel(NonMatching, "d_a_obj_ojtree"),
    ActorRel(NonMatching, "d_a_obj_ospbox"),
    ActorRel(NonMatching, "d_a_obj_paper"),
    ActorRel(NonMatching, "d_a_obj_pbka"),
    ActorRel(NonMatching, "d_a_obj_pfall"),
    ActorRel(NonMatching, "d_a_obj_plant"),
    ActorRel(NonMatching, "d_a_obj_rflw"),
    ActorRel(NonMatching, "d_a_obj_rforce"),
    ActorRel(NonMatching, "d_a_obj_smplbg"),
    ActorRel(NonMatching, "d_a_obj_tapestry"),
    ActorRel(NonMatching, "d_a_obj_tntrap"),
    ActorRel(NonMatching, "d_a_obj_tower"),
    ActorRel(NonMatching, "d_a_obj_trap"),
    ActorRel(NonMatching, "d_a_obj_tribox"),
    ActorRel(NonMatching, "d_a_obj_try"),
    ActorRel(NonMatching, "d_a_obj_usovmc"),
    ActorRel(NonMatching, "d_a_obj_vfan"),
    ActorRel(NonMatching, "d_a_obj_vgnfd"),
    ActorRel(NonMatching, "d_a_obj_vmc"),
    ActorRel(NonMatching, "d_a_obj_vmsdz"),
    ActorRel(NonMatching, "d_a_obj_vmsms"),
    ActorRel(NonMatching, "d_a_obj_volcano"),
    ActorRel(NonMatching, "d_a_obj_vtil"),
    ActorRel(NonMatching, "d_a_obj_vyasi"),
    ActorRel(NonMatching, "d_a_obj_xfuta"),
    ActorRel(NonMatching, "d_a_obj_zouK"),
    ActorRel(NonMatching, "d_a_oship"),
    ActorRel(NonMatching, "d_a_ph"),
    ActorRel(NonMatching, "d_a_pt"),
    ActorRel(NonMatching, "d_a_pw"),
    ActorRel(NonMatching, "d_a_pz"),
    ActorRel(NonMatching, "d_a_sail"),
    ActorRel(NonMatching, "d_a_salvage_tbox"),
    ActorRel(Matching,    "d_a_scene_change"),
    ActorRel(NonMatching, "d_a_shutter"),
    ActorRel(NonMatching, "d_a_shutter2"),
    ActorRel(NonMatching, "d_a_st"),
    ActorRel(NonMatching, "d_a_steam_tag"),
    ActorRel(NonMatching, "d_a_swattack"),
    ActorRel(NonMatching, "d_a_switem"),
    ActorRel(NonMatching, "d_a_swpropeller"),
    ActorRel(NonMatching, "d_a_swtact"),
    ActorRel(NonMatching, "d_a_tag_etc"),
    ActorRel(NonMatching, "d_a_tag_island"),
    ActorRel(NonMatching, "d_a_tag_kf1"),
    ActorRel(Matching,    "d_a_tag_ret", extra_cflags=["-sym off"]),
    ActorRel(NonMatching, "d_a_tag_volcano"),
    ActorRel(NonMatching, "d_a_title"),
    ActorRel(NonMatching, "d_a_tn"),
    ActorRel(NonMatching, "d_a_toge"),
    ActorRel(NonMatching, "d_a_tori_flag"),
    ActorRel(NonMatching, "d_a_wall"),
    ActorRel(NonMatching, "d_a_warpfout"),
    ActorRel(NonMatching, "d_a_warpgn"),
    ActorRel(NonMatching, "d_a_warpls"),
    ActorRel(NonMatching, "d_a_warpmj"),
    ActorRel(NonMatching, "d_a_waterfall"),
    ActorRel(NonMatching, "d_a_windmill"),
    ActorRel(NonMatching, "d_a_wz"),
    ActorRel(NonMatching, "d_a_ygcwp"),
    ActorRel(NonMatching, "d_a_yougan"),
    ActorRel(NonMatching, "d_a_ghostship"),
    ActorRel(NonMatching, "d_a_movie_player"),
]

if args.mode == "configure":
    # Write build.ninja and objdiff.json
    generate_build(config)
elif args.mode == "progress":
    # Print progress and write progress.json
    config.progress_each_module = args.verbose
    calculate_progress(config)
else:
    sys.exit("Unknown mode: " + args.mode)
