Commit | Line | Data |
---|---|---|
4a306116 | 1 | # Makefile for regression testing the frv simulator. |
e2882c85 | 2 | # Copyright (C) 1998-2018 Free Software Foundation, Inc. |
4a306116 DB |
3 | |
4 | # This file is part of GDB. | |
5 | ||
4744ac1b | 6 | # This program is free software; you can redistribute it and/or modify |
4a306116 | 7 | # it under the terms of the GNU General Public License as published by |
4744ac1b JB |
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, | |
4a306116 DB |
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. | |
4744ac1b | 15 | # |
4a306116 | 16 | # You should have received a copy of the GNU General Public License |
4744ac1b | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
4a306116 DB |
18 | |
19 | VPATH = @srcdir@ | |
20 | srcdir = @srcdir@ | |
21 | srcroot = $(srcdir)/../../.. | |
22 | ||
23 | prefix = @prefix@ | |
24 | exec_prefix = @exec_prefix@ | |
25 | ||
26 | host_alias = @host_alias@ | |
27 | target_alias = @target_alias@ | |
28 | program_transform_name = @program_transform_name@ | |
29 | build_canonical = @build@ | |
30 | host_canonical = @host@ | |
31 | target_canonical = @target@ | |
32 | target_cpu = @target_cpu@ | |
33 | ||
34 | ||
35 | SHELL = @SHELL@ | |
36 | SUBDIRS = @subdirs@ | |
37 | RPATH_ENVVAR = @RPATH_ENVVAR@ | |
38 | ||
39 | EXPECT = `if [ -f ../../../expect/expect ] ; then \ | |
40 | echo ../../../expect/expect ; \ | |
41 | else echo expect ; fi` | |
42 | ||
43 | RUNTEST = $(RUNTEST_FOR_TARGET) | |
44 | ||
45 | RUNTESTFLAGS = | |
46 | ||
47 | RUNTEST_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 | ||
59 | AS_FOR_TARGET = `\ | |
60 | if [ -x ../../../gas/as-new ]; then \ | |
61 | echo ../../../gas/as-new ; \ | |
62 | else \ | |
63 | echo $(target_alias)-as ; \ | |
64 | fi` | |
65 | ||
66 | LD_FOR_TARGET = `\ | |
67 | if [ -x ../../../ld/ld-new ]; then \ | |
68 | echo ../../../ld/ld-new ; \ | |
69 | else \ | |
70 | echo $(target_alias)-ld ; \ | |
71 | fi` | |
72 | ||
73 | RUN_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 | ||
80 | TESTS = \ | |
81 | exit47.ko \ | |
82 | grloop.ok \ | |
83 | hello.ok | |
84 | ||
85 | ||
86 | check: sanity $(TESTS) | |
87 | sanity: | |
88 | @eval echo AS_FOR_TARGET = $(AS_FOR_TARGET) | |
89 | @eval echo LD_FOR_TARGET = $(LD_FOR_TARGET) | |
90 | @eval echo RUN_FOR_TARGET = $(RUN_FOR_TARGET) | |
91 | ||
92 | ||
93 | ||
94 | # Rules for running all the tests, put into three types | |
95 | # exit success, exit fail, print "Hello World" | |
96 | ||
97 | .u.log: | |
98 | uudecode $*.u | |
99 | $(RUN_FOR_TARGET) $* > $*.log | |
100 | ||
101 | ||
102 | # Rules for running the tests | |
103 | ||
104 | .SUFFIXES: .u .ok .run .hi .ko | |
105 | .run.ok: | |
106 | rm -f tmp-$* $*.hi | |
107 | ulimit -t 5 ; $(RUN_FOR_TARGET) $*.run > tmp-$* | |
108 | mv tmp-$* $*.ok | |
109 | .run.hi: | |
110 | rm -f tmp-$* $*.hi diff-$* | |
111 | ulimit -t 5 ; $(RUN_FOR_TARGET) $*.run > tmp-$* | |
112 | echo "Hello World" | diff - tmp-$* > diff-$* | |
113 | cat tmp-$* diff-$* > $*.hi | |
114 | .run.ko: | |
115 | rm -f tmp-$* $*.ko | |
116 | set +e ; \ | |
117 | ulimit -t 5 ; $(RUN_FOR_TARGET) $*.run > tmp-$* ; \ | |
118 | if [ $$? -eq 47 ] ; then \ | |
119 | exit 0 ; \ | |
120 | else \ | |
121 | exit 1 ; \ | |
122 | fi | |
123 | mv tmp-$* $*.ko | |
124 | ||
125 | ||
126 | # Rules for building all the tests and packing them into | |
127 | # uuencoded files. | |
128 | ||
129 | uuencode: em-pstr.u em-e0.u em-e47.u em-pchr.u | |
130 | ||
131 | .SUFFIXES: .u .s .run | |
132 | .s.u: | |
133 | rm -f $*.o $*.run | |
134 | $(AS_FOR_TARGET) $(srcdir)/$*.s -o $*.o | |
135 | $(LD_FOR_TARGET) -o $* $*.o | |
136 | uuencode < $* $* > $*.u | |
137 | rm -f $*.o $* | |
138 | .s.run: | |
139 | rm -f $*.o $*.run | |
140 | $(AS_FOR_TARGET) $(srcdir)/$*.s -o $*.o | |
141 | $(LD_FOR_TARGET) -o $*.run $*.o | |
142 | rm -f $*.o $* | |
143 | ||
144 | ||
145 | clean mostlyclean: | |
146 | rm -f *~ core *.o a.out | |
147 | rm -f $(TESTS) | |
148 | ||
149 | distclean maintainer-clean realclean: clean | |
150 | rm -f *~ core | |
151 | rm -f Makefile config.status *-init.exp | |
152 | rm -fr *.log summary detail *.plog *.sum *.psum site.* | |
153 | ||
154 | Makefile : Makefile.in config.status | |
155 | $(SHELL) config.status | |
156 | ||
157 | config.status: configure | |
158 | $(SHELL) config.status --recheck |