Carlinho89
Carlinho89

Reputation: 167

LLVM3.8 Makefile.config, Makefile.common and Makefile.rule missing in build folder

so I'm learning about llvm and I decided to build the 3.8 from the tars that I downloaded from LLVM site.

Everything works fine and I managed to build the sources in a separate build folder.

(After downloading all the sources)
$cd llvm3.8/build
$cmake -G "Unix Makefiles" ../llvm
$make -j 4
$make install

so my dir looks a bit like this:

llvm3.8/ 
llvm3.8/build 
llvm3.8/llvm

While learning how to write a LLVM pass I noticed that my build folder is missing these files:

that I use in the Makefile I have written for the pass I've implemented.

What I know is that the source has these files:

$cd llvm3.8/llvm
$ls:
CMakeLists.txt      README.txt      llvm.spec.in
CODE_OWNERS.TXT     autoconf        projects
CREDITS.TXT         bindings        resources
LICENSE.TXT         cmake           test
LLVMBuild.txt       configure       tools
Makefile            docs            unittests
Makefile.common     examples        utils
Makefile.config.in  include
Makefile.rules      lib

while my build folder doesn't.

$ cd llvm3.8/build
$ ls 
CMakeCache.txt          cmake                   libexec
CMakeFiles              cmake_install.cmake     projects
CPackConfig.cmake       compile_commands.json   share
CPackSourceConfig.cmake docs                    test
DummyConfigureOutput    examples                tools
LLVMBuild.cmake         include                 unittests
Makefile                install_manifest.txt    utils
bin                     lib

Is my build folder containing what it is supposed to contain? Maybe the pass must be written in the sources llvm3.8/llvm?

Thanks for the help.

Upvotes: 0

Views: 378

Answers (1)

khrm
khrm

Reputation: 5753

You are suppose to write your pass in llvm/lib/Transforms/YourPassName

Create a directory in build:

mkdir -p llvm3.8/build/lib/Transforms/YourPassName

I would recommend you to use cmake. As autoconf is going to be deprecated in llvm3.9. For it:

Add entry in llvm/lib/Transforms/CMakeLists.txt

add_subdirectory(YourPassName)

After putting the entry, create CMakeLists.Txt in llvm/lib/Transforms/YourPassName like the other llvm passes.

Now use

cmake ../llvm3.8

From inside the pass directory:

make

Also if you have install llvm and want to do standalone, use the approach given in this answer: https://stackoverflow.com/a/37308946/4946286

Upvotes: 1

Related Questions