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