public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: davidgraeff <david.graeff@web.de>
To: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org, davidgraeff <david.graeff@web.de>
Subject: [PATCH 8/9] kconfig: qt flavour makefile fixes
Date: Tue,  2 Jul 2013 17:22:29 +0200	[thread overview]
Message-ID: <1372778550-22110-9-git-send-email-david.graeff@web.de> (raw)
In-Reply-To: <1372778550-22110-1-git-send-email-david.graeff@web.de>

* Add comments to the makefile
* fix moc/uic invocation
* Compile moc classes as objects and link to qconf instead of including with #include.
  This is more compliant to the way IDEs like QtCreator work.
---
 scripts/kconfig/qconfig/Makefile | 39 ++++++++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/scripts/kconfig/qconfig/Makefile b/scripts/kconfig/qconfig/Makefile
index 72e0bd1..b9857c3 100644
--- a/scripts/kconfig/qconfig/Makefile
+++ b/scripts/kconfig/qconfig/Makefile
@@ -4,9 +4,6 @@
 
 PHONY +=  xconfig qconfig
 
-MOC_HEADERS := $(wildcard $(obj)/qconfig/*.h)
-MOCS := $(patsubst %.h,%.moc,$(MOC_HEADERS))
-
 xconfig: $(obj)/qconf
 	$< $(Kconfig)
 
@@ -14,12 +11,24 @@ qconfig: $(obj)/qconf
 	$< $(Kconfig)
 
 # ===========================================================================
-# qconf:  Used for the xconfig target
-#         Based on QT which needs to be installed to compile it
-# object files used by all kconfig flavours listed above
+# qconf:  Used for the xconfig/qconfig target
+#         Based on Qt4+ which needs to be installed to compile it
+
+# Meta object files (moc files) have to be considered for every class that uses the Q_OBJECT macro.
+# We collect all class header files below, build moc_[filename].o object filenames and store those in "MOCS".
+# Assumtion: All header files in this directory contain c++ code.
+MOC_HEADERS := $(wildcard $(obj)/qconfig/*.h)
+MOC_SOURCE_FILES := $(patsubst $(obj)/qconfig/%,%,$(MOC_HEADERS)) # remove directory part
+MOC_DEST_FILES := $(patsubst %.h,moc_%.o,$(MOC_SOURCE_FILES)) # add moc_ prefix
+MOCS := $(patsubst %,qconfig/%,$(MOC_DEST_FILES)) # add directory part
 
+# Object files used by this kconfig flavours listed below. Meta object files (moc files) are generated by
+# the Qt moc tool. We have to build and link those generated files, too.
 qconf-cxxobjs	:= qconfig/qconf.o qconfig/configItem.o qconfig/configModel.o qconfig/configmodeldelegate.o \
-     qconfig/infoViewWidget.o qconfig/mainwindow.o  qconfig/searchfiltermodelproxy.o qconfig/searchmodel.o
+     qconfig/infoViewWidget.o qconfig/mainwindow.o  qconfig/searchfiltermodelproxy.o qconfig/searchmodel.o \
+     $(MOCS)
+
+# Object files used by all kconfig flavours listed below
 qconf-objs	:= zconf.tab.o
 
 ifeq ($(MAKECMDGOALS),qconfig)
@@ -34,12 +43,12 @@ ifeq ($(qconf-target),1)
 	hostprogs-y += qconf
 endif
 
-clean-files	+= qconfig/*.moc qconfig/ui_*.h qconfig/.tmp_qtcheck qconf
+clean-files	+= qconfig/moc_*.cc qconfig/ui_*.h qconfig/.tmp_qtcheck qconf
 
 HOSTLOADLIBES_qconf	= $(KC_QT_LIBS)
-HOSTCXXFLAGS	= $(KC_QT_CFLAGS) -DINCLUDEMOC
+HOSTCXXFLAGS	= $(KC_QT_CFLAGS)
 
-$(obj)/qconfig/qconf.o: $(MOCS) $(UIS) $(src)/qconfig/.tmp_qtcheck
+$(obj)/qconfig/qconf.o: $(src)/qconfig/.tmp_qtcheck
 $(obj)/qconfig/mainwindow.o: $(obj)/qconfig/ui_mainwindow.h
 
 ifeq ($(qconf-target),1)
@@ -71,15 +80,15 @@ $(obj)/qconfig/.tmp_qtcheck:
 	echo "KC_QT_UIC=$$uic" >> $@
 endif
 
-$(obj)/qconfig/%.o: $(obj)/qconfig/%.moc
-
 quiet_cmd_moc = MOC     $@
-      cmd_moc = $(KC_QT_MOC) -nn -i $< -o $@
+      cmd_moc = $(KC_QT_MOC) -nn $< -o $@
 quiet_cmd_uic = UIC     $@
       cmd_uic = $(KC_QT_UIC) -n $< -o $@
 
-$(obj)/qconfig/%.moc: $(obj)/qconfig/%.h $(obj)/qconfig/.tmp_qtcheck
+$(obj)/qconfig/moc_%.cc: $(obj)/qconfig/%.h
 	$(call cmd,moc)
 
-$(obj)/qconfig/ui_%.h: $(obj)/qconfig/%.ui $(obj)/qconfig/.tmp_qtcheck
+$(obj)/qconfig/ui_%.h: $(obj)/qconfig/%.ui
 	$(call cmd,uic)
+
+$(obj)/qconfig/%.o: $(obj)/qconfig/moc_%.o
-- 
1.8.1.2


  parent reply	other threads:[~2013-07-02 15:23 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <kconfig-port-gtk-qt>
2013-07-02 15:22 ` Kconfig Gtk/Qt interface flavours ported to newest toolkit versions davidgraeff
2013-07-02 15:22   ` [PATCH 2/9] kconfig: Update gtk interface codebase davidgraeff
2013-07-02 15:22   ` [PATCH 3/9] kconfig: gtk interface port to Gtk3 davidgraeff
2013-07-02 15:22   ` [PATCH 4/9] kconfig: gtk interface: fix splitview, split code into two files davidgraeff
2013-07-02 15:22   ` [PATCH 5/9] kconfig: images.c for gtk/qt gui flavour reoganized davidgraeff
2013-07-02 15:22   ` [PATCH 6/9] kconf: gtk: move relayout code out of a loop davidgraeff
2013-07-13  8:56     ` Sam Ravnborg
2013-07-02 15:22   ` davidgraeff [this message]
2013-07-02 15:22   ` [PATCH 9/9] kconfig: qt flavour, add missing updateTree davidgraeff
2013-07-03 16:30   ` Kconfig Gtk/Qt interface flavours ported to newest toolkit versions Yann E. MORIN
2013-07-06  0:13     ` David Gräff
2013-07-10 21:32       ` Yann E. MORIN
2013-07-11 21:02         ` Sam Ravnborg
2013-07-11 20:56     ` Sam Ravnborg
2013-07-11 21:06   ` Sam Ravnborg
2013-08-04 10:38 ` [PATCH v2 0/4] " David Graeff
2013-08-04 10:38   ` [PATCH v2 1/4] KConf: Move flavours into their own subdirectories David Graeff
2013-08-10  9:06     ` Sam Ravnborg
2013-08-16 14:13     ` Michal Marek
2013-08-04 10:38   ` [PATCH v2 4/4] KConf: images.c for gtk/qt gui flavour reoganized David Graeff
2013-08-10  9:10     ` Sam Ravnborg
2013-08-04 11:02   ` [PATCH v2 0/4] Gtk/Qt interface flavours ported to newest toolkit versions Yann E. MORIN
2013-08-04 15:40     ` David Gräff
2013-08-10  9:01   ` Sam Ravnborg
2013-08-16 13:28   ` Michal Marek
2013-08-16 13:36     ` Yann E. MORIN
2013-08-16 14:02       ` Michal Marek
2013-08-19 14:29 ` [PATCH v3 0/5] Kconfig " David Graeff
2013-11-18 18:18   ` Yann E. MORIN
2013-08-19 14:29 ` [PATCH v3 1/5] kconfig: Move flavours into their own subdirectories David Graeff
2013-08-19 14:29 ` [PATCH v3 2/5] kconfig: Add qconfig makefile target additionally to the xconfig target David Graeff
2013-08-19 14:29 ` [PATCH v3 5/5] kconfig: images.c for gtk/qt gui flavour reoganized David Graeff
2013-08-19 17:50 ` [PATCH v3 6/6] kconfig: Update POTFILES.in to reflect new directory structure David Graeff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1372778550-22110-9-git-send-email-david.graeff@web.de \
    --to=david.graeff@web.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox