TrMake System Documentation

Table of contents


TrMake (for transparent make) is a modularized makefile system designed for multi-platform C++ development in Unix environment with GNU make (v3.80 or higher). Its main features are:


Download the latest version of TrMake with sample makefile settings and several example projects. You can also download from the SourceForge repository.

User guide

Workspace directory structure

The directory structure for a workspace is as follows:

All the other directories are created upon need:

Make commands

The make commands are executed at the top-level directory containing the makefile. When invoked with some target, TrMake invokes make PROJECT=xxx for each project on the same target. Thus, one can specify the PROJECT variable to make in order to work on just the given project.

The following targets are supported:

Note that CXXFLAGS, CFLAGS and LDFLAGS are appended to rather than defined, so it is possible to customize them via environment variables or the makefile.

File extensions

The assumed extensions for source files are:

The implied extensions for auto-generated sources:

Example projects tutorial

The distributed package includes some example projects:

  1. libprinter: a library which can print "Hello!"...

  2. user: an application using the library above to print "Hello!"...

  3. compr: an old Qt application for image compression :)

In the sample makefile, we see that the Universal settings section configures the build for linux / gcc / x86amd platform. You can change these to suit your development environment. In addition, you can add compr to EXCLUDE_PROJECTS if you don't have Qt installed, or if the QTDIR environment variable is not set.

As well, full debugging level is enabled (DEBUG = 2), and profiling is disabled. Note that unless DEBUG is set to 0, the user project will automatically locate the libprinter shared object when invoked from the top-level directory (where makefile resides).

Next comes the Inter-project dependencies section, where dependencies between final targets of the projects are defined. As written in the comments, these dependencies influence both projects build order (e.g., in case of parallel builds), and target relinking due to other projects' results updates. Therefore, real target file names should be used, with .so / .a suffixes where necessary.

The last section is Per-project settings, where a lot of variables can be defined in per-project subsections. For example, if you want to build the libprinter project as a static library, add STATIC = 1 to customize.libprinter (and update the library filename in the Inter-project dependencies section).

You can now build the projects, by just invoking make or, e.g., make -j 3. I suggest that you familiarize yourself with other targets, described in the Make commands section above. Try, e.g., make doc if you have Doxygen installed. (Remember that GNU make version 3.80 or newer is required.)

Intel Compiler allows for good support of profiling and code coverage. If it is installed on your workstation, set SUITE = intel, and try (probably after disabling the compr project):

  1. make PROFILE=2 to build projects which generate profiling information;

  2. Invoke the user executable couple of times;

  3. make PROFILE=1 to build projects using the generated profiling information;

  4. make cov to generate code coverage documentation.

To see the actual commands executed by make, use the TRACE variable, e.g., make TRACE=1 ...

Implementation documentation

Modules directory structure

TrMake has the following modules directory structure:

Adding new implicit rules

Suppose that the sources directory has a new file type .tr, which is transformed to C++ header and source files using the special transmogrify preprocessor.

The following settings should then be added to the modules to facilitate automatic handling of .tr files:

Adding new compiler / linker definitions

To support a new compiler, add a file to mk/suites/, e.g., mk/suites/ The mk/ loader lists the requirements from such a file, which can be modeled after mk/suites/ Users can then specify SUITE = watcom in the makefile.

Similarly, to support a new linker, add a file to mk/linkers/, e.g., mk/suites/ The mk/ loader lists the requirements from such a file, which can be modeled after mk/linkers/ Users can then specify OS = aix in the makefile.


  1. GNU make Manual

  2. How to Write Shared Libraries, by Ulrich Drepper

  3. C++ compiler manuals:

  4. Linker manuals:

  5. Other tools:

  6. Other GNU make-based systems:


This is TrMake version 1.0, a transparent make system.
Copyright © 2000–2006 Michael Orlov.

TrMake is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2.