Browse files

Add a vpath for the local

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 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

This works as expected except for the first time the
file is generated locally. During the make invocation it compares the
source 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.
  • Loading branch information...
1 parent 6581b13 commit e67dcf52168dd9d3299a3e25eeb5f0c371406cb0 @caryr caryr committed with Jan 14, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1
@@ -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 file. If we do, then we want to use the
+# local version instead of the one is $(srcdir).
+vpath .
vpath $(srcdir)
bindir = @bindir@

0 comments on commit e67dcf5

Please sign in to comment.