2016-04-21 11:59:27 +03:00
# usage $(call CheckSubmoduleTemplate (name,MAKEFILE VAR,repo name))
# usage $(call CheckSubmoduleTemplate (mono,MONO,mono))
2018-02-09 17:20:06 +03:00
THISDIR = $( TOP) /mk
2019-05-29 15:57:49 +03:00
i n c l u d e $( THISDIR ) / c o l o r s . m k
2017-07-19 10:35:05 +03:00
2016-04-21 11:59:27 +03:00
d e f i n e C h e c k S u b m o d u l e T e m p l a t e
2016-04-21 19:01:11 +03:00
#$(eval NEEDED_$(2)_VERSION:=$(shell git --git-dir $(abspath $($(2)_PATH)/../..)/.git --work-tree $(abspath $($(2)_PATH)/../..) ls-tree HEAD --full-tree -- external/$(1) | awk -F' ' '{printf "%s",$$3}'))
2016-04-21 11:59:27 +03:00
#$(eval $(2)_VERSION:=$$$$(shell cd $($(2)_PATH) 2>/dev/null && git rev-parse HEAD 2>/dev/null))
check-$(1) ::
i f e q ( $$ ( I G N O R E _ $( 2) _ V E R S I O N ) , )
2018-02-09 17:20:06 +03:00
@rm -f $( THISDIR) /.stamp-reset-$( 1)
2016-04-21 11:59:27 +03:00
@if test ! -d $( $( 2) _PATH) ; then \
if test x$$ ( RESET_VERSIONS) != "x" ; then \
make reset-$( 1) || exit 1; \
else \
2017-07-19 10:35:05 +03:00
echo " Your $( 1) checkout is $( COLOR_RED) missing $( COLOR_CLEAR) , please run 'git submodule update --init --recursive -- external/ $( 1) ' " ; \
2016-04-21 11:59:27 +03:00
touch .check-versions-failure; \
fi ; \
else \
if test " x $( $( 2) _VERSION) " != " x $( NEEDED_$( 2) _VERSION) " ; then \
if test x$$ ( RESET_VERSIONS) != "x" ; then \
make reset-$( 1) || exit 1; \
else \
2017-07-19 10:35:05 +03:00
echo " Your $( 1) version is $( COLOR_RED) out of date $( COLOR_CLEAR) , please run 'make reset- $( 1) ' (found $( $( 2) _VERSION) , expected $( NEEDED_$( 2) _VERSION) ). Alternatively export IGNORE_ $( 2) _VERSION=1 to skip this check. " ; \
2016-04-21 11:59:27 +03:00
test -z " $( BUILD_REVISION) " || $( MAKE) test-$( 1) ; \
touch .check-versions-failure; \
fi ; \
else \
2017-07-19 10:35:05 +03:00
echo " $( 1) is $( COLOR_GREEN) up-to-date $( COLOR_CLEAR) . " ; \
2016-04-21 11:59:27 +03:00
fi ; \
fi
e l s e
2017-07-19 10:35:05 +03:00
@echo " $( 1) is $( COLOR_GRAY) ignored $( COLOR_CLEAR) . "
2016-04-21 11:59:27 +03:00
e n d i f
test-$(1) ::
@echo $( 1)
@echo " NEEDED_ $( 2) _VERSION= $( NEEDED_$( 2) _VERSION) "
@echo " $( 2) _VERSION= $( $( 2) _VERSION) "
@echo " $( 2) _PATH= $( $( 2) _PATH) => $( abspath $( $( 2) _PATH) ) "
reset-$(1) ::
i f n e q ( $$ ( I G N O R E _ $( 2) _ V E R S I O N ) , )
@echo " *** Not resetting $( 1) because IGNORE_ $( 2) _VERSION is set "
e l s e
@echo " *** git submodule update --init --recursive --force -- $( TOP) /external/ $( 1) "
2016-04-21 19:01:11 +03:00
cd $( abspath $( $( 2) _PATH) /../..) && git submodule update --init --recursive --force -- ./external/$( 1)
2018-02-09 17:20:06 +03:00
@touch $( THISDIR) /.stamp-reset-$( 1)
2016-04-21 11:59:27 +03:00
e n d i f
print-$(1) ::
@printf "*** %-16s %-45s %s (%s)\n" " $( 1) " " $( shell git config submodule.external/$( 1) .url) " " $( NEEDED_$( 2) _VERSION) " " $( shell git config -f $( abspath $( TOP) /.gitmodules) submodule.external/$( 1) .branch) "
.PHONY : check -$( 1) reset -$( 1) print -$( 1)
2018-02-09 17:20:06 +03:00
reset-versions-impl :: reset -$( 1)
2016-04-21 11:59:27 +03:00
check-versions :: check -$( 1)
print-versions :: print -$( 1)
e n d e f
2016-04-21 14:18:44 +03:00
$( shell rm -f .check -versions -failure )
2019-05-12 19:06:06 +03:00
2016-04-21 15:30:02 +03:00
$( eval $ ( call CheckSubmoduleTemplate ,Touch .Unit ,TOUCH_UNIT ) )
$( eval $ ( call CheckSubmoduleTemplate ,opentk ,OPENTK ) )
2016-04-21 16:40:25 +03:00
$( eval $ ( call CheckSubmoduleTemplate ,Xamarin .MacDev ,XAMARIN_MACDEV ) )
2017-11-27 18:59:12 +03:00
$( eval $ ( call CheckSubmoduleTemplate ,macios -binaries ,MACIOS_BINARIES ) )
2020-10-05 16:43:32 +03:00
$( eval $ ( call CheckSubmoduleTemplate ,ikvm -fork ,IKVM ) )
2021-10-26 09:18:34 +03:00
$( eval $ ( call CheckSubmoduleTemplate ,MonoTouch .Dialog ,MONOTOUCH_DIALOG ) )
2016-04-21 14:18:44 +03:00
2016-04-21 19:01:11 +03:00
i n c l u d e $( TOP ) / m k / x a m a r i n . m k
2016-04-21 11:59:27 +03:00
check-versions ::
@if test -e .check-versions-failure; then \
rm .check-versions-failure; \
2017-07-19 10:35:05 +03:00
echo " $( COLOR_RED) One or more modules needs update $( COLOR_CLEAR) " ; \
2016-04-21 11:59:27 +03:00
exit 1; \
else \
echo All dependent modules up to date; \
fi
all-local :: check -versions
2018-02-09 17:20:06 +03:00
reset : RESET_VERSIONS =1
reset : check -versions
$( Q) ! test -f $( THISDIR) /.stamp-reset-maccore || ( echo " $( COLOR_GRAY) Checking again since maccore changed $( COLOR_CLEAR) " && $( MAKE) check-versions RESET_VERSIONS = 1 )
reset-versions : reset -versions -impl
$( Q) ! test -f $( THISDIR) /.stamp-reset-maccore || ( echo " $( COLOR_GRAY) Checking again since maccore changed $( COLOR_CLEAR) " && $( MAKE) reset-versions-impl )