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