From 6c08487bc2fff10f547353eafedc0c7134f3df27 Mon Sep 17 00:00:00 2001
From: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 19 Aug 1997 15:36:20 +0000
Subject: [PATCH]         * Makefile.in (EXPECT, RUNTEST, RUNTESTFLAGS):
 Define.         (site.exp, check, check-g++, check-gcc): New targets. For
 dejagnu.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@14845 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog   |   5 +++
 gcc/Makefile.in | 103 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 78200b802cff..ee98b2d4a21b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Tue Aug 19 09:34:57 1997  Jeffrey A Law  (law@cygnus.com)
+
+	* Makefile.in (EXPECT, RUNTEST, RUNTESTFLAGS): Define.
+	(site.exp, check, check-g++, check-gcc): New targets.
+
 Mon Aug 18 17:39:02 1997  Mike Meissner  <meissner@cygnus.com>
 
 	* configure.in ({powerpc,rs6000}*-*-*, --with-cpu): Remove single
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 189f43241943..d30e9ce99945 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -400,6 +400,16 @@ INSTALL_TARGET=install-normal
 # Source for float.h.  Overridden by cross-make.
 FLOAT_H=float.h-nat
 
+# Setup the testing framework, if you have one
+EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \
+            echo $${rootme}/../expect/expect ; \
+          else echo expect ; fi`
+
+RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
+	       echo $${srcdir}/../dejagnu/runtest ; \
+	    else echo runtest; fi`
+RUNTESTFLAGS =
+
 # Extra symbols for fixproto to define when parsing headers.
 FIXPROTO_DEFINES = 
 
@@ -2353,6 +2363,99 @@ uninstall: lang.uninstall
 	-rm -rf $(mandir)/protoize$(manext)
 	-rm -rf $(mandir)/unprotoize$(manext)
 #
+# These targets are for the dejagnu testsuites. The file site.exp 
+# contains global variables that all the testsuites will use.
+
+# Set to $(target_alias)/ for cross.
+target_subdir = @target_subdir@
+
+site.exp: ./config.status Makefile
+	@echo "Making a new config file..."
+	-@rm -f ./tmp?
+	@touch site.exp
+	-@mv site.exp site.bak
+	@echo "## these variables are automatically generated by make ##" > ./tmp0
+	@echo "# Do not edit here. If you wish to override these values" >> ./tmp0
+	@echo "# add them to the last section" >> ./tmp0
+	@echo "set rootme \"`pwd`\"" >> ./tmp0
+	@echo "set srcdir \"`cd ${srcdir}; pwd`\"" >> ./tmp0
+	@echo "set host_triplet $(host_canonical)" >> ./tmp0
+	@echo "set build_triplet $(build_canonical)" >> ./tmp0
+	@echo "set target_triplet $(target)" >> ./tmp0
+	@echo "set target_alias $(target_alias)" >> ./tmp0
+# CFLAGS is set even though it's empty to show we reserve the right to set it.
+	@echo "set CFLAGS \"\"" >> ./tmp0
+	@echo "set CXXFLAGS \"-I$(objdir)/../$(target_subdir)libio -I\$$srcdir/../libg++/src -I\$$srcdir/../libio -I\$$srcdir/../libstdc++ -I\$$srcdir/../libstdc++/stl -L$(objdir)/../$(target_subdir)libg++ -L$(objdir)/../$(target_subdir)libstdc++\"" >> ./tmp0
+# If newlib has been configured, we need to pass -B to gcc so it can find
+# newlib's crt0.o if it exists.  This will cause a "path prefix not used"
+# message if it doesn't, but the testsuite is supposed to ignore the message -
+# it's too difficult to tell when to and when not to pass -B (not all targets
+# have crt0's).  We could only add the -B if ../newlib/crt0.o exists, but that
+# seems like too selective a test.
+# ??? Another way to solve this might be to rely on linker scripts.  Then
+# theoretically the -B won't be needed.
+# We also need to pass -L ../ld so that the linker can find ldscripts.
+	@if [ -d $(objdir)/../$(target_subdir)newlib ] ; then \
+	  echo "set newlib_cflags \"-I$(objdir)/../$(target_subdir)newlib/targ-include -I\$$srcdir/../newlib/libc/include\"" >> ./tmp0; \
+	  echo "set newlib_ldflags \"-B$(objdir)/../$(target_subdir)newlib/\"" >> ./tmp0; \
+	  echo "append CFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
+	  echo "append CXXFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
+	  echo "append LDFLAGS \" \$$newlib_ldflags\"" >> ./tmp0; \
+	else true; \
+	fi
+	@if [ -d $(objdir)/../ld ] ; then \
+	  echo "append LDFLAGS \" -L$(objdir)/../ld\"" >> ./tmp0; \
+	else true; \
+	fi
+	@if  [ $(build_canonical) != $(host_canonical) ] ; then \
+	  echo "set tmpdir /tmp" >> ./tmp0 ; \
+	else echo "set tmpdir $(objdir)/testsuite" >> ./tmp0 ; \
+	fi
+	@echo "set srcdir \"\$${srcdir}/testsuite\"" >> ./tmp0
+	@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
+	@cat ./tmp0 > site.exp
+	@cat site.bak | sed \
+		-e '1,/^## All variables above are.*##/ d' >> site.exp
+	-@rm -f ./tmp?
+
+CHECK_TARGETS = check-gcc check-g++
+
+check: $(CHECK_TARGETS)
+
+check-g++: site.exp
+	if [ -d testsuite ]; then \
+	  true; \
+	else \
+	  mkdir testsuite; \
+	fi
+	rm -rf testsuite/site.exp
+	cp site.exp testsuite/site.exp
+	rootme=`pwd`; export rootme; \
+	srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
+	cd testsuite; \
+	EXPECT=${EXPECT} ; export EXPECT ; \
+	if [ -f $${rootme}/../expect/expect ] ; then  \
+	   TCL_LIBRARY=$${srcdir}/../tcl/library ; \
+	    export TCL_LIBRARY ; fi ; \
+	$(RUNTEST) --tool g++ $(RUNTESTFLAGS)
+
+check-gcc: site.exp
+	if [ -d testsuite ]; then \
+	  true; \
+	else \
+	  mkdir testsuite; \
+	fi
+	rm -rf testsuite/site.exp
+	cp site.exp testsuite/site.exp
+	rootme=`pwd`; export rootme; \
+	srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
+	cd testsuite; \
+	EXPECT=${EXPECT} ; export EXPECT ; \
+	if [ -f $${rootme}/../expect/expect ] ; then  \
+	   TCL_LIBRARY=$${srcdir}/../tcl/library ; \
+	   export TCL_LIBRARY ; fi ; \
+	$(RUNTEST) --tool gcc $(RUNTESTFLAGS)
+
 # These exist for maintenance purposes.
 
 # Update the tags table.
-- 
GitLab