6.5. Programs and Libraries

The preceding primaries have all been relatively easy to use. Now the discussion turns to a more complicated set, namely those used to build programs and libraries. These primaries are more complex because building a program is more complex than building a script (which often doesn't even need building at all).

Use the PROGRAMS primary for programs, LIBRARIES for libraries, and LTLIBRARIES for Libtool libraries (see Chapter 9, "Introducing GNU Libtool" ). Here is a minimal example:

bin_PROGRAMS = doit

This creates the program doit and arranges to install it in bindir. First make compiles 'doit.c' to produce 'doit.o'. Then it links 'doit.o' to create 'doit'.

Of course, if you have more than one source file, and most ...

Get GNU Autoconf, Automake, and Libtool now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.