Chapter 27. Differences from make

An Aap recipe has the same structure as a Makefile. But there are many differences. The most important and unexpected ones are mentioned here.

Build if file does not exist

In a Makefile a dependency with only a target is not executed if the target exists. With Aap the build commands will be executed in more situations:

For example, this dependency is often used in a Makefile to create a symbolic link when it doesn't exist yet:

        ln -s vim gvim

The Aap recipe for this would be:

        :symlink vim gvim

When running Aap with this recipe for the first time and the "gvim" link already exists, you will get an error message.

To avoid this problem, set the buildcheck attribute to an empty string:

    gvim: {buildcheck=}
        :symlink vim gvim

Note: if the symbolic link exists but the file that it points to doesn't exist you still get an error. That's probably what you want.

Use Of Environment Variables

The "make" program uses all environment variables for variables in the Makefile. This can cause unexpected results, because you may have a large number of environment variables and some of them you didn't set yourself thus don't even know about them.

Aap does not use environment variables for recipe variables. A few environment variables are explicitly used. For example, $PATH is used to locate programs. To access an environment variable Python code must be used. The "os.environ" dictionary stores them. Example:

        Home = `os.environ.get("HOME")`

Note that some systems are case sensitive (e.g., Unix), some systems are not (e.g., MS-Windows).

Signatures Instead Of Timestamps

Make checks for outdated files by comparing timestamps. A target file is considered out-of-date when it's older than one of the source files. This means that Make will not notice a source file that was changed back to an older version. And Make has big problems when a source file has a timestamp in the future (happens when the system clock is turned back for some reason). The target will always be older, thus Make will build it every time.

The default check for Aap is to use MD5 signatures. This means a target is considered out-of-date if one of the source files is different from when this target was last build. Additionally, a signature is made for the build commands. If you change the commands that build the target it will also be considered out-of-date. Mostly this means Aap will build the target in many more situations.

If you want Aap to use timestamps like Make does, set the $DEFAULTCHECK variable to "newer". Also see the check attribute, it can be used to change the check for a specific dependency.