From 2d9cff2eb62cd6940270337d2b45fa5f9266d037 Mon Sep 17 00:00:00 2001
From: Gregory Horvath <gphorvath@defenseunicorns.com>
Date: Tue, 17 Sep 2024 10:20:37 -0400
Subject: [PATCH] chore: split up make clean target (#1029)

* split up make clean targets
---
 Makefile    | 18 ++----------------
 mk-clean.mk | 29 +++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 16 deletions(-)
 create mode 100644 mk-clean.mk

diff --git a/Makefile b/Makefile
index 85369df3a..8a7280f6e 100644
--- a/Makefile
+++ b/Makefile
@@ -16,22 +16,8 @@ help: ## Display this help information
 		| sort | awk 'BEGIN {FS = ":.*?## "}; \
 		{printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
 
-clean: ## Clean up all the things (test artifacts, packages, build dirs, compiled .whl files, python eggs)
-	-rm -rf .env .env.email .env.password .pytest_cache
-	-rm -rf .logs
-	-rm -rf ./packages/**/.model/
-	-rm -rf ./**/__pycache__/
-	-rm -rf ./**/.ruff_cache ./.ruff_cache
-	-rm zarf-package-*.tar.zst
-	-rm packages/**/zarf-package-*.tar.zst
-	-rm -rf build/*
-	-rm -rf src/**/build/*
-	-rm -rf packages/**/build/*
-	find . -name 'uds-bundle-*-*.tar.zst' -delete
-	find . -type d -name 'zarf-sbom' -exec rm -rf {} +
-	find . -name '*.whl' -delete
-	find . -type d -name '*.egg-info' -exec rm -rf {} +
-
+## Clean up targets for test artifacts, cachce, etc.
+include mk-clean.mk
 
 gen-python: ## Generate the protobufs for the OpenAI typing within the leapfrogai_api module
 	python3 -m grpc_tools.protoc -I src/leapfrogai_sdk/proto \
diff --git a/mk-clean.mk b/mk-clean.mk
new file mode 100644
index 000000000..690adb256
--- /dev/null
+++ b/mk-clean.mk
@@ -0,0 +1,29 @@
+
+clean-all: clean-artifacts clean-cache clean-env clean-logs clean-models
+
+
+clean-artifacts: # Zarf packages, UDS bundles, Python build artifacts, etc.
+	-rm zarf-package-*.tar.zst
+	-rm packages/**/zarf-package-*.tar.zst
+	-rm -rf build/*
+	-rm -rf src/**/build/*
+	-rm -rf packages/**/build/*
+	find . -name 'uds-bundle-*-*.tar.zst' -delete
+	find . -type d -name 'zarf-sbom' -exec rm -rf {} +
+	find . -name '*.whl' -delete
+	find . -type d -name '*.egg-info' -exec rm -rf {} +
+
+clean-cache:
+	-rm -rf ./**/__pycache__/
+	-rm -rf ./**/.ruff_cache ./.ruff_cache
+
+clean-env:
+	rm -f .env
+	rm -f .env.email
+	rm -f .env.password
+
+clean-logs:
+	-rm -rf ./.logs/
+
+clean-models:
+	-rm -rf ./packages/**/.model/