# Multi-Target Umake files

A Top-level Umakefil defines sub-targets in the module with the statement:

    MultiTargetMake("target1", "target2", ...)

In addition to this, you can optionally call UseCommonObjects() before the MutiTargetMake() call. UseCommonObjects() is a optimization hint which tells Umake it can use object files which may have been compiled by one of the other targets instead of compiling a separate copy. This can only be used if you are sure the objects from the two targets are compiled identically. This means the same defines, include paths, etc.

    TODO: add something to multi-target specification to define what platforms
          a target builds on; the problem with this is we will have
          platform/target determination in two locations, the BIF file and
          the Umakefil which isn't good either

Instead of listing *.pcf files in the Umakefil, the new MultiTargetMake acts more like single target Umake. Let's review how single target Umake works for a target. When Umake is invoked, a series of .pcf files are executed, ending with the Umakefil itself. The .pcf files are determined by the platform Umake is being run on. Under linux-2.0-libc6-i386, the following files would be executed, if they exist:

1. unix.pcf
2. linux.pcf
3. linux2.pcf
4. Umakefil

The old multi-target make syntax made it impossible to emulate this .pcf file execution behavior for sub-targets. This is now fixed. MultiTargetMake("target1", "target2") would exec the following .pcf files:

1. unix.pcf
2. target1_unix.pcf
3. linux2.pcf
4. target1_linux2.pcf
5. all.pcf
6. target1
7. unix.pcf
8. target2_unix.pcf
9. linux2.pcf
10. target2_linux2.pcf
11. all.pcf
12. target2

Remember these files are not mandatory -- the are only executed if they are there.

You no longer have to list out the .pcf files for execution. The .pcf file names are the same as those used in single-target Umake, except for the targetname_ prepended to them. Notice the single-target .pcf files are also executed for each target. This is a mechanism for keeping platform data global to all the targets in one place.

The new "all.pcf" file is executes for all sub-targets, no matter what platform you are on. It's there to help keep only a single copy of data which otherwise may have to be replicated in both the "target1" and "target2" umake files.

If you want to want to know what files will be executed for a particular platform, look in the build/umake/*.cf files. Near the top of the file, there's a line:

    platform.pcf_prefix_list = [ ... ]

This lists the .pcf file execution in the correct order. There are no problems adding to this list for a particular platform. For example, the linux-2.0-libc6-i386 platform has:

    platform.pcf_prefix_list = ['unix', 'linux2']

It may make be necessary to add "linux-i386" to all Linux/i386 platforms to include some set of assembly objects.