1 # Since the shared object used by the python bindings is not built with
2 # libtool, we need to add the directory containing libbabeltrace to the
4 AM_LDFLAGS=-L$(top_builddir)/lib/.libs
6 INSTALLED_FILES=$(builddir)/installed_files.txt
8 STATIC_BINDINGS_DEPS = \
10 babeltrace/reader.py \
11 babeltrace/reader_event_declaration.py \
12 babeltrace/reader_event.py \
13 babeltrace/reader_field_declaration.py \
14 babeltrace/reader_field_definition.py \
15 babeltrace/reader_trace_collection.py \
16 babeltrace/reader_trace_handle.py \
19 GENERATED_BINDINGS_DEPS = \
20 babeltrace/__init__.py \
24 all-local: build-python-bindings.stamp
26 copy-static-deps.stamp: $(STATIC_BINDINGS_DEPS)
27 @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
28 for file in $(STATIC_BINDINGS_DEPS); do \
29 cp -f $(srcdir)/$$file $(builddir)/$$file; \
34 build-python-bindings.stamp: copy-static-deps.stamp $(GENERATED_BINDINGS_DEPS)
35 $(BUILD_FLAGS) $(PYTHON) $(builddir)/setup.py build_ext
36 $(BUILD_FLAGS) $(PYTHON) $(builddir)/setup.py build
39 install-exec-local: build-python-bindings.stamp
40 @opts="--prefix=$(prefix) --record $(INSTALLED_FILES) --verbose --no-compile $(DISTSETUPOPTS)"; \
41 if [ "$(DESTDIR)" != "" ]; then \
42 opts="$$opts --root=$(DESTDIR)"; \
44 $(PYTHON) $(builddir)/setup.py install $$opts;
47 rm -rf $(builddir)/build
48 @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
49 for file in $(STATIC_BINDINGS_DEPS); do \
50 rm -f $(builddir)/$$file; \
54 # Distutils' setup.py does not include an uninstall target, we thus need to do
55 # it manually. We save the path of the files that were installed during the install target
56 # and delete them during the uninstallation.
58 if [ "$(DESTDIR)" != "" ]; then \
59 $(SED) -i "s|^|$(DESTDIR)/|g" $(INSTALLED_FILES); \
61 cat $(INSTALLED_FILES) | xargs rm -rf || true
62 $(GREP) "__init__.py" $(INSTALLED_FILES) | xargs dirname | xargs rm -rf || true
63 rm -f $(INSTALLED_FILES)
65 # distribute: extra Python modules and SWIG interface files
66 EXTRA_DIST = $(STATIC_BINDINGS_DEPS)
68 # clean: generated Python files and stamps
69 CLEANFILES = copy-static-deps.stamp