[Slackbuilds-users] make -j${NUMJOBS} discussion

Slackbuilds sbo at linuxgalaxy.org
Sat Apr 9 00:22:00 UTC 2022


On 4/4/22 01:41, Jeremy Hansen wrote:
> On Sun, Apr 3, 2022, 5:44 PM Slackbuilds <sbo at linuxgalaxy.org
> <mailto:sbo at linuxgalaxy.org>> wrote:
>
...
>
>     I'm still not convinced that globally setting MAKEFLAGS won't have
>     unintended consequences. I keep seeing in the make docs that the
>     toplevel make creates/sets MAKEFILE for sub-makes, but isn't clear in
>     what happens if MAKEFILES is already set, unless upstream source adds
>     that logic.
>
>     Setting 'make -j$NUMJOBS' seems a safer path, and is what Pat does in
>     Slackware source.
>
>
> This had been discussed on LQ and it was found that make is smart enough
> to talk with its own sub-makes to ensure no more than the max number of
> jobs can take place (specifically post #23, which is mine).
>
> https://www.linuxquestions.org/questions/slackware-14/multi-thread-builds-via-sbopkg-slackbuilds-4175684827/
> <https://www.linuxquestions.org/questions/slackware-14/multi-thread-builds-via-sbopkg-slackbuilds-4175684827/>
>
> The only time it doesn't happen is if a makefile is poorly made as
> demonstrated by pan64. However, I've had a global MAKEFLAGS set with
> only what essentially sets -j17 in there since 2017 and I've never seen
> build issues from it.
>
> So, while theoretical, global MAKEFLAGS can cause issues with a poorly
> made MAKEFILE, it seems they are extremely uncommon (if they exist at all).
>
> NOTE: This is not to say we shouldn't have NUMJOBS in SlackBuilds (I
> don't really have a preference), but just to say that setting -jXX in a
> global MAKEFLAGS is unlikely to cause any issues in practice.
>
> Here's the content of my /etc/profile.d/make-exports.sh. I have it do
> the number of CPUs the kernel sees + 1 (this will include total threads,
> at least on AMD systems).
>
> export MAKEFLAGS="-j$(expr $(nproc) + 1)"
>
> Jeremy
>

Thanks. I had missed that thread.  I'll try 'export MAKEFLAGS...' here
for the VMs, leaving the script parallel agnostic, to avoid issues with
other users' environment etc. and to avoid silly conflicts with SBo admins.

-Ed




More information about the SlackBuilds-users mailing list