From 484484821d132132b9723fe0070fc5a928922e8b Mon Sep 17 00:00:00 2001
From: Ralf Jung <jung@mpi-sws.org>
Date: Thu, 21 Sep 2017 16:41:03 +0200
Subject: [PATCH] update for Coq Makefile hooks

---
 .gitignore         | 3 ++-
 Makefile.coq.local | 5 +++++
 awk.Makefile       | 3 ++-
 3 files changed, 9 insertions(+), 2 deletions(-)
 create mode 100644 Makefile.coq.local

diff --git a/.gitignore b/.gitignore
index a661d9143..1cc22fd6b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,5 +10,6 @@
 *.bak
 .coq-native/
 build-dep/
-Makefile.coq*
+Makefile.coq
+Makefile.coq.conf
 *.crashcoqide
diff --git a/Makefile.coq.local b/Makefile.coq.local
new file mode 100644
index 000000000..b261de990
--- /dev/null
+++ b/Makefile.coq.local
@@ -0,0 +1,5 @@
+uninstall::
+	@# This makes sure we also delete stale files in the destination directory
+	$(HIDE)df="$(COQLIBINSTALL)/`$(COQMKFILE) -destination-of "theories/base.v" $(COQLIBS)`" &&\
+	echo "RM in $$df" &&\
+	if [ -d "$$df" ]; then find "$$df" \( -name "*.vo" -o -name "*.v" -o -name "*.glob" -o \( -type d -empty \) \) -print -delete; fi
diff --git a/awk.Makefile b/awk.Makefile
index 09ded0aa6..74f7d5705 100644
--- a/awk.Makefile
+++ b/awk.Makefile
@@ -11,7 +11,8 @@
 
 # Patch the uninstall target to work properly, and to also uninstall stale files.
 # Also see <https://coq.inria.fr/bugs/show_bug.cgi?id=4907>.
-/^uninstall:/ {
+# This (and the section above) can be removed once we no longer support Coq 8.6.
+/^uninstall: / {
 	print "uninstall:";
 	print "\tif [ -d \"$(DSTROOT)\"$(COQLIBINSTALL)/"PROJECT"/ ]; then find \"$(DSTROOT)\"$(COQLIBINSTALL)/"PROJECT"/ \\( -name \"*.vo\" -o -name \"*.v\" -o -name \"*.glob\" -o \\( -type d -empty \\) \\) -print -delete; fi";
 	getline;
-- 
GitLab