From d971028e328b99867322ad38f540f76e2b83e100 Mon Sep 17 00:00:00 2001 From: Nathaniel Graff Date: Wed, 13 Mar 2019 08:37:07 -0700 Subject: Clean a single Metal configuration at a time Signed-off-by: Nathaniel Graff --- scripts/libmetal.mk | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/libmetal.mk b/scripts/libmetal.mk index b443ca7..b50c599 100644 --- a/scripts/libmetal.mk +++ b/scripts/libmetal.mk @@ -42,10 +42,19 @@ $(METAL_LIB_DIR)/libmetal.a: $(METAL_LIB_DIR)/libriscv__mmachine__$(TARGET).a $(METAL_LIB_DIR)/libmetal-gloss.a: $(METAL_LIB_DIR)/libriscv__menv__metal.a cp $< $@ +# If we're cleaning the last Metal library for a TARGET, then remove +# the install directory, otherwise just remove the built libs for that +# CONFIGURATION. +ifeq ($(words $(wildcard $(METAL_PREFIX)/lib/*)),1) +METAL_CLEAN = $(METAL_PREFIX) +else +METAL_CLEAN = $(METAL_LIB_DIR) +endif + .PHONY: clean-metal clean-metal: - rm -rf $(METAL_PREFIX) - rm -rf $(BSP_DIR)/build + rm -rf $(METAL_CLEAN) + rm -rf $(METAL_BUILD_DIR) clean: clean-metal metal_install: metal -- cgit v1.2.3