summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk')
-rwxr-xr-xmk19
1 files changed, 16 insertions, 3 deletions
diff --git a/mk b/mk
index 48ab08d3..f3c75a30 100755
--- a/mk
+++ b/mk
@@ -84,12 +84,13 @@ if_make_config=":"
if_build=":" # can be false even if make is true
if_dry_build=":"
eval "`newvar if_not_make_config if_not_build if_not_dry_build if_not_fetch`"
+if_skip_build=":"
# these variables will also be initialised in configure_target
cfgvars="autogenargs cmakedir configureargs badhash badtghash bootstrapargs \
build_depend cleanargs fetch_depend makeargs mkhelper noconfig postmake \
premake release rev tree xarch xgcctree xlang cfgname defscan \
- if_not_skip_build cook_config"
+ if_not_skip_build cook_config seen"
eval "`newvar buildcfg dest_dir elfdir flag forcepull listfile mdir \
mkhelpercfg mode project srcdir target target_dir _tcfg \
@@ -240,8 +241,10 @@ configure_target()
# coreboot needs a .config or it will behave unpredictably. we will
# use the do_build macro to disable builds in this situation. this
# does not disable mkhelpers or dry builds.
- [ ! -d "$target_dir/config" ] && [ "$noconfig" != "y" ] && \
+ if [ ! -d "$target_dir/config" ] && [ "$noconfig" != "y" ]; then
if_not_skip_build=":" # skip make on e.g. ./mk -b coreboot default
+ if_skip_build=""
+ fi
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
return 1
@@ -260,6 +263,17 @@ try_target_config()
eval "`newvar rev tree`"
. "$_tcfg" || err "Can't read '$_tcfg'" configure_target "$@"
+
+ _tname="${_tcfg%/*}"
+ _tname="${_tname##*/}"
+
+ for loopvar in $seen; do
+ [ "$loopvar" = "$_tname" ] && \
+ err "$project/$target: infinite tree loop"
+ done
+
+ seen="$seen $_tname"
+
if [ -n "$rev" ] && [ -z "$tree" ]; then
# this makes setting tree= optional on configless projects
tree="${_tcfg%/target.cfg}"
@@ -280,7 +294,6 @@ try_target_config()
# projects can specify which other projects
# to build first, as declared dependencies:
-# TODO: detect infinite loops
mk_dependencies()
{
bdf="${1-}"