automake
[Top][All Lists]
Advanced

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

Re: correct windres use


From: Brian Dessent
Subject: Re: correct windres use
Date: Thu, 03 Jul 2008 15:00:35 -0700

Vincent Torri wrote:

> .rc.o:
>          $(WINDRES) -o $@ $<
> 
> pkg_LTLIBRARIES = module.la
> 
> module_la_SOURCES = \
> evas_wince_gapi.rc \
> other_source_files
> 
> But windres is not called and evas_wince_gapi.rc is ignored.

There are roughly two problems here, mostly independent:

A. automake itself doesn't know anything about resource files, but it is
smart enough to see that if you write:

.xyz.abc:
        # rule to generate an .abc from a .xyz
...
foo_SOURCES = blah.xyz

...that it should add blah.abc to the list of dependencies for building
foo.  But this logic only applies to programs, not libraries.

B. Libtool only lets you create libtool libraries from libtool objects,
which is fair enough -- it wants control of the process.  But AFAIK
libtool has no way of creating a libtool object of a resource, unless
perhaps you play some hacky game with temporarily setting CC=windres.

(A) is the reason the object doesn't get built -- make has a rule for
how to call windres but since the corresponding resource object not
listed anywhere as a requirement, make never does anything with the
rule.  If this was not a libtool library then I think mentioning the
object in _LIBADD would be sufficient:

module_la_LIBADD = evas_wince_gapi.o

However, if you try that with a libtool library you run into (B), with
something like:

libtool: link: cannot build libtool library `module.la' from non-libtool
objects on this host: evas_wince_gapi.o

This is where it gets ugly.  You need to sneak the object in past
libtool's eyes with something like:

module_la_LDFLAGS = -Xlinker evas_wince_gapi.o

But now there's a new problem, in that automake will no longer see this
object as being a dependency of module.la, so you've got to explicitly
mention it otherwise you're back to the issue in (A) of it never being
built:

module_la_DEPENDENCIES = evas_wince_gapi.o

With those two lines I think you'll find success, but this is far from a
clean solution.  Perhaps someone that is more familiar with libtool can
comment on the issue.  From a libtool standpoint, resource objects
aren't really the same as code objects as they have no PIC-ness, and
don't even have any symbols that are referenced from other objects. 
They are just blobs of specially formatted data that get copied into the
resource section of the final image during linking.

Brian




reply via email to

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