summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-09-14 17:46:34 +0100
committerLeah Rowe <leah@libreboot.org>2026-09-14 17:46:34 +0100
commit300f2cb434fbf3df31c251e4a555267f1b8799b8 (patch)
tree2e56bb9a3c3bb41f8acc9db8c2a638bb497001ce
parent2c94101884d76453ca81b14578df98ca85e29ead (diff)
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>
-rw-r--r--config/data/u-boot/mkhelper.cfg4
-rwxr-xr-xmk13
2 files changed, 11 insertions, 6 deletions
diff --git a/config/data/u-boot/mkhelper.cfg b/config/data/u-boot/mkhelper.cfg
new file mode 100644
index 00000000..2108034d
--- /dev/null
+++ b/config/data/u-boot/mkhelper.cfg
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+gitclean="y"
+gitcleanargs="-fdx"
diff --git a/mk b/mk
index 0cdef27e..71ea5d0e 100755
--- a/mk
+++ b/mk
@@ -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()