Angus Leeming <[EMAIL PROTECTED]> writes:

| I have a project (http://sourceforge.net/projects/qdvi/)
| where I'm porting kdvi to Windows. The thing is pretty well working in my
| local tree (the committed stuff does *not*, so don't try it out!) but I
| have one Automake stumbling block. Here's the (working) snippet of my
| Makefile.am, which
| 
| 1. Visits the kdelibs subdirectory where it compiles and links
| $(CONFIG_COMPILER).
| 2. Generates prefs.{cpp,h} and kvsprefs.{cpp,h} from those .kcfg files
| using this kdelibs/$(CONFIG_COMPILER).
| 3. Goes on to compile the .cpp files into .$(OBJEXT) ones.
| 
| As I say, the Makefile.am works, but it's very fragile because prefs
| {cpp,h} and kvsprefs.{cpp,h} must be placed first in my list of sources,
| so that they're compiled before anything else which #includes prefs.h or
| kvsprefs.h. At least that's what I hope happens, but there's nothing to
| guarantee it.

Not only fragile: buggy. A parallel build will fail (from time to
time)...

Hmm... are the header files created as a side effect of generating the
source files? Not super good.

| I've tried adding these files to BUILT_SOURCES and to qdvi_nodist_SOURCES
| and I've tried to make qdvi_SOURCES dependent on kvsprefs.cpp, but all
| that happens is that the build process attempts to build them on the way
| *up* the tree, before it's got to kdelibs to compile $(CONFIG_COMPILER). I
| want it to build them on the way *down* the tree, after it's visited the
| kdelibs subdirectory.
| 
| Any ideas on how to do this properly?

I don't know if you have solved the problem yet.

I think the only way to do this with automake is to have the targets
for generating the files and using explict dependencies:

*.$(OBJEXT): kvsprefs.cpp kvsprefs.h prefs.cpp prefs.h

kvsprefs.h: kvsprefs.cpp

kvsprefs.cpp: kviewshell.kcfg kvsprefs.kcfgc
         $(CONFIG_COMPILER) $(srcdir)/kviewshell.kcfg $(srcdir)/kvsprefs.kcfgc


prefs.h: prefs.cpp

prefs.cpp: kdvi.kcfg prefs.kcfgc
         $(CONFIG_COMPILER) $(srcdir)/kdvi.kcfg $(srcdir)/prefs.kcfgc


Reply via email to