Next: , Previous: Run-time Diagnostics, Up: Extending simulation


5.5 An Example

A complete example (from the test suite) is installed under:

prefix/share/hackt/doc/examples/chpsim-function/

The files contained therein are README, hello.cc, hello-test.hac, and Makefile.in.

It is very similar to the example described earlier in this chapter. To run this example (VPATH make using remote source directory), do the following:

  1. Create a new empty working directory, and enter it.

    For example, ‘mkdir play && cd play’.

  2. Copy the example's Makefile.in locally to Makefile.
  3. Edit the Makefile (instructions included therein):
    1. Point srcdir and VPATH to

      prefix/share/hackt/doc/examples/chpsim-function.

    2. Delete the other variables in the preamble (optional).
    3. Point the include line to the installed hackt-lt.mk.
    4. Set CXX to your C++ compiler.

If you run make, it will perform all the necessary compilation steps and dump a short run of the simulation to an output file hello-test.chpsimrc-out.

Another output file confirm-exec is produced to confirm that all the necessary toolchain executables are found in your PATH. Some additional clean targets are also provided.

If you want to modify the examples, the (non-VPATH) alternative is to copy the whole example directory and dispense with setting srcdir and VPATH.