Fixed a bug in libtool_wrapper_for_cuda.tcl to handle correct compilation of -fPIC objects

This commit is contained in:
Francesco Lannutti 2014-05-01 21:07:02 +02:00 committed by rlar
parent 4149ae2462
commit c7c2b6bd3f
1 changed files with 6 additions and 5 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/tclsh
if {$argc == 0} {
puts "Usage: 'libtool_wrapper_for_cuda.tcl' 'filename' 'compilation line'"
puts "Usage: 'libtool_wrapper_for_cuda.tcl' 'filename' '-static | -shared' 'compilation line'"
exit 1
}
@ -15,14 +15,15 @@ if {[lindex $argv 1] == "-static"} {
set command [lrange $argv 2 end]
append command " -o $filename"
} else {
file mkdir .libs
set filename ".libs/${filename_o}"
file mkdir [file dirname $filename_o]/.libs
set filename "[file dirname $filename_o]/.libs/[file tail $filename_o]"
set command [lrange $argv 2 end]
append command " -Xcompiler -fPIC"
append command " -o $filename"
}
# Compile
#puts "Executing: $command"
exec /bin/sh -c $command
# Determine the libtool version (including compiler version)
@ -36,7 +37,7 @@ foreach elem $output {
# Generate the .lo libtool object file
set fid [open $filename_lo w]
puts $fid "# $filename_lo - a libtool object file"
puts $fid "# [file tail $filename_lo] - a libtool object file"
puts $fid "# Generated by libtool $version"
puts $fid "#"
puts $fid "# Please DO NOT delete this file!"
@ -50,7 +51,7 @@ if {[lindex $argv 1] == "-static"} {
puts $fid "non_pic_object='[file tail $filename]'"
} else {
puts $fid "# Name of the PIC object."
puts $fid "pic_object='[file tail $filename]'"
puts $fid "pic_object='.libs/[file tail $filename]'"
puts $fid ""
puts $fid "# Name of the non-PIC object"
puts $fid "non_pic_object=none"