automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Makefile.am for GNU ed


From: Stephen Torri
Subject: Re: Makefile.am for GNU ed
Date: Sat, 24 Apr 2004 16:53:54 -0500

On Sat, 2004-04-24 at 16:23, John Poltorak wrote:
> I tried that once but it isn't very instructive when using libraries.
> 
> I'm trying to retro-fit a Makefile.am into GNU ed for my own purposes but 
> am unsure about how to handle libs...
> 
> If I have seperate headers for a bin and a lib program should they all be 
> included under noinst_HEADERS as in:-  ?
> 
> 
> bin_SOURCES = bin_a.c bin_bf.c 
> noinst_HEADERS = bin_a.h bin_b.h
> 
> noinst_LIBRARIES = liblib.a

If you are building a library that is not installed you can use libtool
as follows:

noinst_LTLIBRARIES = libfakelib.la

You now need to tell automake whare the source files for it.

libfakelib_la_SOURCES = bin_a.c bin_bf.c

If you don't want to install the headers you do as you did above.

noinst_HEADERS = bin_a.h bin_b.h

Now if you have a binary program you do:

bin_PROGRAMS = reallyfake

reallyfake_SOURCES = soo.c foo.c rah.c
reallyfake_LDADD = -lfakelib

> 
> or should noiinst_HEADERS be split between the bin and the lib?

There is no need to distinguish between the bin and the library. In the
example above we have a library which is only used to compile reallyfake
but its not installed. We are not interested in installing the headers
so we used the 'noinst' prefix for HEADERS.

Now what if we want to allow people to use your libfakelib for creating
a application that uses it. We have to give them the C header to compile
against as well as the library. Yet we don't want to install all the
headers. Here is the example

# Notice we are not preventing the library from being installed
lib_LTLIBRARIES =  = libfakelib.la

# Same sources as before
libfakelib_la_SOURCES = bin_a.c bin_bf.c

# We don't install bin_a.h
noinst_HEADERS = bin_a.h

# We do install the bin_b.h to $(prefix)/include/fakelib
library_includedir=$(includedir)/fakelib
library_include_HEADERS = bin_b.h

# Same binary program
bin_PROGRAMS = reallyfake

# Same binary sources
reallyfake_SOURCES = soo.c foo.c rah.c
reallyfake_LDADD = -lfakelib

Stephen
-- 
Stephen Torri <address@hidden>

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]