mk: remove u-boot-specific git-clean handling

yes, make it generalised. use a new variable in
mkhelper.cfg, gitclean and gitcleanargs

not enabled by default, but u-boot enables it. i'm
considering whether to use this by default, as it
is the general policy of lbmk to clean everything
just after a build, as builds are cached out of
tree. this way, we can do re-builds safely for each
project. there are probably a lot of subtle bugs that
might be fixed if we used this

the problem is that this is currently only used on
lbmk.git, but not on libreboot release archives which
lack .git directories; the main one is initialised in
lbmk, but not in upstream sources. we could just initialise
those.

in fact, that is probably what i'm going to do.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-09-14 17:46:34 +01:00
parent 2c94101884
commit 300f2cb434
2 changed files with 11 additions and 6 deletions
+4
View File
@@ -0,0 +1,4 @@
# SPDX-License-Identifier: GPL-3.0-or-later
gitclean="y"
gitcleanargs="-fdx"
+7 -6
View File
@@ -74,7 +74,7 @@ eval "`newvar autoconfargs autogenargs badhash badtghash bootstrapargs \
build_depend buildtype cleanargs cmakedir cmd defconfig dest_dir elfdir \
forcepull listfile makeargs mdir mkhelper mkhelpercfg mode postmake \
premake project release rev srcdir target target_dir tree xarch xgcctree \
xlang`"
xlang gitclean gitcleanargs`"
main()
{
@@ -268,7 +268,7 @@ configure_project()
eval "`newvar autoconfargs badhash badtghash bootstrapargs \
build_depend buildtype cleanargs makeargs mkhelper postmake \
premake release xarch xgcctree xlang`"
premake release xarch xgcctree xlang gitclean gitcleanargs`"
[ ! -f "$_tcfg" ] && \
buildtype="auto"
@@ -503,10 +503,11 @@ handle_makefile()
$if_not_dry_build \
x_ cp "$srcdir/$_copy" "$defconfig"; :
[ -e "$srcdir/.git" ] && [ "$project" = "u-boot" ] && \
[ "$mode" = "distclean" ] && \
$if_not_dry_build \
x_ git -C "$srcdir" clean -fdx; :
[ -e "$srcdir/.git" ] && [ "$gitclean" = "y" ] && \
if [ "$mode" = "distclean" ] || [ "$mode" = "clean" ]; then
$if_not_dry_build \
x_ git -C "$srcdir" clean $gitcleanargs; :
fi; :
}
run_make_command()