From 9f79b4c91b9a00dbfb32f961a14db726a5385b2b Mon Sep 17 00:00:00 2001 From: Ralf Jung <jung@mpi-sws.org> Date: Wed, 9 Nov 2016 15:53:35 +0100 Subject: [PATCH] add a working 'uninstall' target and call it before installing --- Makefile | 8 +++++++- Makefile.uninstall | 27 +++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 Makefile.uninstall diff --git a/Makefile b/Makefile index 6c3ca5b55..9ebb201d6 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,12 @@ clean: Makefile.coq +@make -f Makefile.coq clean rm -f Makefile.coq +uninstall: + +@make -f Makefile.uninstall uninstall + +install: Makefile.coq uninstall + +@make -f Makefile.coq install + Makefile.coq: _CoqProject Makefile coq_makefile -f _CoqProject | sed 's/$$(COQCHK) $$(COQCHKFLAGS) $$(COQLIBS)/$$(COQCHK) $$(COQCHKFLAGS) $$(subst -Q,-R,$$(COQLIBS))/' > Makefile.coq @@ -19,4 +25,4 @@ Makefile: ; phony: ; -.PHONY: all clean phony +.PHONY: all clean install uninstall phony diff --git a/Makefile.uninstall b/Makefile.uninstall new file mode 100644 index 000000000..3fb57d5ae --- /dev/null +++ b/Makefile.uninstall @@ -0,0 +1,27 @@ +## This makefile does some pretty heavy manipualtion of variables, +## which we don't want in our main Makefile. That's why it is +## in a separate file. + +## BEGIN things copied from Makefile.coq +# Here is a hack to make $(eval $(shell works: +define donewline + + +endef +includecmdwithout@ = $(eval $(subst @,$(donewline),$(shell { $(1) | tr -d '\r' | tr '\n' '@'; }))) +$(call includecmdwithout@,$(COQBIN)coqtop -config) + +ifdef USERINSTALL +XDG_DATA_HOME?="$(HOME)/.local/share" +COQLIBINSTALL=$(XDG_DATA_HOME)/coq +COQDOCINSTALL=$(XDG_DATA_HOME)/doc/coq +else +COQLIBINSTALL="${COQLIB}user-contrib" +COQDOCINSTALL="${DOCDIR}user-contrib" +COQTOPINSTALL="${COQLIB}toploop" +endif + +## End things copied from Makefile.coq + +uninstall: + if [ -d "$(DSTROOT)"$(COQLIBINSTALL)/iris/ ]; then find "$(DSTROOT)"$(COQLIBINSTALL)/iris/ -name "*.vo" -print -delete; fi -- GitLab