Commit | Line | Data |
---|---|---|
c906108c | 1 | # Makefile for regression testing the m32r simulator. |
6aba47ca | 2 | # Copyright (C) 1998, 2007 Free Software Foundation, Inc. |
c906108c SS |
3 | |
4 | # This file is part of GDB. | |
5 | ||
6 | # GDB 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 2, or (at your option) | |
9 | # any later version. | |
10 | ||
11 | # GDB 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, write to the Free Software | |
18 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
19 | ||
20 | VPATH = @srcdir@ | |
21 | srcdir = @srcdir@ | |
22 | srcroot = $(srcdir)/../../.. | |
23 | ||
24 | prefix = @prefix@ | |
25 | exec_prefix = @exec_prefix@ | |
26 | ||
27 | host_alias = @host_alias@ | |
28 | target_alias = @target_alias@ | |
29 | program_transform_name = @program_transform_name@ | |
30 | build_canonical = @build@ | |
31 | host_canonical = @host@ | |
32 | target_canonical = @target@ | |
33 | target_cpu = @target_cpu@ | |
34 | ||
35 | ||
36 | SHELL = @SHELL@ | |
37 | SUBDIRS = @subdirs@ | |
38 | RPATH_ENVVAR = @RPATH_ENVVAR@ | |
39 | ||
40 | EXPECT = `if [ -f ../../../expect/expect ] ; then \ | |
41 | echo ../../../expect/expect ; \ | |
42 | else echo expect ; fi` | |
43 | ||
44 | RUNTEST = $(RUNTEST_FOR_TARGET) | |
45 | ||
46 | RUNTESTFLAGS = | |
47 | ||
48 | RUNTEST_FOR_TARGET = `\ | |
49 | if [ -f $${srcroot}/dejagnu/runtest ]; then \ | |
50 | echo $${srcroot}/dejagnu/runtest; \ | |
51 | else \ | |
52 | if [ "$(host_canonical)" = "$(target_canonical)" ]; then \ | |
53 | echo runtest; \ | |
54 | else \ | |
55 | t='$(program_transform_name)'; echo runtest | sed -e '' $$t; \ | |
56 | fi; \ | |
57 | fi` | |
58 | ||
59 | ||
60 | AS_FOR_TARGET = `\ | |
61 | if [ -x ../../../gas/as-new ]; then \ | |
62 | echo ../../../gas/as-new ; \ | |
63 | else \ | |
64 | echo $(target_alias)-as ; \ | |
65 | fi` | |
66 | ||
67 | LD_FOR_TARGET = `\ | |
68 | if [ -x ../../../ld/ld-new ]; then \ | |
69 | echo ../../../ld/ld-new ; \ | |
70 | else \ | |
71 | echo $(target_alias)-ld ; \ | |
72 | fi` | |
73 | ||
74 | RUN_FOR_TARGET = `\ | |
75 | if [ -x ../../../sim/${target_cpu}/run ]; then \ | |
76 | echo ../../../sim/${target_cpu}/run ; \ | |
77 | else \ | |
78 | echo $(target_alias)-run ; \ | |
79 | fi` | |
80 | ||
81 | TESTS = \ | |
82 | hello.ok \ | |
83 | exit47.ko | |
84 | ||
85 | check: sanity $(TESTS) | |
86 | sanity: | |
87 | @eval echo AS_FOR_TARGET = $(AS_FOR_TARGET) | |
88 | @eval echo LD_FOR_TARGET = $(LD_FOR_TARGET) | |
89 | @eval echo RUN_FOR_TARGET = $(RUN_FOR_TARGET) | |
90 | ||
91 | ||
92 | ||
93 | # Rules for running all the tests, put into three types | |
94 | # exit success, exit fail, print "Hello World" | |
95 | ||
96 | .u.log: | |
97 | uudecode $*.u | |
98 | $(RUN_FOR_TARGET) $* > $*.log | |
99 | ||
100 | ||
101 | # Rules for running the tests | |
102 | ||
103 | .SUFFIXES: .u .ok .run .hi .ko | |
104 | .run.ok: | |
105 | rm -f tmp-$* $*.hi | |
106 | ulimit -t 5 ; $(RUN_FOR_TARGET) $*.run > tmp-$* | |
107 | mv tmp-$* $*.ok | |
108 | .run.hi: | |
109 | rm -f tmp-$* $*.hi diff-$* | |
110 | ulimit -t 5 ; $(RUN_FOR_TARGET) $*.run > tmp-$* | |
111 | echo "Hello World" | diff - tmp-$* > diff-$* | |
112 | cat tmp-$* diff-$* > $*.hi | |
113 | .run.ko: | |
114 | rm -f tmp-$* $*.ko | |
115 | set +e ; \ | |
116 | ulimit -t 5 ; $(RUN_FOR_TARGET) $*.run > tmp-$* ; \ | |
117 | if [ $$? -eq 47 ] ; then \ | |
118 | exit 0 ; \ | |
119 | else \ | |
120 | exit 1 ; \ | |
121 | fi | |
122 | mv tmp-$* $*.ko | |
123 | ||
124 | ||
125 | # Rules for building all the tests and packing them into | |
126 | # uuencoded files. | |
127 | ||
128 | uuencode: em-pstr.u em-e0.u em-e47.u em-pchr.u | |
129 | ||
130 | .SUFFIXES: .u .s .run | |
131 | .s.u: | |
132 | rm -f $*.o $*.run | |
133 | $(AS_FOR_TARGET) $(srcdir)/$*.s -o $*.o | |
134 | $(LD_FOR_TARGET) -o $* $*.o | |
135 | uuencode < $* $* > $*.u | |
136 | rm -f $*.o $* | |
137 | .s.run: | |
138 | rm -f $*.o $*.run | |
139 | $(AS_FOR_TARGET) $(srcdir)/$*.s -o $*.o | |
140 | $(LD_FOR_TARGET) -o $*.run $*.o | |
141 | rm -f $*.o $* | |
142 | ||
143 | ||
144 | clean mostlyclean: | |
145 | rm -f *~ core *.o a.out | |
146 | rm -f $(TESTS) | |
147 | ||
148 | distclean maintainer-clean realclean: clean | |
149 | rm -f *~ core | |
150 | rm -f Makefile config.status *-init.exp | |
151 | rm -fr *.log summary detail *.plog *.sum *.psum site.* | |
152 | ||
153 | Makefile : Makefile.in config.status | |
154 | $(SHELL) config.status | |
155 | ||
156 | config.status: configure | |
157 | $(SHELL) config.status --recheck |