[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make -j to Compiler Question
From: |
Warren Young |
Subject: |
Re: Make -j to Compiler Question |
Date: |
Sun, 22 Sep 2019 02:42:10 -0600 |
On Sep 21, 2019, at 9:55 PM, Nicholas Krause <address@hidden> wrote:
>
> what is the easiest way to get this info into
> the gcc frontend.
I’m not seeing that this is an Automake topic. The output of Automake is a GNU
make file, which doesn’t control how you call “make”. Automake is on the other
side of that particular wall.
My solution to the problem is entirely outside any particular build system:
https://tangentsoft.com/pidp8i/file/tools/mmake
https://tangentsoft.com/pidp8i/file/tools/corecount
The first is a wrapper for GNU or BSD make, which calls the second script to
portably determine how many cores are available here. It then builds a -j
option passing 1.5x that number, empirically determined to saturate modern
boxes’ CPUs.
I install these to a directory in the PATH somewhere.
I’ve trained myself to type “mmake” instead of “make” when I know the build
system successfully works in parallel, leaving “make” for cases where either
parallel builds don’t work or when I don’t want multiple steps happening in
parallel. I then tell my programmer’s editor to run “mmake” as the build
command instead of “make” so it runs via the editor’s shortcut for building a
program.
If you know a system where either script doesn’t run properly or needs a
portability fix, let me know and I’ll fold it into the current versions shipped
via those URLs above.