From a1545c3d349aa4c13029b409fcb2e239deae6f2f Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 10 Sep 2019 11:08:43 -0400 Subject: [PATCH] bt2: Makefile: track dependencies of native_bt.c Building native_bt.c involves including many .h files from include/. Those dependencies are not tracked by the Makefile, which means that if you build, modify a .h (which can be simply checking out a different commit) and build again, native_bt.c won't be re-built (even though it should). SWIG has the same kind of features to make dependency tracking easy as gcc. The -MD switch generates a bt2/native_bt.d file containing a make target with all files involved in generating bt2/native_bt.c. All we have to do is to include that file in our Makefile. `-include` is used so that it's not an error if the file does not exist (which happens the first time you build). Change-Id: Iedb187657d42770fa2caeadfa07079351af8a485 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/2023 Reviewed-by: Francis Deslauriers --- src/bindings/python/bt2/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bindings/python/bt2/Makefile.am b/src/bindings/python/bt2/Makefile.am index c74988b1..e9721345 100644 --- a/src/bindings/python/bt2/Makefile.am +++ b/src/bindings/python/bt2/Makefile.am @@ -126,7 +126,9 @@ swig_verbose_ = $(swig_verbose_@AM_DEFAULT_V@) swig_verbose_0 = @echo " SWIG " $@; $(builddir)/bt2/native_bt.c: $(SWIG_INTERFACE_FILES) - $(swig_verbose)$(SWIG) -python -I"$(top_srcdir)/include" -o "$@" "$<" + $(swig_verbose)$(SWIG) -MD -python -I"$(top_srcdir)/include" -o "$@" "$<" + +-include bt2/native_bt.d install-exec-local: build-python-bindings.stamp @opts="--prefix=$(prefix) --record $(INSTALLED_FILES) --verbose --no-compile $(DISTSETUPOPTS)"; \ -- 2.34.1