I didn't found the answer, but so far I have found out that LLVM is bundled with a project template containing custom automake system, which handles all the stuff the correct way.
If you want to access the template, you can find it in $LLVMSRC/projects/sample folder.