[Top][All Lists]

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

Re: How to configure LIBOBJS

From: Ralf Wildenhues
Subject: Re: How to configure LIBOBJS
Date: Mon, 12 Jan 2004 09:40:42 +0100
User-agent: Mutt/1.4.1i

* Juliano Ravasi Ferraz wrote on Sat, Jan 10, 2004 at 11:22:16PM CET:
> I've added AC_CONFIG_LIBOBJ_DIR([lib]) to, and added the 
> needed files to lib/. Automake found them and added all to distribution 
> except for some needed header files that I had to list under noinst_HEADERS.
> The problem is that when I add @LIBOBJS@ to _LIBADD and _LDADD rules in 
> the's of src/ and util/ directories, automake fails with 
> missing files in those directories, the same files that are in the lib/ 
> directory (automake bug?).

A setup I know to work with current autotools is the following
(assuming existing files lib/getopt.c and src/foo.c):

$ cat
AC_INIT([foo], [0.1], address@hidden)
dnl Next line is just an example
AC_CONFIG_FILES([Makefile src/Makefile lib/Makefile])
$ cat
SUBDIRS = lib src
$ cat lib/
noinst_LIBRARIES = libreplace.a
libreplace_a_SOURCES =
libreplace_a_LIBADD = $(LIBOBJS)
$ cat src/
bin_PROGRAMS = foo
LDADD = ../lib/libreplace.a

A few remarks:
- You might get spurious errors because the src/Makefile does not know
how to rebuild ../lib/libreplace.a (esp. if you change the order in
SUBDIRS).  The following line in src/ should fix this (I'm
unsure if automake can be brought to cope with this on its own):

        @cd ../lib && $(MAKE) libreplace.a

- Empty libraries cause an error with ar on some systems (unicosmk is
an example).  Might have to add a dummy.c to libreplace_a_SOURCES.

More comments on this welcome.  Would an example like this be accepted
for automake documentation (given it'd be in form of a complete patch)?
This question has come up several times, I think.


reply via email to

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