http://omg-it.works/qt-with-gnu-autotools/

Code Generation with Qt Tools

  UI processing              PRO processing                Q_OBJECT cpp

 ---------------             --------------              ----------------
|   widget.ui   |           |  project.pro |            |   object.cpp   |
 ---------------             --------------              ----------------
       |                            |                            |
       V                            V                            V
 ---------------             --------------              ----------------
|     uic       |<----------|    qmake     |----------->|       moc       |
 ---------------             --------------              ----------------
       | generate                   | generate                   | generate
       V                            |                            |
 ---------------                    |                            |
|  ui_widget.h  |                   |                            |
 ---------------                    |                            |
       |                            |                            |
       V                            |                            |
 ---------------                    |                            |
|   widget.h    |                   |                            |
 ---------------                    |                            |
       |                            |                            |
       V                            V                            V
 ---------------             --------------              ----------------
|  widget.cpp   |           |   Makefile   |            | moc_object.cpp |
 ---------------             --------------              ----------------
       |                            |                            |
       V                            V                            V
 ---------------             --------------              ----------------
|     gcc       |           |     make     |            |  moc_object.o  |
 ---------------             --------------              ----------------
       |                            |                            |
       V                            |                            V
 ---------------                    |                    ----------------
|   widget.o    |                   |                   |  moc_object.o  |
 ---------------                    |                    ----------------
       |                            |                            |
       V                            V                            V
 ------------------------------------------------------------------------
|                                   ld                                   |
 ------------------------------------------------------------------------
       |                            |                            |
       V                            V                            V
 ------------------------------------------------------------------------
|                        executable or library                           |
 ------------------------------------------------------------------------

Unadorned rules:

moc-%.cc: %.h
    @MOC@ -o$@ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)
        $(CPPFLAGS) $(MOC_CPPFLAGS) $<

ui-%.h: %.ui
    @UIC@ -o $@ $<

qrc-%.cc: %.qrc
    @RCC@ -o $@ $<

bin_PROGRAMS = myProgram

BUILT_SOURCES =                 # describes sources that must be generated
    src/ui-mainwindow.h
    src/ui-sourcecodeeditor.h

myProgram_SOURCES =
    src/qrc-resource.cc
    src/moc-mainwindow.cc
    src/moc-sourcecodeeditor.cc

But, to make things cleaner and easier to clean, we want to put the source
"ui" files into a "forms" directory, the generated ui-* files into a "ui",
and put the files generated by moc into a "moc" directory.  Then cleaning
involves simply deleting the "ui" and "moc" directories.

We also have to adapt to the macros created by the more modern AX_HAVE_QT
m4 macro.

# vim: sw=4 ts=4 wm=8 et ft=sh

