summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 11 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 380c4f6..1b000e1 100644
--- a/Makefile
+++ b/Makefile
@@ -81,7 +81,7 @@ check_rootpw = $(if $(strip $(ROOTPW)),\
)
-.PHONY: help clean
+.PHONY: help clean_except_last
help:
@@ -131,10 +131,16 @@ $(BOOTTARGETS):
@mv $(BUILD_DIR)/$(ANSIBLE_DIR)/boot_files $(BUILD_DIR)/build/boot
-# The builds directories are named after the template name
-# TODO: needs refactoring
-clean:
- -$(foreach build_dir,$(TEMPLATES),test -d $(build_dir) && rm -rf $(build_dir);)
+clean_except_last:
+ @-$(foreach template,$(TEMPLATES),\
+ $(foreach flavor,$(FLAVORS),\
+ test -d $(template) && \
+ find $(template)/* -maxdepth 0 -type d \
+ -not -name base \
+ -not -wholename $(template)/$$(readlink $(template)/$(flavor).latest) \
+ -print0 | xargs -0 rm -rf \
+ );\
+ )
help: