From 919a52e7878bd57a2b8dcc2ef946c66904b2375f Mon Sep 17 00:00:00 2001 From: Thiago Abdo Date: Tue, 29 Oct 2019 13:20:34 +0100 Subject: When removing a target you should also remove the link to it Signed-off-by: Thiago Abdo --- Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7486bc9..f662007 100644 --- a/Makefile +++ b/Makefile @@ -220,11 +220,16 @@ $(COMPRESSTARGETS): # Safe removal of images $(BASERMTARGETS): rm/%: %/*.backinglock - @rm -rf $(@) + $(eval BUILD_DIR := $(subst rm/,,$(@))) + @rm -rf $(BUILD_DIR) $(PROVRMTARGETS): rm/%: %/build/*.backinglock - @rm -rf $(@) + $(eval BUILD_DIR := $(subst rm/,,$(@))/build) + $(eval FATHER_BUILD := $(dir $(shell qemu-img info $(BUILD_DIR)/rootfs-image | grep "backing file" | cut -d\ -f3-))) + $(eval BUILD_TIME := $(subst .,,$(suffix $(@)))) + @rm -rf $(FATHER_BUILD)/$(BUILD_TIME).backinglock + @rm -rf $(BUILD_DIR) %.backinglock: backinglock @qemu-img convert -f qcow2 $(@)/build/rootfs-image -O qcow2 $(@)/build/rootfs-image.tmp -- cgit v1.2.3-55-g7522