Commit | Line | Data |
---|---|---|
c0c0989a MJ |
1 | # SPDX-License-Identifier: LGPL-2.1-only |
2 | ||
9bafacb2 MJ |
3 | INSTALLED_FILES=$(builddir)/installed_files.txt |
4 | ||
5 | STATIC_BINDINGS_DEPS = \ | |
50d2bb48 | 6 | lttngust/__init__.py \ |
9bafacb2 MJ |
7 | lttngust/agent.py \ |
8 | lttngust/cmd.py \ | |
9 | lttngust/compat.py \ | |
10 | lttngust/debug.py \ | |
11 | lttngust/loghandler.py | |
12 | ||
2d061cf4 MJ |
13 | GENERATED_BINDINGS_DEPS = \ |
14 | lttngust/version.py \ | |
15 | setup.py | |
16 | ||
9bafacb2 MJ |
17 | all-local: build-python-bindings.stamp |
18 | ||
19 | copy-static-deps.stamp: $(addprefix $(srcdir)/, $(STATIC_BINDINGS_DEPS)) | |
20 | @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ | |
21 | for file in $(STATIC_BINDINGS_DEPS); do \ | |
22 | cp -f $(srcdir)/$$file $(builddir)/$$file; \ | |
23 | done; \ | |
24 | fi | |
25 | touch $@ | |
26 | ||
5b6ff569 PP |
27 | # Use setup.py for the installation instead of Autoconf. |
28 | # This ease the installation process and assure a *pythonic* | |
29 | # installation. | |
2d061cf4 | 30 | build-python-bindings.stamp: copy-static-deps.stamp $(GENERATED_BINDINGS_DEPS) |
9bafacb2 MJ |
31 | $(PYTHON) $(builddir)/setup.py build --force |
32 | touch $@ | |
5b6ff569 | 33 | |
9bafacb2 MJ |
34 | install-exec-local: build-python-bindings.stamp |
35 | @opts="--prefix=$(prefix) --record $(INSTALLED_FILES) --verbose --no-compile $(DISTSETUPOPTS)"; \ | |
5b6ff569 PP |
36 | if [ "$(DESTDIR)" != "" ]; then \ |
37 | opts="$$opts --root=$(DESTDIR)"; \ | |
38 | fi; \ | |
9bafacb2 | 39 | $(PYTHON) $(builddir)/setup.py install $$opts; |
5b6ff569 PP |
40 | |
41 | clean-local: | |
a49a7e68 | 42 | rm -rf $(builddir)/build |
9bafacb2 MJ |
43 | @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ |
44 | for file in $(STATIC_BINDINGS_DEPS); do \ | |
45 | rm -f $(builddir)/$$file; \ | |
46 | done; \ | |
47 | fi | |
5b6ff569 | 48 | |
a49a7e68 | 49 | # Distutils' setup.py does not include an uninstall target, we thus need to do |
9bafacb2 MJ |
50 | # it manually. We save the path of the files that were installed during the install target |
51 | # and delete them during the uninstallation. | |
a49a7e68 | 52 | uninstall-local: |
a49a7e68 | 53 | if [ "$(DESTDIR)" != "" ]; then \ |
9bafacb2 | 54 | $(SED) -i "s|^|$(DESTDIR)/|g" $(INSTALLED_FILES); \ |
a49a7e68 | 55 | fi |
9bafacb2 MJ |
56 | cat $(INSTALLED_FILES) | xargs rm -rf || true |
57 | $(GREP) "__init__.py" $(INSTALLED_FILES) | xargs dirname | xargs rm -rf || true | |
58 | rm -f $(INSTALLED_FILES) | |
59 | ||
60 | EXTRA_DIST = $(STATIC_BINDINGS_DEPS) | |
61 | ||
62 | CLEANFILES = \ | |
63 | build-python-bindings.stamp \ | |
64 | copy-static-deps.stamp |