From d1188dd3b4c1e8155529e7ee17f60b760c7fb0ac Mon Sep 17 00:00:00 2001 From: Sven Tennie Date: Wed, 17 Aug 2022 08:45:09 +0200 Subject: [PATCH 1/2] Sanitize `delete-cache-on-linker-errors` make target `dist-newstyle`: The directory name depends on the cabal version. `cabal clean` does the job (using the tool itself to manage it's cache). `~/.cabal`: We shouldn't delete the whole folder as it may contain a manually tweaked `config` file. Deleting `~/.cabal/store` should be sufficient. --- Makefile | 4 ++-- changelog.d/5-internal/cleanup-caches-make-target | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog.d/5-internal/cleanup-caches-make-target diff --git a/Makefile b/Makefile index 663e449c58b..55a53e5c224 100644 --- a/Makefile +++ b/Makefile @@ -53,8 +53,8 @@ endif .PHONY: delete-cache-on-linker-errors delete-cache-on-linker-errors: rm -rf ~/.cache/hie-bios - rm -rf ~/.cabal - rm -rf ./dist-newstyle + rm -rf ~/.cabal/store + cabal clean # Build all Haskell services and executables with -O0, run unit tests .PHONY: fast diff --git a/changelog.d/5-internal/cleanup-caches-make-target b/changelog.d/5-internal/cleanup-caches-make-target new file mode 100644 index 00000000000..4bf230bb2da --- /dev/null +++ b/changelog.d/5-internal/cleanup-caches-make-target @@ -0,0 +1 @@ +Add make target `delete-cache-on-linker-errors` to delete all Haskell compilation related caches. This is useful in cases where the development environment gets into an inconsistent state. From 8101c5baf866a5fc33a048a4ff03067c6db93c62 Mon Sep 17 00:00:00 2001 From: Sven Tennie Date: Wed, 17 Aug 2022 11:44:59 +0200 Subject: [PATCH 2/2] Take $CABAL_DIR into account --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 55a53e5c224..411a3a574fb 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,11 @@ endif .PHONY: delete-cache-on-linker-errors delete-cache-on-linker-errors: rm -rf ~/.cache/hie-bios +ifdef CABAL_DIR + rm -rf $(CABAL_DIR)/store +else rm -rf ~/.cabal/store +endif cabal clean # Build all Haskell services and executables with -O0, run unit tests