util/kconfig: Fix xconfig

The QT based xconfig util is broken for several reasons.

1. On systems with qt6 (which is a majority on modern distros),
the qconf-cfg.sh script appends a c++17 flag to the output file,
which makes the value of $(HOSTCXXFLAGS_qconf.o) - a multiline string.
This causes problem during compiler invocation, thus we can observe:
  'g++: fatal error: no input files'
Flattening the HOSTCXXFLAGS_ with $strip function resolves the problem

2. The missing Qt's Meta-Object file "qconf-moc.cc",
which should be autogenerated during build by invoking "moc" tool.
The current set of recipes in Makefile.mk aren't triggering
the moc generation. Explicitly adding "qconf-moc.o" target,
with dependency on "qconf-moc.cc" resolves the problem.

3. "$(call if_changed,moc)" used to invoke "moc" tool isn't working,
due to missing "if_changed" macro.
Replace it with direct call to "cmd_moc" in "Makefile.real".
Bringing the full implementation of "if_changed" seem to be impractical,
as it uses too many dependent functions and macros.

BUG=https://ticket.coreboot.org/issues/518

Change-Id: I7eb1e71aeb6a92b8d3c194a369bd3bd6dc708863
Signed-off-by: Dmytro Aleksandrov <alkersan@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89006
Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Dmytro Aleksandrov 2025-08-31 18:05:20 -04:00 committed by Matt DeVillier
commit bdbe8b9b6f

View file

@ -20,6 +20,7 @@ $(objk)/Makefile.real: $(dir $(lastword $(MAKEFILE_LIST)))Makefile
-e "s,\$$(srctree)/arch/\$$(SRCARCH)/configs/\$$(KBUILD_DEFCONFIG),\$$(KBUILD_DEFCONFIG)," \
-e "s,--defconfig=arch/\$$(SRCARCH)/configs/\$$(KBUILD_DEFCONFIG),--defconfig=\$$(KBUILD_DEFCONFIG)," \
-e "/^unexport CONFIG_$$/d" \
-e "s/if_changed,moc/cmd_moc/g" \
$< > $@.tmp
mv $@.tmp $@
@ -57,16 +58,16 @@ FORCE:
filechk=$< > $@
$(objk)/%.o: $(srck)/%.c
$(HOSTCC) -I $(srck) -I $(objk) -c $(HOSTCFLAGS_$(notdir $@)) -o $@ $<
$(HOSTCC) -I $(srck) -I $(objk) -c $(strip $(HOSTCFLAGS_$(notdir $@))) -o $@ $<
$(objk)/%.o: $(srck)/%.cc
$(HOSTCXX) -I $(srck) -I $(objk) -c $(HOSTCXXFLAGS_$(notdir $@)) -o $@ $<
$(HOSTCXX) -I $(srck) -I $(objk) -c $(strip $(HOSTCXXFLAGS_$(notdir $@))) -o $@ $<
$(objk)/%.o: $(objk)/%.c
$(HOSTCC) -I $(srck) -I $(objk) -c -o $@ $<
$(objk)/%.moc: $(srck)/%.h | $(objk)/qconf-cfg
$(call cmd_moc)
$(objk)/qconf-moc.o: $(objk)/qconf-moc.cc
$(HOSTCXX) -I $(srck) -I $(objk) -c $(strip $(HOSTCXXFLAGS_$(notdir $@))) -o $@ $<
define hostprogs_template
# $1 entry in hostprogs