From: Marc Espie Subject: Re: make: -j without params To: Janne Johansson , Christian Weisgerber , tech@openbsd.org Date: Sun, 23 Feb 2025 19:58:02 +0100 On Sun, Feb 23, 2025 at 07:52:35PM +0100, Steffen Nurpmeso wrote: > Janne Johansson wrote in > : > |Den lör 22 feb. 2025 kl 23:01 skrev Christian Weisgerber |ka.de>: > |> Steffen Nurpmeso: > |>> However, he also said > |>> Previously I recommended using a special value, such as "-j0", to mean > |>> "best guess". > |> > |> xz(1): > |> -T threads, --threads=threads > |> Specify the number of worker threads to use. Setting > |> threads to a special value 0 makes xz use up to as many > |> threads as the processor(s) on the system support. > | > |That has worked fine for me using xz and other parallel compressors, > |would work fine on make too, if it makes the option parsing simpler. > > Yes. That. > > But to say (again and hope not to bore) that > > num_online = MAX(1, sysconf(_SC_NPROCESSORS_ONLN)) > max_workers = sysconf(_SC_THREAD_THREADS_MAX) > if(max_workers < 1 || max_workers > INT_MAX / (int)sizeof(pthread_t)) > max_workers = INT_MAX / sizeof (pthread_t); I just wanted -j (nothing) to be a shorthand to "hey give me cpuonline" if it's complicated I won't pursue it further (spoilers: I have some ongoing work to manually control #jobs from outside, which has loads of applications, see my github...)