[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: srcdir != buildir woes

From: Dan Kegel
Subject: Re: srcdir != buildir woes
Date: Tue, 26 Jul 2005 07:02:31 -0700
User-agent: Mozilla/4.0 (compatible;MSIE 5.5; Windows 98)

Angus Leeming wrote:
Guys, I have a Makefile containing some source files:

UISRCS = optionDialogGUIWidget_base.ui \

MOCSRCS = documentPageCache.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

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]