Next: , Previous: , Up: GNU Automake   [Index]


15 When Automake Isn’t Enough

Sometimes automake isn’t enough. Then you just lose.

Actually, automakes implicit copying semantics means that many problems can be worked around by simply adding some make targets and rules to Makefile.in. automake will ignore these additions.

There are some caveats to doing this. Although you can overload a target already used by automake, it is often inadvisable, particularly in the topmost directory of a non-flat package. However, various useful targets have a ‘-local’ version you can specify in your Makefile.in. Automake will supplement the standard target with these user-supplied targets.

The targets that support a local version are all, info, dvi, check, install-data, install-exec, and uninstall.

For instance, here is how to install a file in /etc:

install-data-local:
        $(INSTALL_DATA) $(srcdir)/afile /etc/afile

Some targets also have a way to run another target, called a hook, after their work is done. The hook is named after the principal target, with ‘-hook’ appended. The targets allowing hooks are install-data, install-exec, and dist.

For instance, here is how to create a hard link to an installed program:

install-exec-hook:
        $(LN) $(bindir)/program $(bindir)/proglink