[LLVMdev] Multiple directories in a single library

Dan Villiom Podlaski Christiansen
Mon, 01 Dec 2008 11:16:15 -0000

On 1 Dec 2008, at 11:42, Matthijs Kooijman wrote:

> While working on my own backend, I found that things got really
> messy real
> quickly, partly caused by the fact that all .cpp files must be in
> the same
> directory (lib/Target/TargetName). Simply putting code in different
> directories and using DIRS in the Makefile doesn't cut it, since
> that produces
> different libraries for each directory, which don't get linked in by
> the
> programs that need them.

For what it's worth, I have lib/Target compiling into one library. It
works for building dynamic libraries, but I'm having some trouble with
getting static archive builds to load targets. All subdirectories are
included, identical base names should be handled gracefully, and
compilation in a subdirectory will have all parent (sub)directories in
their header search path.

A few examples of how I did it:

<http://www.bitbucket.org/danchr/llvm/src/253dfa2dabed/lib/Target/Makefile#cl-10
 >
<http://www.bitbucket.org/danchr/llvm/src/253dfa2dabed/Makefile.config.in#cl-82
 >
<http://www.bitbucket.org/danchr/llvm/src/253dfa2dabed/Makefile.rules#cl-532
 >
<http://www.bitbucket.org/danchr/llvm/src/253dfa2dabed/Makefile.rules#cl-589
 >
<http://www.bitbucket.org/danchr/llvm/src/253dfa2dabed/Makefile.rules#cl-607
 >

(The server seems rather slow when querying individual files; sorry…)

--

Dan Villiom Podlaski Christiansen, stud. scient.
danchr at gmail.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20081201/b695b99a/attachment.html>