[CDG5] CubeE build process

Elliot Nunn elliotnunn at fastmail.com
Thu Sep 20 10:50:33 AWST 2018

> When you get the time, could you explain the mechanism used to build
> these big complicated ROMs? I think it goes Build Script ->
> Something.make (depends on build target) -> all source files ->
> vectorize -> romlink. Maybe.

Step by step...

The `:Make:Build` script is a bit crufty. Its job is essentially to run
MPW Make, gather its shell-script output, and then run that. It can also
override some defines but I steer clear of this. My EasyBuild script is
way simpler.

Here is an annotated illustration of the dep tree of the RISC makefile.
Any of the other three main makefiles will give similar results.
StandardEqu.d, a precompiled header used by most of the Asm source
files, is not shown.

I have had to reimplement Vectorize, RomLayout and RomLink based on
various snippets of information. While currently the makefiles are
modified to build these from C sources that I put in the repo, the plan
is to include them as binaries (like several other things in the Tools
folder) and keep the sources elsewhere.

This repo was supposed to produce all sorts of bit-sliced and encrypted
files for burning to a ROM or running in an emulator. I have only
bothered to get the flat-file output working (RomMondo). This file may
contain PowerPC code in resources, but it does not contain the
NanoKernel or Emulator or any of the other low-level RISC software. RISC
builds are only 3 MB.

RomMondo                                                RISC.make: this rule only has two deps
    FeatureSet                                          RISC.make: issues some Set commands
    :BuildResults:RISC:Image:RomMondo                   RISC.make: issues a RomLayout command

        :BuildResults:RISC:Rsrc:RomLayout.Rsrc          RISC.make: this is passed as arg to RomLayout
            :Make:RiscLayout.r                          RISC.make: Rez file that describes ROM size and paths to resource files below
            :Resources:RomResources.r                   Rez file #include'd by RiscLayout.r that lists ROM resources (but not MainCode/DeclData)

        :BuildResults:RISC:Rsrc:MainCode.Rsrc           MainCode.make: Link creates 'ZROM' rsrc in this file, which is referenced by RomLayout.Rsrc
            :BuildResults:RISC:Lib:MainCode.Lib         MainCode.make: Vectorize'd from several libraries:
                :BuildResults:RISC:Obj:VectorTablePatch.a.o     A special argument to Vectorize that contains the small blobs of glue

                :BuildResults:RISC:Lib:StartMgr.lib             A very generic library within MainCode (the first one)
                :BuildResults:RISC:Obj:VectorTableInit.a.o      A rather important library that inits the table that the vector glue uses
                :BuildResults:RISC:Obj:DispTable.a.o            The last library in MainCode: inits the A-trap dispatch table with ROM addresses

        :BuildResults:RISC:Rsrc:EDisk.rsrc              ROM resources: this file an example of one built from source...
        :Misc:GoNativeResources                         ...and this one is just plonked in the Misc folder...
        ...                                             ...and there are many more of both types

        :BuildResults:RISC:Rsrc:DeclData                DeclData.make: RomLink decodes the bytecode created by Rez from the source files below

More information about the cdg5 mailing list