Go to the first, previous, next, last section, table of contents.

## 3.4 @command{automake}

The @command{automake} program can be used to generate ``Makefile.in'` files suitable for use with a ``configure'` script generated by @command{autoconf}. As @command{automake} requires @command{autoconf}, this section will assume the use of a ``configure'` script which uses the `AM_PATH_GIMPPRINT` macro (there is little point in not using it!).

It is highly recommeded that you use GNU @command{autoconf} and @command{automake}. They will allow you to make your software build on most platforms with most compilers. @command{automake} makes writing complex ``Makefile'` files very easy, by expressing how to build your packages in terms of what files are required to build a project and the installation locations of the files. It imposes a few limitations over using plain ``Makefile'` files, such as in the use of conditionals, but these problems are vastly outweighed by the benefits it brings. It also creates many extra targets in the generated ``Makefile.in'` files such as @command{dist}, @command{distcheck}, @command{clean}, @command{distclean}, @command{maintainer-clean} and @command{tags}, and there are many more more available. See Info file `automake', node `Top', for more information.

Because `AM_PATH_GIMPPRINT` calls `AC_SUBST` to substitute @env{GIMPPRINT_CFLAGS}, @env{GIMPPRINT_LIBS} and @env{GIMPPRINT_CONFIG}, @command{automake} will automatically set these variables in the ``Makefile.in'` files it generates, requiring no additional effort on your part!

As in previous examples, we will make a program @command{prog} from a file ``prog.c'`. This is how one might build write a ``Makefile.am'` to do this:

    AUTOMAKE_OPTIONS = 1.4 gnu
    MAINT_CHARSET = latin1

    @SET_MAKE@

    CFLAGS = @CFLAGS@

    INCLUDES = @INCLUDES@ $(GIMPPRINT_CFLAGS)

    bin_PROGRAMS = prog
    prog_SOURCES = prog.c
    prog_LDADD = $(GIMPPRINT_LIBS)

    MAINTAINERCLEANFILES = Makefile.in

That's all there is to it! Please note that this example also requires the macro `AC_PROG_MAKE_SET` to be used in ``configure.in'` and the use of `AC_SUBST` to substitute @env{CFLAGS} and @env{INCLUDES} where `@CFLAGS@` and `@INCLUDES@` are found in the file, respectively.

Go to the first, previous, next, last section, table of contents.