Commit | Line | Data |
---|---|---|
00f7eedc JG |
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 | |
3 | # linker path. | |
4 | AM_LDFLAGS=-L$(top_builddir)/lib/.libs | |
45dc11d3 | 5 | |
00f7eedc | 6 | INSTALLED_FILES=$(builddir)/installed_files.txt |
45dc11d3 | 7 | |
fec8e82a MJ |
8 | STATIC_BINDINGS_DEPS = \ |
9 | babeltrace/common.py \ | |
10 | babeltrace/reader.py \ | |
00f7eedc | 11 | babeltrace/reader_event_declaration.py \ |
fec8e82a | 12 | babeltrace/reader_event.py \ |
00f7eedc JG |
13 | babeltrace/reader_field_declaration.py \ |
14 | babeltrace/reader_field_definition.py \ | |
15 | babeltrace/reader_trace_collection.py \ | |
fec8e82a | 16 | babeltrace/reader_trace_handle.py \ |
00f7eedc | 17 | babeltrace/writer.py |
45dc11d3 | 18 | |
fec8e82a | 19 | GENERATED_BINDINGS_DEPS = \ |
00f7eedc JG |
20 | babeltrace/__init__.py \ |
21 | setup.py | |
45dc11d3 | 22 | |
45dc11d3 | 23 | |
00f7eedc | 24 | all-local: build-python-bindings.stamp |
6027e07b | 25 | |
00f7eedc | 26 | copy-static-deps.stamp: $(STATIC_BINDINGS_DEPS) |
6027e07b | 27 | @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ |
00f7eedc JG |
28 | for file in $(STATIC_BINDINGS_DEPS); do \ |
29 | cp -f $(srcdir)/$$file $(builddir)/$$file; \ | |
6027e07b JG |
30 | done; \ |
31 | fi | |
00f7eedc JG |
32 | touch $@ |
33 | ||
34 | build-python-bindings.stamp: copy-static-deps.stamp $(GENERATED_BINDINGS_DEPS) | |
00f7eedc JG |
35 | $(BUILD_FLAGS) $(PYTHON) $(builddir)/setup.py build |
36 | touch $@ | |
37 | ||
38 | install-exec-local: build-python-bindings.stamp | |
39 | @opts="--prefix=$(prefix) --record $(INSTALLED_FILES) --verbose --no-compile $(DISTSETUPOPTS)"; \ | |
40 | if [ "$(DESTDIR)" != "" ]; then \ | |
41 | opts="$$opts --root=$(DESTDIR)"; \ | |
42 | fi; \ | |
43 | $(PYTHON) $(builddir)/setup.py install $$opts; | |
6027e07b JG |
44 | |
45 | clean-local: | |
00f7eedc | 46 | rm -rf $(builddir)/build |
6027e07b | 47 | @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ |
00f7eedc JG |
48 | for file in $(STATIC_BINDINGS_DEPS); do \ |
49 | rm -f $(builddir)/$$file; \ | |
6027e07b JG |
50 | done; \ |
51 | fi | |
00f7eedc JG |
52 | |
53 | # Distutils' setup.py does not include an uninstall target, we thus need to do | |
54 | # it manually. We save the path of the files that were installed during the install target | |
55 | # and delete them during the uninstallation. | |
56 | uninstall-local: | |
57 | if [ "$(DESTDIR)" != "" ]; then \ | |
58 | $(SED) -i "s|^|$(DESTDIR)/|g" $(INSTALLED_FILES); \ | |
59 | fi | |
60 | cat $(INSTALLED_FILES) | xargs rm -rf || true | |
61 | $(GREP) "__init__.py" $(INSTALLED_FILES) | xargs dirname | xargs rm -rf || true | |
62 | rm -f $(INSTALLED_FILES) | |
63 | ||
64 | # distribute: extra Python modules and SWIG interface files | |
65 | EXTRA_DIST = $(STATIC_BINDINGS_DEPS) | |
66 | ||
67 | # clean: generated Python files and stamps | |
fec8e82a | 68 | CLEANFILES = build-python-bindings.stamp copy-static-deps.stamp |