[Slackbuilds-users] make -j${NUMJOBS} discussion
B. Watson
urchlay at slackware.uk
Sun Apr 3 18:59:04 UTC 2022
On Sun, 3 Apr 2022, Slackbuilds wrote:
> Therefore, I will be adding back in to all the buildscripts under my
> care, for those that can support it:
>
> NUMJOBS=${NUMJOBS:-1}
> make -j${NUMJOBS}
There's no need for this. You can just 'export MAKEFLAGS=-j8' or
whatever in your environment. A lot of users already do this... but
read on:
> For compatibility, the default will be one core/thread.
This is going to pose a problem for people who already use MAKEFLAGS
and never heard of your NUMJOBS variable. If I have MAKEFLAGS=-j8,
I expect everything to use it (unless it's forced to -j1). If I'm
running one of your builds that overrides that with NUMJOBS defaulting
to 1, I get a long slow build (which is what you and I are both trying
to avoid).
How about you do this instead?
if [ -z "$MAKEFLAGS" ]; then
NUMJOBS="${NUMJOBS:-1}"
export MAKEFLAGS="-j$NUMJOBS"
fi
make
...that way, your builds work the way you want: they respect NUMJOBS
if MAKEFLAGS isn't set... but they'll still work the way everyone else
wants: people who already use MAKEFLAGS will still get the expected
results.
> It is easy enough to force 'make -j1' as needed for the few that need it.
We already do this, when needed. Looks like we have 162 builds that
have "make -j1", which is around 2% of the total.
More information about the SlackBuilds-users
mailing list