[Buildroot] [PATCH 2/2] package/qemu: filter out long make options
Alexey Neyman
stilor at att.net
Wed Jul 21 19:46:05 UTC 2021
Since qemu started using ninja, they have the following fragment in the
Makefile:
MAKE.n = $(findstring n,$(firstword $(MAKEFLAGS)))
NINJAFLAGS = ... $(if $(MAKE.n), -n) ...
Buildroot's generated makefile in the O= directory invokes make in the
base buildroot with --no-print-directory. However, make's placement of
the --no-print-directory in MAKEFLAGS varies between the versions of
the host make; make 4.3 places that at the end while make 3.82 places
it at the beginning. As a result, if building on a system with an older
host make, qemu's makefile invokes `ninja -n` which does not generate
any outputs.
To reproduce, on a CentOS 7 machine or docker image:
mkdir /tmp/br-build && cd /tmp/br-build
make -C ~/buildroot pc_x86_64_bios_defconfig O=`pwd`
make menuconfig # Switch to glibc, enable "QEMU" and "QEMU tools"
make all # Build succeeds
find target -name qemu-img # No binary has been built
Signed-off-by: Alexey Neyman <stilor at att.net>
---
package/qemu/qemu.mk | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/package/qemu/qemu.mk b/package/qemu/qemu.mk
index 470c285f16..ee3e7c3676 100644
--- a/package/qemu/qemu.mk
+++ b/package/qemu/qemu.mk
@@ -206,14 +206,15 @@ define QEMU_CONFIGURE_CMDS
$(QEMU_OPTS)
endef
+# QEMU Makefile incorrectly interprets long options to make
define QEMU_BUILD_CMDS
unset TARGET_DIR; \
- $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
+ MAKEFLAGS="$(filter-out --%,$(MAKEFLAGS))" $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
endef
define QEMU_INSTALL_TARGET_CMDS
unset TARGET_DIR; \
- $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(QEMU_MAKE_ENV) DESTDIR=$(TARGET_DIR) install
+ MAKEFLAGS="$(filter-out --%,$(MAKEFLAGS))" $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(QEMU_MAKE_ENV) DESTDIR=$(TARGET_DIR) install
endef
$(eval $(generic-package))
--
2.27.0
More information about the buildroot
mailing list