test-autotools-static/README

63 lines
2.0 KiB
Plaintext
Raw Normal View History

2015-01-26 21:17:24 +01:00
# autotools-template
Template for an autotools (autoconf, automake) project
2015-02-06 20:18:20 +01:00
Introduction
============
2015-01-26 21:27:39 +01:00
2015-02-06 20:18:20 +01:00
Setting up an `Autotools` build system can be daunting. So I decided to
create a template with the basics to use as the basis for my projects.
2015-01-28 22:47:35 +01:00
2015-02-06 20:18:20 +01:00
It may be surprising to the novice that there is no `./configure` but
`./configure` is a generated file that it's shipped with the
distribution of your software (the tarball that you get `make dist`).
As such the `./configure` doesn't belong in the source control
repository. Running `autoreconf -f` will generate `./configure` and a
bunch of other files.
To build from scrath you need to perform:
2015-01-28 22:47:35 +01:00
2015-02-06 20:18:20 +01:00
autoreconf -i # Only needed if configure.ac or Makefile.am changes
./configure # generates Makefiles and config.h
make # build
make check # run the tests
2015-01-28 22:47:35 +01:00
2015-02-06 20:18:20 +01:00
I'm not an autotools expert by any means. So take my advice with a grain
of salt.
2015-01-26 21:27:39 +01:00
2015-02-06 20:18:20 +01:00
There are two input files:
2015-01-26 21:27:39 +01:00
2015-02-06 20:18:20 +01:00
* `configure.ac`: The `./configure` script will be generated from
from it. Here is were you check for libraries,
headers, etc.
* `Makefile.am`: This file will be transformed into `Makefile.in` that
`./configure` will use to generate the `Makefile`.
2015-01-28 22:47:35 +01:00
2015-02-06 20:18:20 +01:00
What to do after cloning the repository
=======================================
2015-01-28 22:47:35 +01:00
2015-02-06 20:18:20 +01:00
configure.ac
------------
Edit configure.ac to change the FULL-PACKAGE-NAME, VERSION and
BUG-REPORT-ADDRESS fields to match your project.
Makefile.am
-----------
Edit src/Makefile.am to say which "products" (executables, binaries)
will be generated and what are the source files for each one.
bin_PROGRAMS = executable1 executable2
executable1_SOURCES = sourcefile1.c sourcefile2.c
executable1_CFLAGS =
executable2_SOURCES = sourcefile3.c sourcefile4.c
executable2_CFLAGS =
2015-01-28 22:47:35 +01:00
2015-01-28 22:51:33 +01:00
Reference material
==================
Autotools: A Practitioner's Guide to GNU Autoconf, Automake, and Libtool by John Calcote
Autotools Mythbuster https://autotools.io/index.html