diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -154,12 +154,20 @@ $(BOOTTARGETS): 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);) + $(eval exclusions := $(shell test -d $(template) && \ + find $(template) \ + -maxdepth 1 \ + -type l \ + -print0 \ + | xargs -r -0 -n1 readlink))\ + test -d $(template) && \ + find $(template)/* \ + -maxdepth 0 \ + -type d \ + $(foreach file,$(exclusions),-not -name $(file) ) \ + -not -name base \ + -print0 \ + | xargs -r -0 -n1 rm -rf; ) clean_bases: |