Move to kernel style SPDX license identifiers
[lttng-ust.git] / python-lttngust / Makefile.am
1 # SPDX-License-Identifier: LGPL-2.1-only
2
3 # Use setup.py for the installation instead of Autoconf.
4 # This ease the installation process and assure a *pythonic*
5 # installation.
6 all-local:
7 $(PYTHON) setup.py build --verbose
8
9 install-exec-local:
10 @opts="--prefix=$(prefix) --verbose --no-compile $(DISTSETUPOPTS)"; \
11 if [ "$(DESTDIR)" != "" ]; then \
12 opts="$$opts --root=$(DESTDIR)"; \
13 fi; \
14 $(PYTHON) setup.py install $$opts;
15
16 clean-local:
17 rm -rf $(builddir)/build
18
19 # Distutils' setup.py does not include an uninstall target, we thus need to do
20 # it manually. We fake an install in a temporary folder and use the generated
21 # tree structure to infere the actual location within the install prefix.
22 # 1. Create temporary file and folder
23 # 2. Set the root install folder for a temporary folder
24 # 3. Install in that temporary folder and record all the files installed
25 # 4. If DESTDIR is set, prepend it to the paths of the install files
26 # 5. Remove the installed files and the Python package folder
27 # 6. Remove the files created by this target
28
29 uninstall-local:
30 $(eval TMP_INSTALLED_FILES:=$(shell mktemp $(builddir)/tmp-installed-files-XXXXXX))
31 $(eval TMP_INSTALL_DIR:=$(shell mktemp -d $(builddir)/tmp-install-dir-XXXXXX))
32 $(eval TMP_BUILD_DIR:=$(shell mktemp -d $(builddir)/tmp-build-dir-XXXXXX))
33 @opts="--root=$(TMP_INSTALL_DIR) --prefix=$(prefix) --record $(TMP_INSTALLED_FILES) --no-compile $(DISTSETUPOPTS)"; \
34 if [ "$(DESTDIR)" != "" ]; then \
35 opts="$$opts --root=$(DESTDIR)"; \
36 else \
37 opts="$$opts --root=$(TMP_INSTALL_DIR)"; \
38 fi; \
39 $(PYTHON) setup.py build --build-base $(TMP_BUILD_DIR) install $$opts > /dev/null || true
40
41 if [ "$(DESTDIR)" != "" ]; then \
42 $(SED) -i "s|^|$(DESTDIR)/|g" $(TMP_INSTALLED_FILES); \
43 fi
44
45 cat $(TMP_INSTALLED_FILES) | xargs rm -rf || true
46 $(GREP) "__init__.py" $(TMP_INSTALLED_FILES) | xargs dirname | xargs rm -rf || true
47 rm -f $(TMP_INSTALLED_FILES)
48 rm -rf $(TMP_INSTALL_DIR)
49 rm -rf $(TMP_BUILD_DIR)
This page took 0.029916 seconds and 4 git commands to generate.