<div dir="auto"><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Sun, Apr 3, 2022, 5:44 PM Slackbuilds <<a href="mailto:sbo@linuxgalaxy.org">sbo@linuxgalaxy.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 4/3/22 11:59, B. Watson wrote:<br>
> How about you do this instead?<br>
><br>
> if [ -z "$MAKEFLAGS" ]; then<br>
>    NUMJOBS="${NUMJOBS:-1}"<br>
>    export MAKEFLAGS="-j$NUMJOBS"<br>
> fi<br>
> make<br>
><br>
> ...that way, your builds work the way you want: they respect NUMJOBS<br>
> if MAKEFLAGS isn't set... but they'll still work the way everyone else<br>
> wants: people who already use MAKEFLAGS will still get the expected<br>
> results.<br>
<br>
I'm still not convinced that globally setting MAKEFLAGS won't have<br>
unintended consequences. I keep seeing in the make docs that the<br>
toplevel make creates/sets MAKEFILE for sub-makes, but isn't clear in<br>
what happens if MAKEFILES is already set, unless upstream source adds<br>
that logic.<br>
<br>
Setting 'make -j$NUMJOBS' seems a safer path, and is what Pat does in<br>
Slackware source.<br></blockquote></div><div dir="auto"><br></div><div dir="auto">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).</div><div dir="auto"><br></div><div dir="auto"><a href="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/</a><br></div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto">So, while theoretical, global MAKEFLAGS can cause issues with a poorly made MAKEFILE, it seems they are extremely uncommon (if they exist at all).</div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto">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).</div><div dir="auto"><br></div><div dir="auto">export MAKEFLAGS="-j$(expr $(nproc) + 1)"</div><div dir="auto"><br></div><div dir="auto">Jeremy</div><div class="gmail_quote" dir="auto"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div></div>