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