Guys, I have a Makefile containing some source files:
UISRCS = optionDialogGUIWidget_base.ui \
optionDialogAccessibilityWidget.ui
MOCSRCS = documentPageCache.h \
documentWidget.h
The .ui files are processed to create .h files:
$(objdir)/%.h: $(srcdir)/%.ui
$(UIC) $< > $@
The .h files are processed to produce .moc files.
$(objdir)/%.moc: $(srcdir)/%.h
$(MOC) -o $@ $<
The .moc files are #included in my C++ source.
However, here's the rub. When my srcdir != buildir the generated .h files
are not in the srcdir and so the .h -> .moc step is failing. For obvious
reasons.
I can add another rule, so:
$(objdir)/%.moc: %.h
$(MOC) -o $@ $<
(and this works) but obviously things are going to get confused when srcdir
and builddir are the same.