[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2 Write Makefile.am

You must write the file `Makefile.am'. This is an automake input file, and the automake manual describes in detail what this file should look like.

The automake commands in `Makefile.am' mostly look like variable assignments in a `Makefile'. automake recognizes special variable names, and automatically add make rules to the output as needed.

There will be one `Makefile.am' file for each directory in your package. For each directory with subdirectories, the `Makefile.am' file should contain the line
 
SUBDIRS = dir dir ...
where each dir is the name of a subdirectory.

For each `Makefile.am', there should be a corresponding `Makefile' in the `AC_OUTPUT' macro in `configure.in'.

Every `Makefile.am' written at Cygnus should contain the line
 
AUTOMAKE_OPTIONS = cygnus
This puts automake into Cygnus mode. See the automake manual for details.

You may to include the version number of `automake' that you are using on the `AUTOMAKE_OPTIONS' line. For example,
 
AUTOMAKE_OPTIONS = cygnus 1.3
This will prevent users from running an earlier version of `automake' and perhaps getting an invalid `Makefile.in'.

If your package builds a program, then in the directory where that program is built you will normally want a line like
 
bin_PROGRAMS = program
where program is the name of the program. You will then want a line like
 
program_SOURCES = file file ...
where each file is the name of a source file to link into the program (e.g., `foo.c').

If your package builds a library, and you do not want the library to ever be built as a shared library, then in the directory where that library is built you will normally want a line like
 
lib_LIBRARIES = libname.a
where `libname.a' is the name of the library. You will then want a line like
 
libname_a_SOURCES = file file ...
where each file is the name of a source file to add to the library.

If your package builds a library, and you want to permit building the library as a shared library, then in the directory where that library is built you will normally want a line like
 
lib_LTLIBRARIES = libname.la
The use of `LTLIBRARIES', and the `.la' extension, indicate a library to be built using libtool. As usual, you will then want a line like
 
libname_la_SOURCES = file file ...

The strings `bin' and `lib' that appear above in `bin_PROGRAMS' and `lib_LIBRARIES' are not arbitrary. They refer to particular directories, which may be set by the `--bindir' and `--libdir' options to `configure'. If those options are not used, the default values are based on the `--prefix' or `--exec-prefix' options to `configure'. It is possible to use other names if the program or library should be installed in some other directory.

The `Makefile.am' file may also contain almost anything that may appear in a normal `Makefile'. automake also supports many other special variables, as well as conditionals.

See the automake manual for more information.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by system on December, 2 2004 using texi2html