1# Makefile for regression testing the m32r simulator. 2# Copyright (C) 1998, 2007 Free Software Foundation, Inc. 3 4# This file is part of GDB. 5 6# This program is free software; you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation; either version 3 of the License, or 9# (at your option) any later version. 10# 11# This program is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU General Public License for more details. 15# 16# You should have received a copy of the GNU General Public License 17# along with this program. If not, see <http://www.gnu.org/licenses/>. 18 19VPATH = @srcdir@ 20srcdir = @srcdir@ 21srcroot = $(srcdir)/../../.. 22 23prefix = @prefix@ 24exec_prefix = @exec_prefix@ 25 26host_alias = @host_alias@ 27target_alias = @target_alias@ 28program_transform_name = @program_transform_name@ 29build_canonical = @build@ 30host_canonical = @host@ 31target_canonical = @target@ 32target_cpu = @target_cpu@ 33 34 35SHELL = @SHELL@ 36SUBDIRS = @subdirs@ 37RPATH_ENVVAR = @RPATH_ENVVAR@ 38 39EXPECT = `if [ -f ../../../expect/expect ] ; then \ 40 echo ../../../expect/expect ; \ 41 else echo expect ; fi` 42 43RUNTEST = $(RUNTEST_FOR_TARGET) 44 45RUNTESTFLAGS = 46 47RUNTEST_FOR_TARGET = `\ 48 if [ -f $${srcroot}/dejagnu/runtest ]; then \ 49 echo $${srcroot}/dejagnu/runtest; \ 50 else \ 51 if [ "$(host_canonical)" = "$(target_canonical)" ]; then \ 52 echo runtest; \ 53 else \ 54 t='$(program_transform_name)'; echo runtest | sed -e '' $$t; \ 55 fi; \ 56 fi` 57 58 59AS_FOR_TARGET = `\ 60 if [ -x ../../../gas/as-new ]; then \ 61 echo ../../../gas/as-new ; \ 62 else \ 63 echo $(target_alias)-as ; \ 64 fi` 65 66LD_FOR_TARGET = `\ 67 if [ -x ../../../ld/ld-new ]; then \ 68 echo ../../../ld/ld-new ; \ 69 else \ 70 echo $(target_alias)-ld ; \ 71 fi` 72 73RUN_FOR_TARGET = `\ 74 if [ -x ../../../sim/${target_cpu}/run ]; then \ 75 echo ../../../sim/${target_cpu}/run ; \ 76 else \ 77 echo $(target_alias)-run ; \ 78 fi` 79 80TESTS = \ 81 hello.ok \ 82 exit47.ko 83 84check: sanity $(TESTS) 85sanity: 86 @eval echo AS_FOR_TARGET = $(AS_FOR_TARGET) 87 @eval echo LD_FOR_TARGET = $(LD_FOR_TARGET) 88 @eval echo RUN_FOR_TARGET = $(RUN_FOR_TARGET) 89 90 91 92# Rules for running all the tests, put into three types 93# exit success, exit fail, print "Hello World" 94 95.u.log: 96 uudecode $*.u 97 $(RUN_FOR_TARGET) $* > $*.log 98 99 100# Rules for running the tests 101 102.SUFFIXES: .u .ok .run .hi .ko 103.run.ok: 104 rm -f tmp-$* $*.hi 105 ulimit -t 5 ; $(RUN_FOR_TARGET) $*.run > tmp-$* 106 mv tmp-$* $*.ok 107.run.hi: 108 rm -f tmp-$* $*.hi diff-$* 109 ulimit -t 5 ; $(RUN_FOR_TARGET) $*.run > tmp-$* 110 echo "Hello World" | diff - tmp-$* > diff-$* 111 cat tmp-$* diff-$* > $*.hi 112.run.ko: 113 rm -f tmp-$* $*.ko 114 set +e ; \ 115 ulimit -t 5 ; $(RUN_FOR_TARGET) $*.run > tmp-$* ; \ 116 if [ $$? -eq 47 ] ; then \ 117 exit 0 ; \ 118 else \ 119 exit 1 ; \ 120 fi 121 mv tmp-$* $*.ko 122 123 124# Rules for building all the tests and packing them into 125# uuencoded files. 126 127uuencode: em-pstr.u em-e0.u em-e47.u em-pchr.u 128 129.SUFFIXES: .u .s .run 130.s.u: 131 rm -f $*.o $*.run 132 $(AS_FOR_TARGET) $(srcdir)/$*.s -o $*.o 133 $(LD_FOR_TARGET) -o $* $*.o 134 uuencode < $* $* > $*.u 135 rm -f $*.o $* 136.s.run: 137 rm -f $*.o $*.run 138 $(AS_FOR_TARGET) $(srcdir)/$*.s -o $*.o 139 $(LD_FOR_TARGET) -o $*.run $*.o 140 rm -f $*.o $* 141 142 143clean mostlyclean: 144 rm -f *~ core *.o a.out 145 rm -f $(TESTS) 146 147distclean maintainer-clean realclean: clean 148 rm -f *~ core 149 rm -f Makefile config.status *-init.exp 150 rm -fr *.log summary detail *.plog *.sum *.psum site.* 151 152Makefile : Makefile.in config.status 153 $(SHELL) config.status 154 155config.status: configure 156 $(SHELL) config.status --recheck 157