1 # Copyright 2004-2016 Free Software Foundation, Inc.
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
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # Call target_compile with SOURCE DEST TYPE and OPTIONS as argument,
17 # after having temporarily changed the current working directory to
20 proc target_compile_ada_from_dir {builddir source dest type options} {
24 return [target_compile $source $dest $type $options]
27 return -options $options $result
30 # Compile some Ada code.
32 proc gdb_compile_ada {source dest type options} {
34 set srcdir [file dirname $source]
35 set gprdir [file dirname $srcdir]
36 set objdir [file dirname $dest]
38 # Although strictly not necessary, we force the recompilation
39 # of all units (additional_flags=-f). This is what is done
40 # when using GCC to build programs in the other languages,
41 # and it avoids using a stray objfile file from a long-past
44 append options " additional_flags=-f"
45 append options " additional_flags=-I$srcdir"
47 set result [target_compile_ada_from_dir \
48 $objdir [file tail $source] $dest $type $options]
50 # The Ada build always produces some output, even when the build
51 # succeeds. Thus, we can not use the output the same way we do in
52 # gdb_compile to determine whether the build has succeeded or not.
53 # We therefore simply check whether the dest file has been created
54 # or not. Unless not present, the build has succeeded.
55 if [file exists $dest] { set result "" }
56 gdb_compile_test $source $result
60 # Like standard_testfile, but for Ada. Historically the Ada tests
61 # used a different naming convention from many of the other gdb tests,
62 # and this difference was preserved during the conversion to
63 # standard_testfile. DIR defaults to the base name of the test case;
64 # but can be overridden to find sources in a different subdirectory of
67 proc standard_ada_testfile {base_file {dir ""}} {
68 global gdb_test_file_name srcdir subdir
69 global testdir testfile srcfile binfile
72 set testdir $gdb_test_file_name
76 set testfile $testdir/$base_file
77 set srcfile $srcdir/$subdir/$testfile.adb
78 set binfile [standard_output_file $testfile]
80 file mkdir [standard_output_file $testdir]