12

Is there any way to have make use multi-threading (6 threads is ideal on my system) system-wide, instead of by just adding -j6 to the command line? So, that if I run make, it acts the same as if I was running make -j6? I want this functionality because I install a lot of packages from the AUR using pacaur (I'm on Arch), so I don't directly run the make command, but I would still like multi-threading to build packages faster.

markasoftware
  • 706
  • 2
  • 8
  • 19
  • I don't use Arch, so I don't know if it overrides settings when it builds the packages, but try setting [`MAKEFLAGS='-j 6'`](https://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html#Options_002fRecursion) before calling the install/build and see if's honored? – Jeff Schaller Mar 07 '16 at 17:40
  • see also: https://wiki.archlinux.org/index.php/Makepkg#MAKEFLAGS – Jeff Schaller Mar 07 '16 at 17:41

1 Answers1

17

(pacaur uses makepkg, see https://wiki.archlinux.org/index.php/Makepkg )

In /etc/makepkg.conf add MAKEFLAGS="-j$(expr $(nproc) \+ 1)" to run #cores + 1 compiling jobs concurrently.

When using bash you can also add export MAKEFLAGS="-j$(expr $(nproc) \+ 1)" to your ~/.bashrc to make this default for all make commands, not only those for AUR packages.