use Clang's API in llvm project

I have a similar question except am a little further along than Neng.

My github project ( follows the llvm
project template. There is a problem linking with clang libraries in
this configuration. If we assign USEDLIBS (as the clang/examples do)
then make detects a dependency issue (the exact failure is on another
machine but I can provide the log if need be).

I've also tried overriding LIBS with the clang libraries but in this
case the link step fails with unresolved llvm symbols in clang

The only way I have found to successfully link with clang is to
re-order the '-l' options such that clang libraries appear before
llvm. I only tried this because I noticed that
'clang/examples/clang-interpreter' does the same thing. It seems that
llvm has special treatment for USEDLIBS on the link line.

Thanks for any suggestions,