Show python agent install output in verbose builds
[lttng-ust.git] / src / python-lttngust / Makefile.am
CommitLineData
c0c0989a
MJ
1# SPDX-License-Identifier: LGPL-2.1-only
2
9bafacb2
MJ
3INSTALLED_FILES=$(builddir)/installed_files.txt
4
5STATIC_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
a3ff547e
MJ
13GENERATED_BINDINGS_DEPS = \
14 lttngust/version.py \
15 setup.py
16
62ac7365
MJ
17# For python < 3.12, force the use of distutils even if setuptools is
18# installed. For python >= 3.12, set the externally managed option to allow
19# installation in a directory which isn't in the current PYTHONPATH.
20if HAVE_PYTHON_312_OR_GREATER
21PY_INSTALL_OPTS = --single-version-externally-managed
22else
23export SETUPTOOLS_USE_DISTUTILS=stdlib
24endif
25
9bafacb2
MJ
26all-local: build-python-bindings.stamp
27
28copy-static-deps.stamp: $(addprefix $(srcdir)/, $(STATIC_BINDINGS_DEPS))
9bc9229a 29 $(AM_V_at)if [ x"$(srcdir)" != x"$(builddir)" ]; then \
9bafacb2
MJ
30 for file in $(STATIC_BINDINGS_DEPS); do \
31 cp -f $(srcdir)/$$file $(builddir)/$$file; \
32 done; \
33 fi
34 touch $@
35
5b6ff569
PP
36# Use setup.py for the installation instead of Autoconf.
37# This ease the installation process and assure a *pythonic*
38# installation.
a3ff547e 39build-python-bindings.stamp: copy-static-deps.stamp $(GENERATED_BINDINGS_DEPS)
9bc9229a 40 $(AM_V_at)$(PYTHON) $(builddir)/setup.py build --force
9bafacb2 41 touch $@
5b6ff569 42
9bafacb2 43install-exec-local: build-python-bindings.stamp
9bc9229a 44 $(AM_V_at)opts="--prefix=$(prefix) --record $(INSTALLED_FILES) --verbose --no-compile $(DISTSETUPOPTS)"; \
5b6ff569
PP
45 if [ "$(DESTDIR)" != "" ]; then \
46 opts="$$opts --root=$(DESTDIR)"; \
47 fi; \
62ac7365 48 $(PYTHON) $(builddir)/setup.py install $(PY_INSTALL_OPTS) $$opts;
5b6ff569
PP
49
50clean-local:
a49a7e68 51 rm -rf $(builddir)/build
9bc9229a 52 $(AM_V_at)if [ x"$(srcdir)" != x"$(builddir)" ]; then \
9bafacb2
MJ
53 for file in $(STATIC_BINDINGS_DEPS); do \
54 rm -f $(builddir)/$$file; \
55 done; \
56 fi
5b6ff569 57
a49a7e68 58# Distutils' setup.py does not include an uninstall target, we thus need to do
9bafacb2
MJ
59# it manually. We save the path of the files that were installed during the install target
60# and delete them during the uninstallation.
a49a7e68 61uninstall-local:
a49a7e68 62 if [ "$(DESTDIR)" != "" ]; then \
9bafacb2 63 $(SED) -i "s|^|$(DESTDIR)/|g" $(INSTALLED_FILES); \
a49a7e68 64 fi
9bafacb2
MJ
65 cat $(INSTALLED_FILES) | xargs rm -rf || true
66 $(GREP) "__init__.py" $(INSTALLED_FILES) | xargs dirname | xargs rm -rf || true
67 rm -f $(INSTALLED_FILES)
68
69EXTRA_DIST = $(STATIC_BINDINGS_DEPS)
70
71CLEANFILES = \
72 build-python-bindings.stamp \
73 copy-static-deps.stamp
This page took 0.033191 seconds and 4 git commands to generate.