What are Makefile.am and Makefile.in?

automake, autotools, makefile

Solution

`Makefile.am` is a programmer-defined file and is used by `automake` to generate the `Makefile.in` file (the `.am` stands for automake). The `configure` script typically seen in source tarballs will use the `Makefile.in` to generate a `Makefile`.

The `configure` script itself is generated from a programmer-defined file named either `configure.ac` or `configure.in` (deprecated). I prefer `.ac` (for autoconf) since it differentiates it from the generated `Makefile.in` files and that way I can have rules such as `make dist-clean` which runs `rm -f *.in`. Since it is a generated file, it is not typically stored in a revision system such as Git, SVN, Mercurial or CVS, rather the `.ac` file would be.

Read more on GNU Autotools. Read about `make` and `Makefile` first, then learn about `automake`, `autoconf`, `libtool`, etc.

Problem

These two files are mostly seen in open source projects. What are they for, and how do they work?

Original source

Related problems