* [PATCH] Makefile: preserve --jobserver-auth argument when calling ninja
@ 2024-04-02 8:17 Martin Hundebøll
2024-04-08 8:05 ` Paolo Bonzini
2024-04-12 11:52 ` Fiona Ebner
0 siblings, 2 replies; 4+ messages in thread
From: Martin Hundebøll @ 2024-04-02 8:17 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, Paolo Bonzini, Martin Hundebøll
Qemu wraps its call to ninja in a Makefile. Since ninja, as opposed to
make, utilizes all CPU cores by default, the qemu Makefile translates
the absense of a `-jN` argument into `-j1`. This breaks jobserver
functionality, so update the -jN mangling to take the --jobserver-auth
argument into considerationa too.
Signed-off-by: Martin Hundebøll <martin@geanix.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 8f36990335..183756018f 100644
--- a/Makefile
+++ b/Makefile
@@ -142,7 +142,7 @@ MAKE.k = $(findstring k,$(firstword $(filter-out --%,$(MAKEFLAGS))))
MAKE.q = $(findstring q,$(firstword $(filter-out --%,$(MAKEFLAGS))))
MAKE.nq = $(if $(word 2, $(MAKE.n) $(MAKE.q)),nq)
NINJAFLAGS = $(if $V,-v) $(if $(MAKE.n), -n) $(if $(MAKE.k), -k0) \
- $(filter-out -j, $(lastword -j1 $(filter -l% -j%, $(MAKEFLAGS)))) \
+ $(or $(filter -l% -j%, $(MAKEFLAGS)), $(if $(filter --jobserver-auth=%, $(MAKEFLAGS)),, -j1)) \
-d keepdepfile
ninja-cmd-goals = $(or $(MAKECMDGOALS), all)
ninja-cmd-goals += $(foreach g, $(MAKECMDGOALS), $(.ninja-goals.$g))
--
2.44.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Makefile: preserve --jobserver-auth argument when calling ninja
2024-04-02 8:17 [PATCH] Makefile: preserve --jobserver-auth argument when calling ninja Martin Hundebøll
@ 2024-04-08 8:05 ` Paolo Bonzini
2024-04-12 11:52 ` Fiona Ebner
1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2024-04-08 8:05 UTC (permalink / raw)
To: Martin Hundebøll; +Cc: qemu-devel, qemu-trivial
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Makefile: preserve --jobserver-auth argument when calling ninja
2024-04-02 8:17 [PATCH] Makefile: preserve --jobserver-auth argument when calling ninja Martin Hundebøll
2024-04-08 8:05 ` Paolo Bonzini
@ 2024-04-12 11:52 ` Fiona Ebner
2024-04-12 11:53 ` Paolo Bonzini
1 sibling, 1 reply; 4+ messages in thread
From: Fiona Ebner @ 2024-04-12 11:52 UTC (permalink / raw)
To: Martin Hundebøll, qemu-devel; +Cc: qemu-trivial, Paolo Bonzini
Am 02.04.24 um 10:17 schrieb Martin Hundebøll:
> Qemu wraps its call to ninja in a Makefile. Since ninja, as opposed to
> make, utilizes all CPU cores by default, the qemu Makefile translates
> the absense of a `-jN` argument into `-j1`. This breaks jobserver
> functionality, so update the -jN mangling to take the --jobserver-auth
> argument into considerationa too.
>
> Signed-off-by: Martin Hundebøll <martin@geanix.com>
> ---
> Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 8f36990335..183756018f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -142,7 +142,7 @@ MAKE.k = $(findstring k,$(firstword $(filter-out --%,$(MAKEFLAGS))))
> MAKE.q = $(findstring q,$(firstword $(filter-out --%,$(MAKEFLAGS))))
> MAKE.nq = $(if $(word 2, $(MAKE.n) $(MAKE.q)),nq)
> NINJAFLAGS = $(if $V,-v) $(if $(MAKE.n), -n) $(if $(MAKE.k), -k0) \
> - $(filter-out -j, $(lastword -j1 $(filter -l% -j%, $(MAKEFLAGS)))) \
> + $(or $(filter -l% -j%, $(MAKEFLAGS)), $(if $(filter --jobserver-auth=%, $(MAKEFLAGS)),, -j1)) \
> -d keepdepfile
> ninja-cmd-goals = $(or $(MAKECMDGOALS), all)
> ninja-cmd-goals += $(foreach g, $(MAKECMDGOALS), $(.ninja-goals.$g))
Hi,
unfortunately, this patch breaks build when specifying just '-j' as a
make flag (i.e. without a number), because it will now end up being
passed to ninja:
> $ make -j
> changing dir to build for make ""...
> make[1]: Entering directory '/home/febner/repos/qemu/build'
> ninja: fatal: invalid -j parameter
Best Regards,
Fiona
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Makefile: preserve --jobserver-auth argument when calling ninja
2024-04-12 11:52 ` Fiona Ebner
@ 2024-04-12 11:53 ` Paolo Bonzini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2024-04-12 11:53 UTC (permalink / raw)
To: Fiona Ebner; +Cc: Martin Hundebøll, qemu-devel, qemu-trivial
On Fri, Apr 12, 2024 at 1:52 PM Fiona Ebner <f.ebner@proxmox.com> wrote:
>
> Am 02.04.24 um 10:17 schrieb Martin Hundebøll:
> > Qemu wraps its call to ninja in a Makefile. Since ninja, as opposed to
> > make, utilizes all CPU cores by default, the qemu Makefile translates
> > the absense of a `-jN` argument into `-j1`. This breaks jobserver
> > functionality, so update the -jN mangling to take the --jobserver-auth
> > argument into considerationa too.
> >
> > Signed-off-by: Martin Hundebøll <martin@geanix.com>
> > ---
> > Makefile | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index 8f36990335..183756018f 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -142,7 +142,7 @@ MAKE.k = $(findstring k,$(firstword $(filter-out --%,$(MAKEFLAGS))))
> > MAKE.q = $(findstring q,$(firstword $(filter-out --%,$(MAKEFLAGS))))
> > MAKE.nq = $(if $(word 2, $(MAKE.n) $(MAKE.q)),nq)
> > NINJAFLAGS = $(if $V,-v) $(if $(MAKE.n), -n) $(if $(MAKE.k), -k0) \
> > - $(filter-out -j, $(lastword -j1 $(filter -l% -j%, $(MAKEFLAGS)))) \
> > + $(or $(filter -l% -j%, $(MAKEFLAGS)), $(if $(filter --jobserver-auth=%, $(MAKEFLAGS)),, -j1)) \
> > -d keepdepfile
> > ninja-cmd-goals = $(or $(MAKECMDGOALS), all)
> > ninja-cmd-goals += $(foreach g, $(MAKECMDGOALS), $(.ninja-goals.$g))
>
> Hi,
>
> unfortunately, this patch breaks build when specifying just '-j' as a
> make flag (i.e. without a number), because it will now end up being
> passed to ninja:
Yep, I've sent a pull request with the fix.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-12 11:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-02 8:17 [PATCH] Makefile: preserve --jobserver-auth argument when calling ninja Martin Hundebøll
2024-04-08 8:05 ` Paolo Bonzini
2024-04-12 11:52 ` Fiona Ebner
2024-04-12 11:53 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).