On 5/25/2026 8:46 AM, Pierrick Bouvier wrote:
> On 5/23/2026 1:56 AM, Alex Bennée wrote:
>> Pierrick Bouvier <[email protected]> writes:
>>
>>> On 5/22/2026 12:02 PM, Alex Bennée wrote:
>>>> Pierrick Bouvier <[email protected]> writes:
>>>>
>>>>> On 5/21/2026 6:17 AM, Alex Bennée wrote:
>>>>>> Explicitly set the appropriate QEMU binary as a dependency so we can
>>>>>> ensure they get built. This is especially important for MacOS which
>>>>>> otherwise only builds the unsigned binaries on a normal "make all"
>>>>>> run.
>>>>>>
>>>>>
>>>>> I'm not sure to see why it matters. tcg-tests don't make use of hvf, so
>>>>> unsigned binaries are plenty for it.
>>>>>
>>>>> Which other binary is this building that is not built by default?
>>>>>
>>>>> In general, if something is not included in "all" target, let's make
>>>>> sure it's included there (meson.build?) instead of adding a workaround
>>>>> here. Not only tests benefit this, but anyone doing a build on a
>>>>> platform that might have optional binaries not built by default.
>>>>
>>>> If you have a suggestion on how to make that work I'm all ears.
>>>>
>>>
>>> I would be happy to help, but I don't understand what the goal is. I
>>> have three questions that should help to provide a suggestion.
>>>
>>> Which exact test command do you run?
>>
>> make check-tcg
>>
>>>
>>> ```
>>> Explicitly set the appropriate QEMU binary as a dependency so we can
>>> ensure they get built.
>>> ```
>>> Aren't they built by all?
>>
>> Apparently not.
>>
>>> It seems to be a dependency, at least for check-tcg:
>>> .ninja-goals.check-tcg = all test-plugins
>>>
>>> ```
>>> This is especially important for MacOS which otherwise only builds the
>>> unsigned binaries on a normal "make all" run.
>>> ```
>>> Why do you need signed binaries for testing on MacOS (hvf?)?
>>
>> In a previous iteration I made configure spit out the unsigned binaries
>> to config-target.mak but the request was to fix the dependencies
>> instead.
>>
>> It all works on Linux so I'm not sure why MacOS is being so weird
>> because the meson emulators target mechanism should be the same.
>>
>
> Just tried now, and it does not work on Linux neither (make check-tcg
> does not build any target beyond tests). Maybe you forgot to clean your
> folder?
>
The root issue is that tests/Makefile.include is included *after*
evaluation of ninja-targets in main Makefile. Thus,
.ninja-goals.check-tcg is ignored.
The fix is to move ninja-targets evaluation to the end of main Makefile,
which introduce the expected dependency for check-tcg to "all
test-plugins" targets.
You can replace current patch with the one attached to this email.
Regards,
Pierrick
From ffc418f1ade427e3ab4648d97af37888f424baa7 Mon Sep 17 00:00:00 2001
From: Pierrick Bouvier <[email protected]>
Date: Mon, 25 May 2026 10:09:56 -0700
Subject: [PATCH] Makefile: move ninja-targets evaluation to end of file
Alex found that make check-tcg was not correctly building qemu binaries.
The problem was that ./tests/Makefile.include is included *after*
evaluating ninja-targets. Thus, .ninja-goals.check-tcg was ignored.
To fix this and avoid mistakes in the future, just move the
ninja-targets evaluation at end of main Makefile.
Signed-off-by: Pierrick Bouvier <[email protected]>
---
Makefile | 88 +++++++++++++++++++++++++++++---------------------------
1 file changed, 45 insertions(+), 43 deletions(-)
diff --git a/Makefile b/Makefile
index 54547a37b1a..5e00bc090fc 100644
--- a/Makefile
+++ b/Makefile
@@ -135,49 +135,6 @@ $(SRC_PATH)/scripts/meson-buildoptions.sh:
$(SRC_PATH)/meson_options.txt $(SRC_P
scripts/meson-buildoptions.py > [email protected] && mv [email protected] $@
endif
-# 4. Rules to bridge to other makefiles
-
-ifneq ($(NINJA),)
-# Filter out long options to avoid flags like --no-print-directory which
-# may result in false positive match for MAKE.n
-MAKE.n = $(findstring n,$(firstword $(filter-out --%,$(MAKEFLAGS))))
-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, \
- $(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))
-
-makefile-targets := build.ninja ctags TAGS cscope dist clean
-# "ninja -t targets" also lists all prerequisites. If build system
-# files are marked as PHONY, however, Make will always try to execute
-# "ninja build.ninja".
-ninja-targets := $(filter-out $(build-files) $(makefile-targets),
$(ninja-targets))
-.PHONY: $(ninja-targets) run-ninja
-$(ninja-targets): run-ninja
-
-# Use "| cat" to give Ninja a more "make-y" output. Use "+" to bypass the
-# --output-sync line.
-run-ninja: config-host.mak
-ifneq ($(filter $(ninja-targets), $(ninja-cmd-goals)),)
- +$(if $(MAKE.nq),@:,$(quiet-@)$(NINJA) $(NINJAFLAGS) \
- $(sort $(filter $(ninja-targets), $(ninja-cmd-goals))) | cat)
-endif
-endif
-
-else # config-host.mak does not exist
-ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if
$(MAKECMDGOALS),,fail))
-$(error Please call configure before running make)
-endif
-endif # config-host.mak does not exist
-
SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet)
include $(SRC_PATH)/tests/Makefile.include
@@ -337,3 +294,48 @@ endif
print-%:
@echo '$*=$($*)'
+
+######################################################################
+
+# 4. Rules to bridge to other makefiles
+
+ifneq ($(NINJA),)
+# Filter out long options to avoid flags like --no-print-directory which
+# may result in false positive match for MAKE.n
+MAKE.n = $(findstring n,$(firstword $(filter-out --%,$(MAKEFLAGS))))
+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, \
+ $(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))
+
+makefile-targets := build.ninja ctags TAGS cscope dist clean
+# "ninja -t targets" also lists all prerequisites. If build system
+# files are marked as PHONY, however, Make will always try to execute
+# "ninja build.ninja".
+ninja-targets := $(filter-out $(build-files) $(makefile-targets),
$(ninja-targets))
+.PHONY: $(ninja-targets) run-ninja
+$(ninja-targets): run-ninja
+
+# Use "| cat" to give Ninja a more "make-y" output. Use "+" to bypass the
+# --output-sync line.
+run-ninja: config-host.mak
+ifneq ($(filter $(ninja-targets), $(ninja-cmd-goals)),)
+ +$(if $(MAKE.nq),@:,$(quiet-@)$(NINJA) $(NINJAFLAGS) \
+ $(sort $(filter $(ninja-targets), $(ninja-cmd-goals))) | cat)
+endif
+endif
+
+else # config-host.mak does not exist
+ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if
$(MAKECMDGOALS),,fail))
+$(error Please call configure before running make)
+endif
+endif # config-host.mak does not exist
--
2.43.0