add something to auto-detect when GCC has changed from gcc to gcc.old

or back and auto-cleandir tools/gcc.

based upon the code for PREVIOUSTOOLDIR in tools/Makefile.
This commit is contained in:
mrg 2019-11-06 07:26:31 +00:00
parent 9cce0b0a08
commit 500cd05674

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.96 2019/10/24 03:19:14 christos Exp $ # $NetBSD: Makefile,v 1.97 2019/11/06 07:26:31 mrg Exp $
.include <bsd.hostinit.mk> .include <bsd.hostinit.mk>
@ -254,6 +254,27 @@ MKENV_BUILD_MAKE=cd .native && ${MKNATIVE_ENV} ${BUILD_MAKE}
true true
@touch $@ @touch $@
.if !defined(PREV_GCC)
. if exists(PREV_GCC)
PREV_GCC!= cat PREV_GCC
. else
PREV_GCC=
. endif
.endif
CLEANFILES+= PREV_GCC
realall realdepend: .MAKE
.if !empty(PREV_GCC) && "${PREV_GCC}" != "${EXTERNAL_GCC_SUBDIR}-${HAVE_GCC}"
@echo "*** WARNING: GCC has changed version?"
@echo "*** PREV_GCC '${PREV_GCC}'"
@echo "*** != EXTERNAL_GCC_SUBDIR-HAVE_GCC '${EXTERNAL_GCC_SUBDIR}-${HAVE_GCC}'"
@echo "*** Cleaning mis-matched tools/gcc"
rm -f PREV_GCC
(cd ${.CURDIR} && ${MAKE} cleandir)
.endif
echo ${EXTERNAL_GCC_SUBDIR}-${HAVE_GCC} >PREV_GCC
clean: clean.native clean: clean.native
clean.native: clean.native:
-rm -r -f .native -rm -r -f .native