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