Please, just use automake
. You'll get proper dependency tracking, makefiles that comply with the GNU Makefile Standards (e.g., make install
does the correct thing and respects DESTDIR
and prefix
), the ability to check for system quirks as needed and support for building proper distribution tarballs.
This is a minimal configure.ac
:
-*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AM_INIT_AUTOMAKE([foreign])
# Checks for programs.
AC_PROG_CXX
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
and a minimal Makefile.am
:
## Process this file with automake to generate Makefile.in
bin_PROGRAMS = foo
foo_SOURCES = foo.cpp bar.h baz.h quux.cpp
Run autoreconf -i
to generate the configure script, followed by ./configure
and make
.
Here is an excellent autotools tutorial.