[LLVMdev] current state of building analysis passes out-of-tree with llvm-config?

John Criswell criswell at cs.uiuc.edu
Mon Oct 12 07:27:53 PDT 2009


Timo Juhani Lindfors wrote:
> Hi,
>
> what's the current state of being able to build simple analysis passes
> out-of-tree against only llvm headers and libraries with llvm-config?
>   
Have you considered using the LLVM Project templates (documented at
http://llvm.org/docs/Projects.html)?  This is the build system we use
for Automatic Pool Allocation.  It allows us to reuse all the Makefile
machinery within LLVM; we use Makefiles that are nearly identical to
those used in LLVM, and things "just work" (more or less).  I believe it
automatically uses llvm-config.

Automatic Pool Allocation is available from LLVM's SVN repository
(llvm.org/svn/llvm-project/poolalloc/trunk) if you want an example of a
project that uses this build system.  It currently builds against LLVM
2.6, but the build system is probably still compatible with LLVM mainline.

-- John T.

> I see that clang and klee do not use llvm-config but for example
> rubinius does. Should both approaches be documented?
>
> Currently for example docs/WritingAnLLVMPass.html says
>
>    "you need to create a new directory somewhere in the LLVM source
>     base."
>
> while people who only want to experiment with simple passes might feel
> more comfortable if they didn't need to create directories inside llvm
> source tree. I ended up with the following Makefile:
>
> all:
>         g++ -c -o LLVMHello.o `llvm-config --cxxflags` Hello.cpp
>         gcc -shared -Wl,-soname,LLVMHello.so -o LLVMHello.so LLVMHello.o
>
> clean:
>         rm -f LLVMHello.so LLVMHello.o
>
> (I can not use Makefile.common since it is not installed by 'make
> install')
>
> best regards,
> Timo Lindfors
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>   




More information about the llvm-dev mailing list