From 257d1fd86e6e5e7d145d71707904d8fe54024041 Mon Sep 17 00:00:00 2001
From: Ryan Scott <ryan.gl.scott@gmail.com>
Date: Thu, 18 Jul 2019 09:54:11 -0400
Subject: [PATCH] Don't maintainer-clean libraries/ghc-boot/ghc.mk (#16953)

This makes the `maintainer-clean` rule in `ghc.mk` slightly more
sophisticated so that it does not remove the version-controlled
file `libraries/ghc-boot/ghc.mk`, which was checked into version
control in commit 24782b89907ab36fb5aef3a17584f4c10f1e2690.

Fixes #16953.
---
 ghc.mk | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ghc.mk b/ghc.mk
index 6db08c965fc9..84687fd08f45 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -1418,12 +1418,16 @@ distclean : clean
 	$(call removeFiles,libraries/base/include/fs.h)
 	$(call removeFiles,libraries/base/cbits/fs.c)
 
+CLEAN_LIBRARY_GHC_MK_FILES += $(patsubst %, libraries/%/ghc.mk, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
+# Don't clean `libraries/ghc-boot/ghc.mk`, since it's intended to be version-controlled (#16953)
+CLEAN_LIBRARY_GHC_MK_FILES := $(filter-out libraries/ghc-boot/ghc.mk,$(CLEAN_LIBRARY_GHC_MK_FILES))
+
 maintainer-clean : distclean
 	$(call removeFiles,configure mk/config.h.in)
 	$(call removeTrees,autom4te.cache $(wildcard libraries/*/autom4te.cache))
 	$(call removeFiles,$(patsubst %, libraries/%/GNUmakefile, \
 	        $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
-	$(call removeFiles,$(patsubst %, libraries/%/ghc.mk, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
+	$(call removeFiles,$(CLEAN_LIBRARY_GHC_MK_FILES))
 	$(call removeFiles,$(patsubst %, libraries/%/configure, \
 	        $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))
 	$(call removeFiles,libraries/base/include/HsBaseConfig.h.in)
-- 
GitLab