ChorusOS 4.0 Production Guide

Makefile make Targets

This section details Makefile make targets discussed in the Makefile section above.

The all Target and Component Dependency

Each component implements the <component>.all rule, which is defined in the component's Makefile.bin file. This rule tells you what other components this component is dependent upon. The <component>.all rule in the Makefile.src implements the rule, building the component in its own build directory. If this first component depends on a second component, the dependency rule

<component1>.all :: <component2>.all
is expressed in the Makefile.bin file of the first component.


Note -

If the dependency is valid only for the build process, the dependency rule is expressed in the Makefile.src file.


Update the Source Configuration

Verify that you have installed the EXAMPLES component. This source component, which contains a number of small applications, is built on top of the os and nucleus levels (See Table 1-1 for further details of component hierarchy).

The reconfigure target adds components to the initial configuration. Add the EXAMPLES component to your initial work directory, and build it as follows:

host% make  reconfigure NEWCONF='-s <src_dir>/opt/examples'
host% make

Build the Target NFS root

The root target lets you copy files from components into the root directory.

As the EXAMPLES component contains binary files that the target must see, use the make root command to copy the binary files of the EXAMPLES component into the root directory as follows:

host% make root 

The root directory now contains the binary files of the EXAMPLES component. You can run this component on a target system where this root directory can be NFS mounted.

Build a Binary Distribution

To build a binary distribution of the EXAMPLES component, run the following command:

host% make EXAMPLES.dist

This command creates a new directory in your work directory, called dist-EXAMPLES, containing the binary files of the EXAMPLES component.

You can move the component's binary files to any directory as follows:

host% mv dist-EXAMPLES ../
Use these binary files instead of the source files by using the binary option of the configure command.

Use Binary Files Instead of Source Files

To use the EXAMPLES component's binary files, you must remove the current configuration of the component. There is no specific command to achieve this. Follow these four steps:

  1. Edit the reconfigure rule at the end of the top-level Makefile by removing the following line in the source file

    -s <src_dir>/opt/examples

  2. Remove the component's build directory and run make reconfigure as shown here:

    host% rm -rf build-EXAMPLES/ 
    host% make reconfigure
    

  3. Add the application's binary files:

    host% make reconfigure NEWCONF='-b dist-EXAMPLES' 
    

  4. Run the make command and notice the output as make rebuilds files in the conf directory.

Build in Verbose Mode

Usually, compilations of an mkmk or imake component are not verbose. If you want to get the whole trace of the build, just add 'SILENT=' to the Paths file:

host% echo 'SILENT=' >> Paths

To test this modification, compile the EXAMPLES component by configuring the source files:

host% make reconfigure NEWCONF='-s /<src_dir>/opt/examples/' 

The previous command has produced another Paths files, so if you add "SILENT=" again and run the make command, you will see a more verbose output.

host% echo 'SILENT=' >> Paths
host% make

Note -

As the application binary files are already configured, the configure command will skip the binary files and choose to use the source files.


Build in Debug Mode

To debug a component, you may need to recompile it with special compilation options. To achieve this for the EXAMPLES component:

  1. Remove the component's build directory:

    host% rm -rf build-EXAMPLES
    

  2. Add 'FREMOTEDEB=ON' to the Paths file.

  3. Use the make command to recompile the component:

    host% make