Signature Checking

Each file is associated with a signature, which is a number or string that changes if the file has changed. Makepp compares signatures to see whether it needs to rebuild anything. The default signature is the file's modification time. However, if you want you can change this to be a cryptographic checksum on the file's contents, or you can even define your own signature functions. You can also change how makepp compares signatures.

In addition to the file's signature, it is also possible to control how makepp compares these signature values. For example, the exact_match method requires that file signatures be exactly the same as on the last build, wheresa the target_newer method only requires that all dependencies be older than the target.

If makepp is building a file, and you don't think it should be, you might want to check the build log (.makepp_log). Makepp writes an explanation of what it thought each file dependended on, and why it chose to rebuild.

At present, there are three signature checking methods included in makepp.

exact_match

This method uses the modification dates on the file as signatures. It rebuilds the targets unless all of the following conditions are true:

Makepp stores all the signature information and the build command from the last build, so that it can do these comparisons.

This is makepp's default algorithm unless it is trying to rebuild a makefile. This is a highly reliable way of ensuring correct builds, and is almost always what you want. However, it does have a few side effects that may be surprising:

target_newer

Rebuilds only if the target is newer than all of its dependencies. The dependencies may change their time stamp, but as long as they are older than the target, the target is not rebuilt. The target is also not rebuilt even if the command or the architecture has changed. (This is the signature method that the traditional make uses.)

This is makepp's default algorithm if it is trying to build the makefile before reading it in. (It loads the makefile and checks for a rule within the makefile to rebuild itself, and if such a rule is present and the makefile needs rebuilding, it is rebuild and then reread.) This is because it is common to modify a makefile using commands that are not under the control of makepp, e.g., running a configure procedure. Thus makepp doesn't insist that the last modification to the makefile be made by itself.

c_compilation_md5

This is the same as exact_match, except that signatures for files which look like C or C++ source files are computed by an MD5 checksum of the file, ignoring comments and whitespace. Ordinary file times are still used for signatures for object files, or any files that don't have an extension typical of a C or C++ source file. (A file is considered to be source code if it has an extension of c, h, cc, hh, cxx, hxx, hpp, cpp, h++, c++, moc, or upper case versions of these.) If you use this, you can reindent your code or add or change comments without triggering a rebuild.

This method is particularly useful for the following situations:

This is the default signature method for C or C++ compilation if you have the following line somewhere in your makefile:

include c_compilation_md5.mk

Without the above statement, this method is not available at all for build commands in that makefile. (You must put this statement in each makefile that has a compilation command.) If you want to use an explicit :signature c_compilation_md5 clause, then the above statement must be before the rule containing the clause.

This method is not included by default because (a) it's slightly slower than checking file times; (b) not everyone has the appropriate perl module (Digest::MD5) to do the signature calculation.

Custom methods

You can, if you want, define your own methods for calculating file signatures and comparing them. You will need to write a perl module to do this. Have a look at the comments in Signature.pm in the distribution, and also at the existing signature algorithms in Signature/*.pm for details.


Table of contents | Next (makefile syntax) | Previous (tutorial)
Last modified: Sat Oct 14 22:40:59 PDT 2000