Hello,

Sorry for my english, but what I meant was that with this piece of text in Makefile.am :


lib_LIBRARIES = libliquidsurfaces.a
libliquidsurfaces_a_SOURCES = LiquidSurfaces.cp LiquidSurfacesPriv.h
#libliquidsurfaces_a_LIBADD = LiquidSurfaces.o
include_HEADERS = LiquidSurfaces.h



The generated Makefile has no object files, and that causes the error :


ar cru libliquidsurfaces.a
ar: no archive members specified
usage:  ar -d [-TLsv] archive file ...



with the empty file list on the ar command.

Then I tried using the _LIBADD line. If public symbols aren't required in the resulting library, what are they anyway ?



On Aug 22, 2008, at 5:10 PM, Ralf Wildenhues wrote:

Hello Daniel,

* Daniel Luis dos Santos wrote on Fri, Aug 22, 2008 at 12:34:23AM CEST:

I am trying to build a library on a leopard machine with autoconf 2.61 and automake 10.1 from mac ports. The generated makefile has no object files and
then the ar command fails with :

ar cru libliquidsurfaces.a
ar: no archive members specified
usage:  ar -d [-TLsv] archive file ...

Yep, unfortunately passing no files to 'ar cru $lib' is not portable,
besides the fact that POSIX requires you to pass at least one file.
You can add a dummy object with source containing
 static int foo;

lib_LIBRARIES = libliquidsurfaces.a
libliquidsurfaces_a_SOURCES = LiquidSurfaces.cp LiquidSurfacesPriv.h
#libliquidsurfaces_a_LIBADD = LiquidSurfaces.o
include_HEADERS = LiquidSurfaces.h

I have included the .o in the commented _LIBADD but probably that won't work
because no public symbols are put in the library file.

I don't think anybody minds if there are no public symbols (but my
memory is a bit vague here, might want to search the list archives
on this).

How can I tell in the makefile what are the names of the object files,
instead of being derived from the Sources ?

Object file names generally are an internal Automake detail, which you
should have no knowledge of. (They might be renamed in the presence of per-target compile flags.) Just listing sources in lib*_SOURCES should
get the objects compiled from those sources into the archive.

Hope that helps.

Cheers,
Ralf



Reply via email to