Makefile: improve uninstall error handling

Introduce helper functions to handle uninstall errors gracefully.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2021-03-19 15:25:24 +01:00
parent e58dae02ac
commit 880cfadde9
4 changed files with 50 additions and 24 deletions

15
tools/helpers.mk Normal file
View File

@@ -0,0 +1,15 @@
#
# Copyright(c) 2021 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
define remove-file
@if [ -f ${1} ] || [ -L ${1} ]; then rm -rf ${1}; \
else echo "WARNING: Cannot find file ${1}"; fi
endef
define remove-directory
@if [ -d ${1} ]; then rm -rf ${1}; \
else echo "WARNING: Cannot find directory ${1}"; fi
endef