111 lines
3.1 KiB
Plaintext
111 lines
3.1 KiB
Plaintext
|
# Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
|
||
|
#
|
||
|
# Permission to use, copy, modify, and distribute this software
|
||
|
# is freely granted, provided that this notice is preserved.
|
||
|
#
|
||
|
|
||
|
proc newlib_version { } {
|
||
|
global tool_version
|
||
|
|
||
|
verbose "In newlib version...\n"
|
||
|
|
||
|
return $tool_version
|
||
|
}
|
||
|
|
||
|
set newlib_initialized 0
|
||
|
|
||
|
proc newlib_init { args } {
|
||
|
global gluefile wrap_flags
|
||
|
global newlib_initialized
|
||
|
global target_info
|
||
|
global CFLAGS_FOR_TARGET
|
||
|
# These values are initialized in the local site.exp file
|
||
|
global srcdir objdir
|
||
|
global build_triplet host_triplet
|
||
|
# newlib_cflags comes from acinclude.m4, through the site.exp file
|
||
|
global newlib_cflags
|
||
|
global old_ld_library_path
|
||
|
|
||
|
verbose "In newlib_init...\n"
|
||
|
|
||
|
if { $newlib_initialized == 1 } { return; }
|
||
|
|
||
|
set CFLAGS_FOR_TARGET $newlib_cflags
|
||
|
|
||
|
set_currtarget_info "wrap_compile_flags" "$newlib_cflags"
|
||
|
|
||
|
if {[target_info needs_status_wrapper] != "" && \
|
||
|
[target_info needs_status_wrapper] != "0" && \
|
||
|
![info exists gluefile]} {
|
||
|
set gluefile ${objdir}/testglue.o;
|
||
|
set result [build_wrapper $gluefile];
|
||
|
if { $result != "" } {
|
||
|
set gluefile [lindex $result 0];
|
||
|
set wrap_flags [lindex $result 1];
|
||
|
} else {
|
||
|
unset gluefile
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if [string match $build_triplet $host_triplet] then {
|
||
|
if [string match "i686-pc-linux-gnu" $build_triplet] then {
|
||
|
set old_ld_library_path [getenv LD_LIBRARY_PATH]
|
||
|
setenv LD_LIBRARY_PATH "$objdir/.libs"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
proc newlib_target_compile { source dest type options } {
|
||
|
global gluefile wrap_flags
|
||
|
global srcdir objdir
|
||
|
global build_triplet
|
||
|
global host_triplet
|
||
|
|
||
|
verbose "In newlib_target_compile...\n"
|
||
|
|
||
|
if {[target_info needs_status_wrapper] != "" && \
|
||
|
[target_info needs_status_wrapper] != "0" && \
|
||
|
[info exists gluefile] } {
|
||
|
lappend options "libs=$gluefile"
|
||
|
# This method of finding libgloss_target_dir may not work for some targets
|
||
|
set libgloss_target_dir [lindex [split $host_triplet "-"] 0]
|
||
|
lappend options "ldflags=$wrap_flags -B$objdir/../libgloss/$libgloss_target_dir \
|
||
|
-L$objdir/../libgloss/$libgloss_target_dir \
|
||
|
-L$srcdir/../../libgloss/$libgloss_target_dir \
|
||
|
-L$objdir"
|
||
|
}
|
||
|
|
||
|
if [string match $build_triplet $host_triplet] then {
|
||
|
if [string match "i686-pc-linux-gnu" $build_triplet] then {
|
||
|
lappend options "libs=$objdir/crt0.o -lc"
|
||
|
lappend options "ldflags=-nostdlib -L$objdir/.libs -lgcc"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return [target_compile $source $dest $type $options]
|
||
|
}
|
||
|
|
||
|
proc newlib_finish { } {
|
||
|
global old_ld_library_path
|
||
|
global build_triplet host_triplet
|
||
|
|
||
|
verbose "In newlib_finish...\n"
|
||
|
|
||
|
if [string match $build_triplet $host_triplet] then {
|
||
|
if [string match "i686-pc-linux-gnu" $build_triplet] then {
|
||
|
setenv LD_LIBRARY_PATH "$old_ld_library_path"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
proc newlib_exit { } {
|
||
|
global gluefile;
|
||
|
|
||
|
verbose "In newlib_exit...\n"
|
||
|
|
||
|
if [info exists gluefile] {
|
||
|
file_on_build delete $gluefile;
|
||
|
unset gluefile;
|
||
|
}
|
||
|
}
|