bt2: Fix Makefile dependency tracking when building out of tree
The problem, from the point of view of the developer:
1. Build out of tree, python bindings enabled.
2. Modify a bindings source file (e.g. trace_class.py,
native_bt_trace.i).
3. Type "make" in the builddir.
4. The bindings are not rebuilt from the new source files.
5. Sad.
When we build out of tree, it's done in two steps (assume $builddir is
$top_builddir/bindings/python):
1. Copy all the static files (those checked in the repo, not generated
at runtime) from $srcdir/bt2 to $builddir/bt2. Those files are placed
next to other files that are generated (__init__.py, setup.py).
Together, they form the complete source of the bt2 package.
2. Run setup.py, which runs SWIG and outputs the built package in
$builddir/build_lib.
The problem described above happens because of how the dependencies are
stated for step #1:
STATIC_BINDINGS_DEPS = ... bt2/native_bt_trace.i ...
copy-static-deps.stamp: $(STATIC_BINDINGS_DEPS)
When nothing exists yet in the build directory, bt2/native_bt_trace.i is
resolved to the version in the srcdir (because of make's VPATH, I
believe), so it works fine. But once the copied files exist, and you
try to change the source files and "make" again, the dependency
bt2/native_bt_trace.i will be resolved to the version in the build dir.
Since that version is not newer than copy-static-deps.stamp, nothing is
done.
The fix it, we can force the dependency to be the one in the source
directory, by prepending $(srcdir) to each file.
Change-Id: Ic09d430e53b59e5afa9ebb19d98ba219dff16537
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1250
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
This page took 0.029615 seconds and 4 git commands to generate.