[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
3.4 automake
The automake
program can be used to generate ‘Makefile.in’ files
suitable for use with a ‘configure’ script generated by
autoconf
. As automake
requires 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 autoconf
and
automake
. They will allow you to make your software build on most
platforms with most compilers. 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 dist
,
distcheck
, clean
, distclean
,
maintainer-clean
and tags
, and there are many more more
available. See GNU automake: (automake)Top, for more information.
Because AM_PATH_GIMPPRINT
calls AC_SUBST
to substitute
GIMPPRINT_CFLAGS
, GIMPPRINT_LIBS
and GIMPPRINT_CONFIG
,
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 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 CFLAGS
and INCLUDES
where
@CFLAGS@
and @INCLUDES@
are found in the file, respectively.