Re: Building a program from a library
Bram Moolenaar <[email protected]> Thu, 18 Dec 2003 11:50:07 +0100
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <[email protected]> |
Richard Boulton wrote:
> I have the following aap recipe:
> ---begin---
> bar.c:
> :print int main(){return 0;} >$target
> :lib baz : bar.c
> :program bar : baz
> ---end---
>
> I would expect this to build the program "bar". However, instead I get:
>
> $ aap
> Aap: Error in recipe "/data/home/richard/stuff/tmp/main.aap" line 4: Do
> not know how to make an object out of "baz"
> $
>
> I can make the recipe work by changing it to:
> ---begin---
> bar.c:
> :print int main(){return 0;} >$target
> :lib baz {filetype=object} : bar.c
> :program bar : baz
> ---end---
>
> With this latter recipe, aap creates "libbaz.a", and then links it into
> executable "bar".
>
> Can anyone explain why the attribute is neccessary, and if this is
> intentional or a bug?
It's not really a bug, merely something that's not supported yet. The
":program" command attempts to build a program by turning the sources
into object files and then linking them together. It doesn't know how
to handle a source argument that is a library.
In your case you are using a static library, type "libobject". I would
think that most linkers can use these just like an object file. But is
this true for all linkers? Perhaps some logic needs to be added to
handle the differences between linkers? Something like a list of
filetypes that a linker is able to handle.
This should be handled around line 313 in DoAddDef.py:
if in_ftype == objtype:
# The source is an object file: add it directly.
build_obj.append(si)
> Assuming it's not intentional, should there be rules somewhere (in
> default.aap perhaps?) which say how to convert a node of filetype "lib"
> to one of type "object"? Or should there be build rules for building a
> program using a "lib"? Or should it be addressed in some other way.
A workaround may be to specify a route from libobject to object that
doesn't do anything. But that's a hack.
--
hundred-and-one symptoms of being an internet addict:
44. Your friends no longer send you e-mail...they just log on to your IRC
channel.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
\\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click