# Building program executables

To build the executable for the nms303tool and nmsv5tool, NMS recommends using the provided makefiles. Use the nmake utility to build the executable under Windows or the gmake utility to build the executable under UNIX.

Before you can compile the nms303tool or nmsv5tool program executables, you must perform the following tasks:

Step | Action
1 | Build the Access303, Exchange303, or AV5 library.
2 | Add the location of the 303rdt library (for the Access303 stack), 303idt library (for the Exchange303 stack), or the v5an library (for the AV5 stack) to the LIB system environment variable. This is necessary so that the linker can create an executable.

Build the nms303tool and nmsv5tool executables under Windows by entering the following:

To build this utility... | Enter the following command...
nms303tool for Access303 | nmake [AZTEKROOT_RDT=path]
nms303tool for Exchange303 | nmake [AZTEKROOT_IDT=path]
nmsv5tool for AV5 | nmake [AZTEKROOT=path]

where path provides the directory path to the root directory of the Aztek protocol stack. The demonstration program makefiles use the AZTEKROOT variable to find the Access303, Exchange303, or AV5 header files needed to compile the integration portion of the demonstration program code.

## Example 1: Building nms303tool as a standalone program

To build a nms303tool executable for use with CG boards under Windows, compile a Windows standalone version of the nms303tool executable by entering:

nmake

To build an nms303tool executable for use with CG boards under UNIX:

Step | Action
1 | Set the Lib environment variable to include the directory where the Access303 stack library (303rdt) resides (in this case /opt/nms/dlcp/access303/coreimage), by entering the following: setenv LIB /opt/nms/dlcp/access303/coreimage:$LIB%
2 | Compile a UNIX standalone version of the nms303tool executable by entering: gmake

## Example 2: Building nmsv5tool as an integrated program

To build an nmsv5tool executable that is integrated with the AV5 stack under Windows, enter the following command:

nmake AZTEKROOT=d:\nms\dlcp\an5

In this example, the AV5 library (v5an) resides in the d:\nms\dlcp\an5 directory.

To build an nmsv5tool executable that is integrated with the AV5 stack and can be used with CG boards under UNIX, enter the following command:

gmake AZTEKROOT=/opt/nms/dlcp/an5

In this example, the AV5 library (v5an) resides in the /opt/nms/dlcp/an5 directory.