tcmod (True Code Modification) is a command line tool written in C++ and Qt 4 library, portability to all platform supported by Qt are expected. It can be run as a pre-processor for any build tool such as GNU make. GNU make is based on the last modification time of source files. On the contrary, tmc is based on the true and significative code changes. Hence, it drastically speeds up the compilation process, by not building unchanged sources files.
A true code modification is a modification that really has an incidence on compilation processes. For instance, most of source file types contain comments or indentation necessary for lisibility but useless for compilers.
In a multi platform project, some parts of the code may be hidden to a particular target by #if ... #endif directives. tcm C++ parser handles MACRO definitions to reject these parts from modification control. One interesting side effect is that if you modify a basic MACRO definition of your project, tcm quickly deduces exactly which files are to be recompiled and updates their last modification time. In a usual Makefile environment, a 'make clean' is usually required.
Another situation often occurs with cvs or subversion. Many files are simply touched or header comments are changed during a 'commit' operation. Afterwards, in a usual GNU make environment, these files are uselessly re-built.
It creates a '.tcmod.xml' file in the current directory (or the one specified by option '-C') . All files in this directory (or sub-directories with option '-r') are controlled with 'tcmod' which adds an entry for each of them in '.tcmod.xml'. This file stores the checksums of the controlled files, their times of last modification, MACROs defined and undefined in that file, and the file dependency tree.
The parser strips the source files from the non-code parts (comments, hiden parts, indentation, trailing spaces, blank lines) and calculates a checksum of the remaing parts. It keeps track of the time when the checkum was performed, hence not parsing the file again for nothing, if the file is not touched since last checksum.
First uses of this tools offer a real comfort for the developper, and it shows that the time necessary to compute the checksums for the whole dependency tree lasts less than a few tenth of seconds, far beyond the time needed for a single gcc completion.
It may be used as a pre-processor of GNU make to adjust the file modification times to the times of last significative modifications, saving some precious compilation time. Changing comments does not imply the file to be re-built. Also, the MACRO definitions are considered to decide whether a file is really changed. Currently, only C and C++ are supported.
| Example of Makefile with tcmod support |
CXX=g++
CXXFLAGS=
INCPATH=-I=.
first: tcmod helloWorld
tcmod:
@tcmod $(INCPATH)
.SUFFIXES: .o .cpp
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
clean:
rm -f *.o
helloWorld: main.o
$(CXX) -o helloWorld main.o -lstdc++
main.o: main.cpp
|
It is also possible to create a script called each time make is used:
| Patch of GNU make |
#!/bin/bash
INC=
CURDIR=.
OPT=
while [ "$1" ]; do
case "$1" in
"-C")
shift;
CURDIR=$1
OPT="$OPT -C $1"
;;
"-I") shift; INC="$INC -I=$1" ;;
"*") OPT="$OPT $1" ;;
esac
shift
done
tcmod -C $CURDIR $INC
make $OPT
|
Written in C++ and linked to Qt4, it should compile on all platforms supported by Qt 4. However, it has only been tested on a Linux Gentoo, with gcc 3.4.4.
Not yet available
tcmod uses qtbtools and QtCore library (Qt 4). The recommended compiler is certainly gcc available for all plateforms (Windows included: minGw).
| Unpacking the archive |
$ tar xvfpz tcmod-X.X.X.tar.gz $ cd tcmod-X.X.X |
A configure script creates the necessary Makefiles. Usual options for configure are available (option '--help' for details).
| Configure the installation path (Linux and Mac) |
$ ./configure -prefix $HOME |
| Configure the installation path (Windows) |
$ configure -prefix "C:\Program Files\geopsy" |
You will be prompted for the license agreement. You are ready to compile and to install the package:
| Compile and install |
$ make install |
| Date | Release | Static binary packages | Sources | Dependencies | ||
|---|---|---|---|---|---|---|
| Linux | Mac OS X | Windows | ||||
| August 16th 2005 | 1.0.0-alpha | tcmod-1.0.0-alpha.tar.gz |
QtCore (>=4.0.0) qtbtools (>=1.1.0) |
|||
Copyright (C) 2005 Marc Wathelet
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Modified June 22 2005 by Marc Wathelet