Re: Re: Autodetect processing units with -j
wrotycz <[email protected]> Wed, 02 Jul 2025 00:03:34 +0200
| Newsgroups | gmane.comp.gnu.make.bugs |
|---|---|
| Message-ID | <[email protected]> |
See the last 5 paragraphs, starting with: The MAKEFLAGS variable can also be useful if you want to have certain options, such as ‘-k’ (see Summary of Options), set each time you run make. Tried to get what the `MAKEFLAGS' is but documentation, not manual is not very helpful. Info is better. I read it and still didn't get that as it seemed somewhat complex if not convoluted. So I made a Makefile and this variable is neither simple nor easy, ~~~ $ cat << EOF > Makefile all: @echo MAKEFLAGS=$(MAKEFLAGS) EOF $ make -n -k -j echo MAKEFLAGS=nkj $ make -n -k -j CC=gcc echo MAKEFLAGS=nkj -- CC=gcc $ make -n -k -j3 echo MAKEFLAGS=nk --jobserver-fds=3,4 -j ~~~ > If one wants to add a default value because they know it will always > work with their system they can easily add this to their ~/.profile: > export GNUMAKEFLAGS="$((2 * `nproc`))" Don't like it. Why would one want to 'taint' `.profile' or any other such 'intimate' file? I would rather see it in ~/.config/gmake.conf or similar (name; in $XDG_CONFIG_HOME), where it was intended to control this particular program (here make), rather than pytting anything in `.profile'. And it would be much easier if it looked like this: ~~~ echo -n -k -j3 > ~/.config/gmake.conf $ make echo MAKEFLAGS=-n -k -j3 ~~~ where that would be prepended to command line resulting in control of 'default' command line options and overwriting them with command line itself. ~~~ echo -n -k -j3 > ~/.config/gmake.conf $ make -j4 echo MAKEFLAGS=-n -k -j4 ~~~ That's still just a prostethics for autodetect. Speaking of autodetect, with big compilations, like compiler or binutils or similar, I don't use -j$(nproc), specially -j$((`nproc`*2)) as too many times it become unresponsive and without free thead couldn't even be tamed. Since few slaps like that I use -j$((`nproc`-1)) even for a cost of slight slow down, as it's still less (cost/time) than rebooting system. Still I use it only when expect to be long session, longer than few minutes, but that's OK - with rare cases like that I can spend two seconds typing more. PS. Make's git repo could be helpful - make a branch with the feature and let it to be tested. This way you can gather useful information from users and be prepared to easy merge in case it's accepted.