How to build Cmm

Cmm's build system

All executables, examples and tests are built by running GNU make in the top-level cmm directory (the directory that contains this HTML file and makefile), specifying particular targets.

Basic make commands

GNU make command Explanation
make Builds the cmm executable.
make all Builds the cmm executable.
make test Builds cmm and runs all tests. You should do this before using Cmm, to ensure that it is working correctly. I've adopted a test-first strategy with Cmm - for example, every bug I've encountered has been turned into a test.

Running individual tests

Tests can be run individually. For example, run make test5 to run test number 5. You can also run blocks of ten tests with (for example) make test30-39. See the makefile itself for details of the different tests.

Some useful tests are:

GNU make command Explanation
make test5 Checks that Cmm can parse one of its own pre-processed source files and output identical text
make test30 Builds the simple example cmm programme examples/overlap/main.cmm.
make test99 Generates statistics for looking up a dispatch using different caches - see examples/speed/main2.cmm.
make test100 Runs different configurations of the programme in file examples/speed/main.cmm.

Specifying build-type

By default, the makefile will build gcc-debug versions - compilation/linking will use gcc with the -g flag. To build a release version, add top_build=gcc-release to the make command.

Generated files

All generated files have the build-type and the host system's type embedded in their filenames. For example, the generated cmm executable from make all on my machine is cmm.gcc2.95-debug.OpenBSD-i386.exe.

Portability

The Cmm programme is written in plain C++, and should build on any reasonably up-to-date C++ development environment supporting exceptions, namespaces, streams and the Standard Library containers including std::stringstream. All the source files are in the directory cmm/.

For example, with gcc 2.95.3 or gcc 3.2, you can simply do: g++ -o cmm.exe cmm/*.cpp to create a usable cmm exectuable. The makefile provided does lots of extra things such as running tests and examples automatically, plus full header-file dependency handling.

Cmm 0.25 has been tested on OpenBSD/gcc-2.95.3, OpenBSD-3.2/gcc-3.2 and cygwin/gcc-3.2. Cmm version 0.17 is known to work under a version of Linux (Slackware) circa Jan 2003. Various versions of Cmm have been tested on Debian Linux and FreeBSD 5.1.

Problems

If you have problems, please send me details (email to jules@op59.net), and I'll try to fix them for you.