Module Name:    src
Committed By:   mrg
Date:           Wed Nov  6 07:26:31 UTC 2019

Modified Files:
        src/tools/gcc: Makefile

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/tools/gcc/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tools/gcc/Makefile
diff -u src/tools/gcc/Makefile:1.96 src/tools/gcc/Makefile:1.97
--- src/tools/gcc/Makefile:1.96	Thu Oct 24 03:19:14 2019
+++ src/tools/gcc/Makefile	Wed Nov  6 07:26:31 2019
@@ -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>
 
@@ -254,6 +254,27 @@ MKENV_BUILD_MAKE=cd .native && ${MKNATIV
 	true
 	@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.native:
 	-rm -r -f .native

Reply via email to