[2/2] build: Add uninstall action

Submitted by Cyrill Gorcunov on April 20, 2016, 9:11 a.m.

Details

Message ID 1461143512-11318-3-git-send-email-gorcunov@openvz.org
State Rejected
Series "build: Implement uninstall action"
Headers show

Commit Message

Cyrill Gorcunov April 20, 2016, 9:11 a.m.
While most are handled from the scratch there is a significant
problem with python setup. So I added some preliminaty solution,
probably someohe with good knowledge of how setup.py works
improve it later.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 Documentation/Makefile |  6 +++++-
 Makefile.install       |  6 ++++++
 criu/Makefile          |  6 ++++++
 lib/Makefile           | 17 +++++++++++++++++
 4 files changed, 34 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 76666d859ae4..ddd3657200ed 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -59,4 +59,8 @@  install: $(MANS)
 	$(Q) mkdir -p $(DESTDIR)$(MAN8DIR)
 	$(Q) install -m 644 $(MANS) $(DESTDIR)$(MAN8DIR)
 
-.PHONY: clean install
+uninstall:
+	$(E) " UNINSTALL" $(MANS)
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(MAN8DIR)/,$(MANS))
+
+.PHONY: clean install uninstall
diff --git a/Makefile.install b/Makefile.install
index b099c23d7e0f..b3f555121eb7 100644
--- a/Makefile.install
+++ b/Makefile.install
@@ -47,3 +47,9 @@  install-criu: criu
 install: install-man install-lib install-criu
 	@true
 .PHONY: install
+
+uninstall:
+	$(Q) $(MAKE) -C Documentation $@
+	$(Q) $(MAKE) -C lib $@
+	$(Q) $(MAKE) -C criu $@
+.PHONY: uninstall
diff --git a/criu/Makefile b/criu/Makefile
index 1836bde5e1d3..446b36b41378 100644
--- a/criu/Makefile
+++ b/criu/Makefile
@@ -167,6 +167,12 @@  install: criu
 	$(Q) install -m 644 $(UAPI_HEADERS) $(DESTDIR)$(INCLUDEDIR)
 .PHONY: install
 
+uninstall:
+	$(E) " UNINSTALL" criu
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(SBINDIR)/,criu)
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(INCLUDEDIR)/,$(notdir $(UAPI_HEADERS)))
+.PHONY: uninstall
+
 #
 # Final @all target.
 all: criu
diff --git a/lib/Makefile b/lib/Makefile
index f372a52bf5df..a6ea3f26560a 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -54,3 +54,20 @@  install: lib-c lib-py ../crit/crit c/criu.pc.in
 	$(E) "  INSTALL " crit
 	$(Q) python ../scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX)
 .PHONY: install
+
+uninstall:
+	$(E) " UNINSTALL" $(CRIU_SO)
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/,$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR))
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/,$(CRIU_SO))
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/,$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR).$(CRIU_SO_VERSION_MINOR))
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(INCLUDEDIR)/,$(notdir $(UAPI_HEADERS)))
+	$(E) " UNINSTALL" pkgconfig/criu.pc
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/pkgconfig/,criu.pc)
+	$(E) " UNINSTALL" crit
+	#
+	# FIXME How to deal with python setup properly?
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(BINDIR)/,crit)
+	$(Q) $(RM) -r $(addprefix $(DESTDIR)$(LIBDIR)/python2.7/site-packages/,pycriu)
+	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/python2.7/site-packages/,crit-0.0.1-py2.7.egg-info)
+#	$(Q) python ../scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX)
+.PHONY: uninstall