Angus Leeming wrote:
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.

Can you surround that rule with an "ifneq($(srcdir),$(objdir))" conditional,
or something like that?

--
Trying to get a job as a c++ developer?  See 
http://kegel.com/academy/getting-hired.html


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to