From 2e76211f70d4310cdea82d88c3dc881b1f0f8df4 Mon Sep 17 00:00:00 2001
From: mikee47 <mike@sillyhouse.net>
Date: Sun, 7 Feb 2021 12:05:51 +0000
Subject: [PATCH] Fix warnings when running `make dist-clean`

---
 Sming/Components/Storage/component.mk | 18 ++++++++----------
 Sming/Makefile                        |  2 +-
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/Sming/Components/Storage/component.mk b/Sming/Components/Storage/component.mk
index ea241d4399..af0307ec78 100644
--- a/Sming/Components/Storage/component.mk
+++ b/Sming/Components/Storage/component.mk
@@ -34,28 +34,26 @@ HWCONFIG_TOOL := \
 	BUILD_BASE=$(BUILD_BASE) \
 	$(PYTHON) $(PARTITION_TOOLS)/hwconfig/hwconfig.py
 
-ifeq (,$(MAKE_DOCS))
+ifeq (,$(MAKE_DOCS)$(MAKE_CLEAN))
 
 # Generate build variables from hardware configuration
 HWCONFIG_MK := $(PROJECT_DIR)/$(OUT_BASE)/hwconfig.mk
 $(shell $(HWCONFIG_TOOL) --quiet expr $(HWCONFIG) $(HWCONFIG_MK) "config.buildVars()")
 include $(HWCONFIG_MK)
+ifeq ($(SMING_ARCH_HW),)
+$(error Hardware configuration error)
+else ifneq ($(SMING_ARCH),$(SMING_ARCH_HW))
+$(error Hardware configuration is for arch $(SMING_ARCH_HW), does not match SMING_ARCH ($(SMING_ARCH)))
+endif
+COMPONENT_CXXFLAGS := -DPARTITION_TABLE_OFFSET=$(PARTITION_TABLE_OFFSET)
 
+# Function to evaluate expression against config
 HWEXPR := $(HWCONFIG_TOOL) $(if $(PART),--part "$(PART)") expr $(HWCONFIG) -
 
 define HwExpr
 $(shell $(HWEXPR) "$1")
 endef
 
-# Import PARTITION_TABLE_OFFSET from hardware configuration
-DEBUG_VARS += PARTITION_TABLE_OFFSET
-ifeq ($(SMING_ARCH_HW),)
-$(error Hardware configuration error)
-else ifneq ($(SMING_ARCH),$(SMING_ARCH_HW))
-$(error Hardware configuration is for arch $(SMING_ARCH_HW), does not match SMING_ARCH ($(SMING_ARCH)))
-endif
-COMPONENT_CXXFLAGS		:= -DPARTITION_TABLE_OFFSET=$(PARTITION_TABLE_OFFSET)
-
 
 ##@Configuration
 
diff --git a/Sming/Makefile b/Sming/Makefile
index 815c7d3024..4ad8476a79 100644
--- a/Sming/Makefile
+++ b/Sming/Makefile
@@ -161,7 +161,7 @@ component-samples-clean: ##Clean all component samples
 
 CLEAN_TESTS := $(TESTS_COMPLETED:complete=clean)
 .PHONY: tests-clean
-tests-clean: $(CLEAN_TESTS) ##Clean all test applications (all arch/build types)
+tests-clean: $(wildcard $(CLEAN_TESTS)) ##Clean all test applications (all arch/build types)
 	-$(Q) rm -f $(TESTS_COMPLETED)
 
 .PHONY: $(CLEAN_TESTS)