From b67ee0f1e8d92dc5a156b59756320fbf98a3c83b Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 14 Jan 2011 09:32:54 -0800 Subject: [PATCH] Add a vpath for the local lexor_keyword.cc This patch doesn't completely fix the problem, but with it the problem is at least manageable. The issues was that when the lexor_keyword.gperf file is updated and you are building outside the source directory the Makefile would create a local lexor_keyword.cc as expected. The problem is that it always looked in the source directory for the file. This patch adds a special vpath rule that says to look in the build directory first and then in the source directory for lexor_keyword.cc. This works as expected except for the first time the lexor_keyword.cc file is generated locally. During the make invocation it compares the source lexor_keyword.cc file to the gperf file and notices it is out of date. It then generates a new file in the build directory, but the make rule is still using the source file which didn't change so it doesn't rebuild as needed. To get the new file to compile you need to run make a second time to get the rule to execute using the local version of the file. This extra make invocation is only needed when the local file is first created since after that the rule always uses the local file. I plan to look at resolving the remaining issue, but there is much subtlety in this since you effectively need to break/rebuild the make dependency tree to get this to build correctly in a single run. (cherry picked from commit e67dcf52168dd9d3299a3e25eeb5f0c371406cb0) --- Makefile.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index a42994582..2940d43ef 100644 --- a/Makefile.in +++ b/Makefile.in @@ -51,7 +51,10 @@ endif # To get the version headers to build correctly we only want to look # for C++ files in the source directory. All other files will require -# an explicit $(srcdir). +# an explicit $(srcdir). The one exception to this is if we need to +# rebuild the lexor_keyword.cc file. If we do, then we want to use the +# local version instead of the one is $(srcdir). +vpath lexor_keyword.cc . vpath %.cc $(srcdir) bindir = @bindir@