../../../Makefile.common:60:../../../Makefile.config:don't have that file or directory

I installed LLVM3.7.0 according to the LLVM document. I can use “clang”,"LLVM-dis"commands ,and so on.
but when I execute commad “make” at llvm/lib/Transform/Hello directory, the error is :
…/…/…/Makefile.common:60:…/…/…/Makefile.config:don’t have that file or directory

…/…/…/Makefile.common:68:…/…/…/Makefile.rules:don’t have that file or directory

why?
can anyone help me?

LLVM's Makefiles aren't meant to be used in isolation. You'll probably
find LLVMHello.so was already built and installed as part of the
normal build process. If you change the source, you'd rebuild it by
running make from the overall build directory.

Alternatively, for passes you often only needusually only need to use
something as simple as"clang `llvm-config --cxxflags --libs --ldflags`
-fno-rtti llvm/lib/Transforms/Hello/Hello.cpp -shared -o Hello.so".

Cheers.

Tim.

Hi,

I installed LLVM3.7.0 according to the LLVM document. I can use
"clang","LLVM-dis"commands ,and so on.
but when I execute commad "make" at llvm/lib/Transform/Hello directory, the
error is :
../../../Makefile.common:60:../../../Makefile.config:don't have that file or
directory
../../../Makefile.common:68:../../../Makefile.rules:don't have that file or
directory

why?
can anyone help me?

You can't build LLVM/clang inside its source tree like that. The
makefile in Hello
includes Makefile.common, which includes Makefile.config;
that file doesn't exist inside the "llvm" tree.

To build clang, you need to create a separate directory where to build.
For example, in the llvm directory:

mkdir ../build
cd ../build
../llvm/configure '--enable-optimized' '--enable-assertions'

This will create Makefile.config (among other things) and shadow the
directories in llvm under build,
so there will be a build/lib/Transforms/Hello directory. You can
run make there.

Note: This might not work if you only installed binaries and headers for LLVM.
I have all the sources from LLVM, and clang insde it.

Note: You might want to use cmake instead of autoconf.
cmake also needs a separate build directory.

Csaba

There is a quick summary of the recommended way to build LLVM using CMake here:

http://llvm.org/docs/GettingStarted.html#getting-started-quickly-a-summary

The autoconf/makefile-based build system is not recommended for people new to the community as we are working on phasing it out.

-Chris