Dmytro has uploaded this change for review.

View Change

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>
---
M util/kconfig/Makefile.mk
1 file changed, 5 insertions(+), 4 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/89006/1
diff --git a/util/kconfig/Makefile.mk b/util/kconfig/Makefile.mk
index 83fad88..4fb8631 100644
--- a/util/kconfig/Makefile.mk
+++ b/util/kconfig/Makefile.mk
@@ -20,6 +20,7 @@
-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 @@
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

To view, visit change 89006. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I7eb1e71aeb6a92b8d3c194a369bd3bd6dc708863
Gerrit-Change-Number: 89006
Gerrit-PatchSet: 1
Gerrit-Owner: Dmytro