[Slackbuilds-users] Feature request: add $NUMJOBS to SBo build scripts

Arkadiusz Drabczyk arkadiusz at drabczyk.org
Thu Jul 25 13:40:53 UTC 2019


On 2019-07-24, Jeremy Hansen <jebrhansen at gmail.com> wrote:
> To go along with Kyle's suggestion, I set my MAKEFLAGS with a file in
> /etc/profile.d/ directory (I call it make-export.sh), so it is
> automatically applied when any user logs in.
>
> The following will set MAKEFLAGS to the number of CPU threads + 1 (it says
> cores, but Linux the number of threads the CPU is capable of as individual
> cores).
>
> jbhansen at craven-moorhead:~$ cat /etc/profile.d/make-export.sh
> #!/bin/bash
>
> # Set make jobs to default to num cores + 1
> export MAKEFLAGS="-j$(expr $(nproc) + 1)"

-j$(nproc) is very useful itself in most cases as it can speed up the
build build considerably but still I think it should be used with
caution and don't be set globally.  For example, at my current $JOB
I've worked with sloppily written Makefile written by people from
another company that did some crazy things such as extracting tarballs
and the build process failed when -j was used.  Also, a couple of
months ago I tried to build llvm with -j$(nproc) and it also failed
but I don't remember the specific reason but it was something like
this:
https://stackoverflow.com/questions/25197570/llvm-clang-compile-error-with-memory-exhausted.
-- 
Arkadiusz Drabczyk <arkadiusz at drabczyk.org>



More information about the SlackBuilds-users mailing list