X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=python-lttngust%2FMakefile.am;h=33a968f5a6393d322bfe12823e4fb0bee4325738;hb=02275a1d8e68c32173b45f5a0e3b27d97007c840;hp=cc289895e42f1b6cd4474b8c2ac9e2c02d4e0c95;hpb=5b6ff569c0bf82b72f263a259e7a73a453903648;p=lttng-ust.git diff --git a/python-lttngust/Makefile.am b/python-lttngust/Makefile.am index cc289895..33a968f5 100644 --- a/python-lttngust/Makefile.am +++ b/python-lttngust/Makefile.am @@ -1,25 +1,59 @@ +# SPDX-License-Identifier: LGPL-2.1-only + +INSTALLED_FILES=$(builddir)/installed_files.txt + +STATIC_BINDINGS_DEPS = \ + lttngust/agent.py \ + lttngust/cmd.py \ + lttngust/compat.py \ + lttngust/debug.py \ + lttngust/loghandler.py + +all-local: build-python-bindings.stamp + +copy-static-deps.stamp: $(addprefix $(srcdir)/, $(STATIC_BINDINGS_DEPS)) + @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ + for file in $(STATIC_BINDINGS_DEPS); do \ + cp -f $(srcdir)/$$file $(builddir)/$$file; \ + done; \ + fi + touch $@ + # Use setup.py for the installation instead of Autoconf. # This ease the installation process and assure a *pythonic* # installation. -agent_path=lttngust -all-local: - $(PYTHON) setup.py build --verbose +build-python-bindings.stamp: copy-static-deps.stamp + $(PYTHON) $(builddir)/setup.py build --force + touch $@ -install-exec-local: - @opts="--prefix=$(prefix) --verbose --no-compile $(DISTSETUPOPTS)"; \ +install-exec-local: build-python-bindings.stamp + @opts="--prefix=$(prefix) --record $(INSTALLED_FILES) --verbose --no-compile $(DISTSETUPOPTS)"; \ if [ "$(DESTDIR)" != "" ]; then \ opts="$$opts --root=$(DESTDIR)"; \ fi; \ - $(PYTHON) setup.py install $$opts; + $(PYTHON) $(builddir)/setup.py install $$opts; clean-local: - rm -rf build + rm -rf $(builddir)/build + @if [ x"$(srcdir)" != x"$(builddir)" ]; then \ + for file in $(STATIC_BINDINGS_DEPS); do \ + rm -f $(builddir)/$$file; \ + done; \ + fi +# Distutils' setup.py does not include an uninstall target, we thus need to do +# it manually. We save the path of the files that were installed during the install target +# and delete them during the uninstallation. uninstall-local: - rm -rf $(DESTDIR)$(pkgpythondir) + if [ "$(DESTDIR)" != "" ]; then \ + $(SED) -i "s|^|$(DESTDIR)/|g" $(INSTALLED_FILES); \ + fi + cat $(INSTALLED_FILES) | xargs rm -rf || true + $(GREP) "__init__.py" $(INSTALLED_FILES) | xargs dirname | xargs rm -rf || true + rm -f $(INSTALLED_FILES) -EXTRA_DIST=$(agent_path) +EXTRA_DIST = $(STATIC_BINDINGS_DEPS) -# Remove automake generated file before dist -dist-hook: - rm -rf $(distdir)/$(agent_path)/__init__.py +CLEANFILES = \ + build-python-bindings.stamp \ + copy-static-deps.stamp