On 04.03.19, 13:26, "Florian Schmidt" <Florian.Schmidt@xxxxxxxxx> wrote:
This rule allows to clean all intermediate files, but keep the final
image(s). Simply removing the final image from the LIBPLAT_CLEAN works
because the image itself is also cleaned by removing all UK_IMAGES in a
further clean step (which happened to be a noop until now).
Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
---
Makefile | 12 ++++++++----
plat/kvm/Linker.uk | 1 -
plat/linuxu/Linker.uk | 1 -
plat/xen/Linker.uk | 1 -
4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 8e81c64b..4a0c8c70 100644
--- a/Makefile
+++ b/Makefile
@@ -532,10 +532,12 @@ all: images
# Generate cleaning rules
include $(CONFIG_UK_BASE)/support/build/Makefile.clean
-clean: $(addprefix clean-,\
+clean-libs: $(addprefix clean-,\
$(foreach P,$(UK_PLATS) $(UK_PLATS-y),\
$(if $(call qstrip,$($(call uc,$(P))_LIBS) $($(call uc,$(P))_LIBS-y)),\
$(foreach L,$($(call uc,$(P))_LIBS) $($(call uc,$(P))_LIBS-y), $(L))))
$(UK_LIBS) $(UK_LIBS-y))
+
+clean: clean-libs
$(call verbose_cmd,CLEAN,build/,$(RM) \
$(UK_CONFIG_OUT) \
$(call build_clean,$(UK_IMAGES-y)) \
@@ -545,7 +547,7 @@ else # !($(UK_HAVE_DOT_CONFIG),y)
all: menuconfig
-.PHONY: prepare image libs objs clean
+.PHONY: prepare image libs objs clean-libs clean
fetch: menuconfig
@@ -557,7 +559,7 @@ libs: menuconfig
images: menuconfig
-clean:
+clean-libs clean:
$(error Do not know which files to clean without having a
configuration. Did you mean 'properclean' or 'distclean'?)
endif
@@ -757,8 +759,10 @@ help:
@echo 'Cleaning:'
@echo ' clean-[LIBNAME] - delete all files created by build for
a single library'
@echo ' (e.g., clean-libfdt)'
+ @echo ' clean-libs - delete all files created by build for
all libraries'
+ @echo ' but keep final images and fetched
files'
@echo ' clean - delete all files created by build for
all libraries'
- @echo ' but keep fetched files'
+ @echo ' including final images, but keep
fetched files'
@echo ' properclean - delete build directory'
@echo ' distclean - delete build directory and
configurations (including .config)'
@echo ''
diff --git a/plat/kvm/Linker.uk b/plat/kvm/Linker.uk
index 3e6747d5..3cb29668 100644
--- a/plat/kvm/Linker.uk
+++ b/plat/kvm/Linker.uk
@@ -61,7 +61,6 @@ endif
UK_IMAGES-$(CONFIG_PLAT_KVM) += $(KVM_IMAGE)
# ...for cleaning:
-LIBKVMPLAT_CLEAN += $(call build_clean,$(KVM_IMAGE))
LIBKVMPLAT_CLEAN += $(call build_clean,$(KVM_IMAGE).gz)
What if remove the .gz here, add it to UK_IMAGES and split the image creation
rules into two:
First creating the uncompressed image and another rule that creates the gz
image based on the uncompressed.
The equivalent we would need to do for Xen.
LIBKVMPLAT_CLEAN += $(call build_clean,$(KVM_IMAGE).dbg)
LIBKVMPLAT_CLEAN += $(call build_clean,$(KVM_IMAGE).sym)
diff --git a/plat/linuxu/Linker.uk b/plat/linuxu/Linker.uk
index dbdf9d96..5dba5a10 100644
--- a/plat/linuxu/Linker.uk
+++ b/plat/linuxu/Linker.uk
@@ -37,6 +37,5 @@ endif
UK_IMAGES-$(CONFIG_PLAT_LINUXU) += $(LINUXU_IMAGE)
# ...for cleaning:
-LIBLINUXUPLAT_CLEAN += $(call build_clean,$(LINUXU_IMAGE))
LIBLINUXUPLAT_CLEAN += $(call build_clean,$(LINUXU_IMAGE).dbg)
LIBLINUXUPLAT_CLEAN += $(call build_clean,$(LINUXU_IMAGE).sym)
diff --git a/plat/xen/Linker.uk b/plat/xen/Linker.uk
index 801f5e2e..497fa47b 100644
--- a/plat/xen/Linker.uk
+++ b/plat/xen/Linker.uk
@@ -89,4 +89,3 @@ LIBXENPLAT_CLEAN += $(call build_clean,$(XEN_IMAGE).elf)
LIBXENPLAT_CLEAN += $(call build_clean,$(XEN_IMAGE).gz)
LIBXENPLAT_CLEAN += $(call build_clean,$(XEN_IMAGE).dbg)
LIBXENPLAT_CLEAN += $(call build_clean,$(XEN_IMAGE).sym)
-LIBXENPLAT_CLEAN += $(call build_clean,$(XEN_IMAGE))
--
2.21.0
What do you think?
Thanks,
Simon