Commit | Line | Data |
---|---|---|
32d0add0 | 1 | # Copyright 2004-2015 Free Software Foundation, Inc. |
d40d2c92 JB |
2 | # |
3 | # This program is free software; you can redistribute it and/or modify | |
4 | # it under the terms of the GNU General Public License as published by | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
d40d2c92 | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
d40d2c92 JB |
8 | # This program is distributed in the hope that it will be useful, |
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | # GNU General Public License for more details. | |
e22f8b7c | 12 | # |
d40d2c92 | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
d40d2c92 | 15 | |
034cb681 JB |
16 | # Compile some Ada code. |
17 | ||
18 | proc gdb_compile_ada {source dest type options} { | |
19 | ||
464dd14d JB |
20 | set srcdir [file dirname $source] |
21 | set gprdir [file dirname $srcdir] | |
034cb681 JB |
22 | set objdir [file dirname $dest] |
23 | ||
24 | append options " ada" | |
464dd14d JB |
25 | append options " additional_flags=-P$gprdir/gnat_ada" |
26 | append options " additional_flags=-XSRC=[file tail $srcdir]" | |
27 | append options " additional_flags=-XOBJ=$objdir" | |
034cb681 | 28 | |
464dd14d | 29 | set result [target_compile [file tail $source] $dest $type $options] |
034cb681 JB |
30 | |
31 | # The Ada build always produces some output, even when the build | |
32 | # succeeds. Thus, we can not use the output the same way we do in | |
33 | # gdb_compile to determine whether the build has succeeded or not. | |
34 | # We therefore simply check whether the dest file has been created | |
35 | # or not. Unless not present, the build has succeeded. | |
ec3c07fc NS |
36 | if [file exists $dest] { set result "" } |
37 | gdb_compile_test $source $result | |
38 | return $result | |
034cb681 JB |
39 | } |
40 | ||
8223e12c TT |
41 | # Like standard_testfile, but for Ada. Historically the Ada tests |
42 | # used a different naming convention from many of the other gdb tests, | |
43 | # and this difference was preserved during the conversion to | |
44 | # standard_testfile. DIR defaults to the base name of the test case; | |
45 | # but can be overridden to find sources in a different subdirectory of | |
46 | # gdb.ada. | |
47 | ||
48 | proc standard_ada_testfile {base_file {dir ""}} { | |
49 | global gdb_test_file_name srcdir subdir | |
50 | global testdir testfile srcfile binfile | |
51 | ||
52 | if {$dir == ""} { | |
53 | set testdir $gdb_test_file_name | |
54 | } else { | |
55 | set testdir $dir | |
56 | } | |
57 | set testfile $testdir/$base_file | |
58 | set srcfile $srcdir/$subdir/$testfile.adb | |
59 | set binfile [standard_output_file $testfile] | |
60 | ||
61 | file mkdir [standard_output_file $testdir] | |
62 | } |