automake
[Top][All Lists]
Advanced

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

build paths and generated sources


From: Thomas Porschberg
Subject: build paths and generated sources
Date: Sun, 29 Jan 2006 22:00:28 +0100

Hi,
we run automake (and autoconf,libtool) in a project which 
uses the QT library.
Programming with QT involves to generate *cpp,*h from so called
*ui files and *moc files from header files.

The way we do this in Makefile.am is as follows:

BUILT_SOURCES = 
        <here are all generated moc and cpp/h generated from>
        <ui file listed>

%.cpp %.h: %.ui
        @UIC@ -o $(<:%.ui=%.h) $<
        @UIC@ -i $(<:%.ui=%.h) -o $(<:%.ui=%.cpp) $<

%.moc: %.h
        @MOC@ -o $@ $<


Now I started to use two different build directories,
one for static build and another one for module build.
I did in <project dir>:
 mkdir static_build
 mkdir module_build

and called the configure script in static_build respectively
module_build with "../configure <my options>".

And now the problem/output from make (called in static_build):

>snip

/usr/lib/qt3/bin/moc -o toabout.moc ../toabout.h
/usr/lib/qt3/bin/moc -o toaboutui.moc ../toaboutui.h
/usr/lib/qt3/bin/moc -o toalert.moc ../toalert.h
/usr/lib/qt3/bin/moc -o toanalyze.moc ../toanalyze.h
/usr/lib/qt3/bin/moc -o tobackup.moc ../tobackup.h
/usr/lib/qt3/bin/moc -o tobarchart.moc ../tobarchart.h
/usr/lib/qt3/bin/moc -o tobrowser.moc ../tobrowser.h
/usr/lib/qt3/bin/moc -o tobrowserconstraint.moc ../tobrowserconstraint.h
/usr/lib/qt3/bin/uic -L  -nounload -o ../tobrowserconstraintui.h 
../tobrowsercon                                                           
straintui.ui
/usr/lib/qt3/bin/uic -L  -nounload -i ../tobrowserconstraintui.h -o 
../tobrowser                                                           
constraintui.cpp ../tobrowserconstraintui.ui
/usr/lib/qt3/bin/moc -o tobrowserconstraintui.moc tobrowserconstraintui.h
moc: tobrowserconstraintui.h: No such file

>snip

Because the moc files are generated in static_build directory
an not in <project dir> (which is the src dir in this case) an the
header files from ui files are generated in <project dir>
the last moc call failed.
I changed my moc rule from

%.moc: %.h
        @MOC@ -o $@ $<
to

%.moc: %.h
        @MOC@ -o $(<:%.h=%.moc) $<

but with no real success.

The out put is now:

/usr/lib/qt3/bin/moc -o ../toabout.moc ../toabout.h
/usr/lib/qt3/bin/moc -o ../toaboutui.moc ../toaboutui.h
/usr/lib/qt3/bin/moc -o ../toalert.moc ../toalert.h
/usr/lib/qt3/bin/moc -o ../toanalyze.moc ../toanalyze.h
/usr/lib/qt3/bin/moc -o ../tobackup.moc ../tobackup.h
/usr/lib/qt3/bin/moc -o ../tobarchart.moc ../tobarchart.h
/usr/lib/qt3/bin/moc -o ../tobrowser.moc ../tobrowser.h
/usr/lib/qt3/bin/moc -o ../tobrowserconstraint.moc ../tobrowserconstraint.h
/usr/lib/qt3/bin/uic -L  -nounload -o ../tobrowserconstraintui.h 
../tobrowserconstraintui.ui
/usr/lib/qt3/bin/uic -L  -nounload -i ../tobrowserconstraintui.h -o 
../tobrowserconstraintui.cpp ../tobrowserconstraintui.ui
/usr/lib/qt3/bin/moc -o tobrowserconstraintui.moc tobrowserconstraintui.h

mocs and header files generated from ui-files are now in
project dir but the last moc-call want create a moc file
from a generated header file and failed because it searches the
header file in static_build-dir and not in project dir.

My questions are: 
- Where should the generated files be uploaded in src-dir or build-dir ?
  I think build-dir would better because every build process could   produce 
different generator-results. (However this is not the case   here.)

- If I'm right then it should come down to change the rule 
%.cpp %.h: %.ui
        @UIC@ -o $(<:%.ui=%.h) $<
        @UIC@ -i $(<:%.ui=%.h) -o $(<:%.ui=%.cpp) $<

 in such a way that the header/cpp files from ui files are
 not generated in the project directory.
 How can I achieve it ? BTW I run automake --warnings=all and got:
 `%'-style pattern rules are a GNU make extension
 How can I make my rule more portable in this case ?

I hope my mail is not too long and I hope someone can enlight me.

Thomas








 




reply via email to

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