diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -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: |