summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathaniel Graff <nathaniel.graff@sifive.com>2019-03-13 08:37:07 -0700
committerNathaniel Graff <nathaniel.graff@sifive.com>2019-03-13 08:42:11 -0700
commitd971028e328b99867322ad38f540f76e2b83e100 (patch)
tree6497ca9bfb1fb8fdc8e35dc46360cbdf95bc71f8
parente106e9e51e8c8e9aca053f1cdc3d49c85df98212 (diff)
Clean a single Metal configuration at a time
Signed-off-by: Nathaniel Graff <nathaniel.graff@sifive.com>
-rw-r--r--scripts/libmetal.mk13
1 files changed, 11 insertions, 2 deletions
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