Porting Run-time Code to Other Platforms

The unlimited run-time source kits include ANSI-standard source code for the base run-time libraries. This code can be used to build binary versions of the run-time libraries for other operating environments. Included with the source code is a portable makefile that can be used to build the libraries on the target platform with minimal changes. All platform-specific items are isolated in the platform.mk file in the c/build_lib or cpp/build_lib directory of the installation.

The procedure to port the run-time code to a different platform uses a Perl script to compress the necessary files and is as follows (note: this assumes common UNIX or GNU compilation utilities are in place on the target platform):

  1. Change to the scripts subdirectory in the current run-time installation.

  2. Enter the following command: "perl port_runtime.pl [rootdirname]", where "rootdirname" is the name of the root directory to be used on the target platform. If rootdirname is not specified, the default name is "runtime_port". This will result in a compressed tar.gz file (if using Linux) or zip file (if using Windows).

  3. Copy the compressed file to the target platform.

  4. Uncompress the tar.gz or zip file on the target platform. This will result in a directory tree as follows:

  5. If necessary, edit the platform.mk file in the c or cpp subdirectory and modify the compilation parameters to fit those of the compiler of the target system. In general, the following parameters will need to be adjusted:

    1. CC: C compiler executable name (i.e. gcc)

    2. CCC: C++ compiler executable name (i.e. g++)

    3. CFLAGS_: Flags that should be specified on the C or C++ command line

    4. LIBCMD: Archive executable name (i.e. ar)

  6. Invoke the makefile in the c/build_lib or cpp/build_lib subdirectory.

If the port_runtime.pl script is not available or Perl is not installed on the source system, perform the following steps to manually set up the target system build environment:

  1. Create a directory tree containing a root directory (the name does not matter) and rt*src and c/build_lib or cpp/build_lib subdirectories (note: in these definitions, * is a wildcard character indicating there are multiple directories matching this pattern, such as rtbersrc or rtxsrc). The tree should look as shown in the picture above.

  2. Copy all files from the different rt*src subdirectories from the installation to the rt*src directories on the target platform (note: if transferring from DOS to UNIX or vice-versa, FTP the files in ASCII mode to ensure lines are terminated properly).

  3. Copy the platform.* files from the c or cpp subdirectory of the installation to the corresponding subdirectory on the target platform (note: if transferring from DOS to UNIX or vice-versa, FTP the files in ASCII mode to ensure lines are terminated properly).

  4. Copy the makefile from the c/build_lib or cpp/build_lib subdirectory of the installation to the corresponding subdirectory on the target platform (note: if transferring from DOS to UNIX or vice-versa, FTP the files in ASCII mode to ensure lines are terminated properly).

  5. If necessary, edit the platform.mk file in the c or cpp subdirectory and modify the compilation parameters to fit those of the compiler of the target system. In general, the following parameters will need to be adjusted:

    1. CC: C compiler executable name (i.e. gcc)

    2. CCC: C++ compiler executable name (i.e. g++)

    3. CFLAGS_: Flags that should be specified on the C or C++ command line

    4. LIBCMD: Archive executable name (i.e. ar)

  6. Invoke the makefile in the c/build_lib or cpp/build_lib subdirectory.

If all parameters were set up correctly, the result should be binary library files created in the c/lib or cpp/lib subdirectory (note: the lib subdirectory will be created as part of the build process if not already present).