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