ViewKit Example Applications

 

The following sections describe how to build the ViewKit ObjectPak application examples.

Copying the Example Code Source Tree

Before you build the examples you will want to copy the source tree into a location that is writable by you. For example, to build the examples in /usr/src/viewkit:

% cd <$INSTALLTREE>/examples
% tar cf - . | (cd /usr/src/viewkit; tar xvf -)

where <$INSTALLTREE> is the directory where you installed ViewKit ObjectPak.

Building the Examples

All examples may be built using the imake tool or by modifying and using the supplied Makefile.noimake.

Using Imake


Note: You must install imake support for ViewKit ObjectPak to use imake.


Using Imake

To use Imake, perform the following steps:

  1. Change to the directory that contains your copy of the examples source code tree:
    % cd examples

  2. Use xmkmf to create the top-level Makefile:
    % xmkmf

    If you don't have an xmkmf command, use the imake command directly:

    % imake -DUseInstalled -DUseInstalledMotif 
    -I${X11}/config

    Note: Here, ${X11} is the directory where the X configuration files are stored. The config sub-directory holds the imake configuration files.

  3. Build the remaining Makefiles.
    % make Makefiles

  4. Build the examples tree:
    % make

    or, if you do not want to build all of the demos, you may build the subdirectories individually. For example, to build the PhoneBook example, enter:

    % cd Applications/PhoneBook
    % make

Imakefiles and Makefiles

Included with the examples are a set of Imakefiles that enable you to create Makefiles customized to your system. These files are provided for your convenience. You may need to modify several flags in the Makefiles, Imakefiles, or imake configuration files in order to build the demos correctly on your system. For further information on Imakefiles, refer to the X11R5 man pages on imake.

Using Makefile.noimake

If you did not install the ViewKit ObjectPak imake configuration files, or if your system does not have imake fully configured, you may want to use the Makefile.noimake files supplied in each of the example subdirectories. These Makefiles will need to be customized for your build environment before building any of the examples.

Customizing Makefiles

To customize the Makefiles, perform the following steps:

  1. Go to the directory which contains the example you want to build, for example, the PhoneBook demo application.
    cd examples/Applications/PhoneBook

  2. Copy Makefile.noimake to Makefile.
    % cp Makefile.noimake Makefile

  3. Edit Makefile by changing the definitions for the following:
    • Set CXX to your C++ compiler command.
    • Set VKTOP to the directory into which you installed ViewKit ObjectPak.

LOCAL_LIBRARIES contains the libraries to link the application against. You might require additional libraries depending on your platform. CXXEXTRA_INCLUDES contains any include directives required to build the application. By default, it contains only a directive for the ViewKit include files. Your platform might need additional include directives.

  1. Build the example:
    % make