How to build Cmm

1 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.

2 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.

3 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.

4 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.

5 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.

6 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. The main source files are in the directory cmm/, with some utility code in the directory utils/.

For example, with gcc 2.95.3 or gcc 3.2, you can simply do: g++ -o cmm.exe cmm/*.cpp utils/*.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.26 has been tested on OpenBSD/gcc-2.95.3, OpenBSD-3.2/gcc-3.2 and cygwin/gcc-3.2.

Cmm version 0.17 worked under a version of Linux (Slackware) circa Jan 2003 and various versions of Cmm have been tested on Debian Linux and FreeBSD 5.1.

7 Other build commands

These are for building add-hierprof in the cmm2 directory:

gmake add-hierprof -s top_build=gcc-debug

These are for building/running a profiled cmm, using the add-hierprof command generated above:

gmake cmm top_build=gcc-release-hierprof top_debug= -s 2>&1|more

gmake testdir/test20.OpenBSD3.3-i386.cmm.ii-gcc2.95.3-release.OpenBSD3.3-i386.cmm

time ./cmm.gcc2.95.3-release-hierprof.OpenBSD3.3-i386.exe -errorlevel 000 -parsefile testdir/test20.OpenBSD3.3-i386.cmm.ii-gcc2.95.3-release.OpenBSD3.3-i386.cmm 2>hpout

8 Problems

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