1# Copyright (C) 2002, 2011 by Red Hat, Incorporated. All rights reserved.
2#
3# Permission to use, copy, modify, and distribute this software
4# is freely granted, provided that this notice is preserved.
5#
6
7# flags.exp: overrides the dejagnu versions of newlib_link_flags
8# and newlib_include_flags.
9
10# These versions of the procedures generate link and include flags
11# by searching for the needed files in the current build and source
12# directories, rather than in the build and source paths of the
13# compiler being used.
14
15proc newlib_link_flags { args } {
16    global tool_root_dir
17    global srcdir objdir
18
19    verbose "In newlib version of newlib_link_flags...\n"
20
21    if [is_remote host] {
22	return ""
23    }
24
25    set ld_script_path [lookfor_file ${tool_root_dir} "ld/ldscripts"];
26    if { $ld_script_path != "" } {
27	set result "-L[file dirname $ld_script_path]"
28    } else {
29	set result ""
30    }
31
32    return "$result -B$objdir -L$objdir"
33}
34
35proc newlib_include_flags { args } {
36    global srcdir objdir
37
38    verbose "In newlib version of newlib_include_flags...\n"
39
40    if [is_remote host] {
41	return ""
42    }
43
44    set newlib_dir [lookfor_file ${srcdir} newlib/libc/include/assert.h]
45    if { ${newlib_dir} != "" } {
46        set newlib_dir [file dirname ${newlib_dir}]
47    }
48    return " -I$objdir/targ-include -I$objdir -I${newlib_dir}"
49}
50