Questions tagged [automake]

Automake is a tool provided by GNU for the purpose of automating the generation of portable, configurable Makefiles.

Automake is a tool for automatically generating Makefile.ins from files called Makefile.am. Each Makefile.am is basically a series of make variable definitions, with rules being thrown in occasionally. The generated Makefile.ins are compliant with the GNU Makefile standards.

The GNU Makefile Standards Document (see Makefile Conventions) is long, complicated, and subject to change. The goal of Automake is to remove the burden of Makefile maintenance from the back of the individual GNU maintainer (and put it on the back of the Automake maintainers).

The typical Automake input file is simply a series of variable definitions. Each such file is processed to create a Makefile.in. There should generally be one Makefile.am per directory of a project.

Automake does constrain a project in certain ways; for instance, it assumes that the project uses Autoconf (see Introduction), and enforces certain restrictions on the configure.ac contents.

For more details, take a look into automake manual

1092 questions
11
votes
6 answers

how to compile MPI and non-MPI version of the same program with automake?

I have a C++ code that can be compiled with MPI support depending on a certain preprocessor flag; missing the appropriate flag, the sources compile to a non-parallel version. I would like to setup the Makefile.am so that it compiles both…
Riccardo Murri
  • 1,045
  • 1
  • 11
  • 19
11
votes
1 answer

How to use autotools nobase and nodist prefixs together on include_HEADERS

I have some header files in a sub directory, that must be copied to a same-named sub directory in my include directory. I can use the nobase prefix to make that happen (I'm working with heimdal code, fyi): nobase_include_HEADERS = hcrypto/aes.h \ …
David Mulder
  • 7,595
  • 11
  • 45
  • 61
11
votes
1 answer

How to install a directory tree of data with automake

How can I install a directory tree of HTML files, stylesheets and images with automake without having to create Makefiles in each subdirectory? Using the following in the toplevel directory htmldir = $(docdir)/foo/html html_DATA = \ …
gbr
  • 111
  • 1
  • 3
11
votes
2 answers

How to make automake less ugly?

I recently learned how to use automake, and I'm somewhat annoyed that my compile commands went from a bunch of: g++ -O2 -Wall -c fileName.cpp To a bunch of: depbase=`echo src/Unit.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ g++ -DHAVE_CONFIG_H -I.…
Brendan Long
  • 53,280
  • 21
  • 146
  • 188
11
votes
1 answer

automake: How do I copy files to the build directory?

I am autotoolizing a library project, and this project has some example programs. I want the example programs to be distributed in the dist, but not installed. Currently the demo programs are organized like thus: src/*.cpp (library…
Steve
  • 8,153
  • 9
  • 44
  • 91
11
votes
3 answers

Should I include configure and makefile in a github repository?

We recently moved from subversion to git, and then to Github, for several open source projects. Github was nice in that it provided a lot of functionality. One of the things I particularly like is the ability to download tags as zip or .tar.gz…
vy32
  • 28,461
  • 37
  • 122
  • 246
10
votes
2 answers

How do I pass parameters to tests in an Automake input file?

In my Makefile.am, I have the following test: TESTS += tests/test1 check_PROGRAMS += tests/test1 tests_test1_SOURCES = tests/test1.c tests_test1_CPPFLAGS = ... tests_test1_LDADD = ... test1 is compiled and run when make check is invoked. How should…
Mike Kwan
  • 24,123
  • 12
  • 63
  • 96
10
votes
3 answers

is it considered good practice to have conditionals in public header files?

My C library has some optional features, and using automake, the user can turn them on and off by providing flags to configure. If a feature is turned off, that function will not be compiled. However, my question is, should I also remove the…
Steve
  • 8,153
  • 9
  • 44
  • 91
10
votes
2 answers

Avoiding recursive make install

I am building a project using autotool. Basically the project depends on several 3rd-party projects which are also managed by autotool. my_project/ my_project/3rd-party/ To enable recursive build, I add AC_CONFIG_SUBDIRS macros in my…
Jes
  • 2,614
  • 4
  • 25
  • 45
10
votes
2 answers

How to get absolute path to top build directory in autoconf configure.ac?

I am working on a project which requires a subproject which has its own makefile and configure.ac. The subproject is a program which is used to generate source files for the main project. There is an option to disable the building of this project…
crobar
  • 2,810
  • 4
  • 28
  • 46
10
votes
1 answer

GNU Autotools: rebuild without version info

I need to build a lib that is configured with autotools. The usual configure && make && make install steps produce versioned shared lib, something like libfoo.so.x.x Is it possible to modify configure.ac or Makefile.am (and of course follow up with…
pic11
  • 14,267
  • 21
  • 83
  • 119
9
votes
2 answers

Suppress "C source seen but `CC` undefined" in automake?

I have a Makefile.am for compiling Ocaml source code with ocamlbuild. However, even though I have AM_INIT_AUTOMAKE([foreign no-dependencies]) in my configure.ac, automake thinks that a C compiler must be present to install exectuables. That is, if…
Andrej Bauer
  • 2,458
  • 17
  • 26
9
votes
2 answers

Autoconf/Automake: How to avoid passing the "check" option to AC_CONFIG_SUBDIRS

I'm using Autoconf to build my c++ project. It uses third party code which is also built with the help of Autoconf/Automake. So in my configure.ac I've got the following line: AC_CONFIG_SUBDIRS([subdirectoryname]) Everything works fine, but I also…
aRestless
  • 1,825
  • 2
  • 18
  • 27
9
votes
1 answer

Hello World Library using autotools

Creating bin program is really easy using autotools I need to just define two files. `Makefile.am' bin_PROGRAMS = hello hello_SOURCES =…
Vivek Goel
  • 22,942
  • 29
  • 114
  • 186
9
votes
3 answers

How to avoid redefining VERSION, PACKAGE, etc

I haven't seen any questions relating to GNU autoconf/automake builds, but I'm hoping at least some of you out there are familiar with it. Here goes: I have a project (I'll call it myproject) that includes another project (vendor). The vendor…
Jason Day
  • 8,809
  • 1
  • 41
  • 46