From 1f4ffcc981cf752742eb672d93d8f3699e330198 Mon Sep 17 00:00:00 2001 From: Ian Leonard Date: Sat, 9 Apr 2022 01:35:47 +0000 Subject: [PATCH 1/2] scripts/makefile_helper: initial commit The buildsystem's Makefile hardcodes the location of the BUILD_DIR used by the rest of the buildsystem. Add a script to handle what BUILD_DIR might be set to. Signed-off-by: Ian Leonard --- scripts/makefile_helper | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 scripts/makefile_helper diff --git a/scripts/makefile_helper b/scripts/makefile_helper new file mode 100755 index 0000000000..dfcf40dd16 --- /dev/null +++ b/scripts/makefile_helper @@ -0,0 +1,23 @@ +#!/bin/bash + +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2022-present Team LibreELEC (https://libreelec.tv) + +set -e + +# If config/options can't be sourced, abort. PWD isn't the expected ROOT. +. config/options "" + +# task handling +case $1 in + --clean) + rm -rf "${BUILD_ROOT}/${BUILD_BASE}."*/* "${BUILD_ROOT}/${BUILD_BASE}."*/.stamps + ;; + --distclean) + rm -rf "${BUILD_ROOT}/.ccache" "${BUILD_ROOT}/${BUILD_BASE}."* + ;; + *) + echo "error: ${0}: unsupported option on CLI; aborting" + exit 1 + ;; +esac From fadea6582a4af4abd9e31ccfb8ff86df2ed13e40 Mon Sep 17 00:00:00 2001 From: Ian Leonard Date: Sat, 9 Apr 2022 02:33:43 +0000 Subject: [PATCH 2/2] Makefile: use makefile_helper Signed-off-by: Ian Leonard --- Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9de5e6c308..300f5e2d6d 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,3 @@ -BUILD_DIRS=build.* - all: release system: @@ -15,10 +13,10 @@ noobs: ./scripts/image noobs clean: - rm -rf $(BUILD_DIRS)/* $(BUILD_DIRS)/.stamps + ./scripts/makefile_helper --clean distclean: - rm -rf ./.ccache ./$(BUILD_DIRS) + ./scripts/makefile_helper --distclean src-pkg: tar cvJf sources.tar.xz sources