bt2: Fix Makefile dependency tracking when building out of tree
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 3 May 2019 19:58:04 +0000 (15:58 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 6 May 2019 14:21:32 +0000 (10:21 -0400)
commitc28a5d89421c1917fc74c6e5805c055a2d0978dd
tree90e66acdd4d29194bfd7d911f3cd28d653d798e1
parentc8f043d2a53fb06bfc7dc996ac21fe833a06d9b2
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>
bindings/python/bt2/Makefile.am
This page took 0.02573 seconds and 4 git commands to generate.