Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.
  • Loading branch information...
commit e67dcf52168dd9d3299a3e25eeb5f0c371406cb0 1 parent 6581b13
@caryr caryr authored committed
Showing with 4 additions and 1 deletion.
  1. +4 −1 Makefile.in
View
5 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@
Please sign in to comment.
Something went wrong with that request. Please try again.