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. 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? (yes, I know I'm abusing my position a little ;-)) Angus SUBDIRS = kdelibs . CONFIG_COMPILER = kdelibs/qdvi_config_compiler$(EXEEXT) bin_PROGRAMS = qdvi # prefs.{cpp.h}, kvsprefs.{cpp.h} come first in this list because # they are generated files and I don't know how else to force # Automake to create them before it tries to compile these .cpp files # but after it has visited kdelibs where it creates $(CONFIG_COMPIER) # Yes, I know it's scrappy. qdvi_SOURCES = \ prefs.cpp \ prefs.h \ kvsprefs.cpp \ kvsprefs.h \ anchor.h \ bigEndianByteReader.cpp \ bigEndianByteReader.h \ ... kvsprefs.cpp: kviewshell.kcfg kvsprefs.kcfgc $(CONFIG_COMPILER) $(srcdir)/kviewshell.kcfg $(srcdir)/kvsprefs.kcfgc prefs.cpp: kdvi.kcfg prefs.kcfgc $(CONFIG_COMPILER) $(srcdir)/kdvi.kcfg $(srcdir)/prefs.kcfgc