Problems with make

Dear,

I am currently working on one specific architecture. When I make changes and try to “make” it takes a very long time as It compiles all the files in the source.

My question is since I am only editing a few files in the architecture directory and some files in include directory, Can I speed up my “make” by running “make” only for a few files?
Can such changes be accommodated in the MakeFiles to get the “make” done quickly?

If you're modifying LLVM, then I'd strongly recommend that you use CMake+Ninja. On a moderately fast machine, it takes less time for me to do an incremental build with ninja after modifying a few files in the MIPS back end than it takes to do an incremental build with the autoconf / make system after modifying no files.

David

There is a way but DO NOT DO THIS! If make is rebuilding a lot of files then it is very likely it is necessary for them to be rebuilt and trying to circumvent this will lead to confusing problems.

If you want things to go faster

  • Use the -jN flag with make to build in parallel where N is the maximum number of jobs run in parallel. E.g.

$ make -j4

If that’s not fast enough…

  • Use the CMake and Ninja as the build system rather than Autoconf/make

$ cmake -G Ninja /path/to/llvm/source
$ ninja

Ninja runs in parallel by default and is non recursive.

Still not fast enough?

  • If linking seems to be a bottleneck consider using the Gold linker instead.

Still not fast enough?

  • Throw better or more hardware (distcc maybe?) at the problem.

Dan.

This could be critical if you have 4 or less GigaBytes of memory. If you run “make -j2” it makes sure that no swapping happens … mostly :slight_smile: --Armin

Dear David,

I am trying to do it with Cmake+Ninja. I was trying cmake -G ninja …/llvm/configure to configure.
But this didn’t work as the path specified wasnt a directory.

My directory structure looks like this
llvm

  • configure
  • rest
    build

I want to build llvm in my build directory. Can you please help?

Regards,
Pratik

I am trying to do it with Cmake+Ninja. I was trying cmake -G ninja …/llvm/configure to configure.
But this didn’t work as the path specified wasnt a directory.

You need to pass the path to the source directory to CMake. i.e.

$ cmake -G Ninja …/llvm

The configure script has no involvement in the configuration/building of LLVM when using CMake.

Please read the documentation on building with CMake[1] before asking further questions.

[1] http://llvm.org/docs/CMake.html#quick-start

Hi all,