Imported Upstream version 3.2.2
[debian/gnuradio] / gcell / lib / runtime / gcell-embedspu-libtool
1 #!/bin/bash
2 #
3 # Take a spu executable and turn into into a libtool compatible .lo (and .o) file.
4 # This is needed when you want to embed a SPU executable into a shared library.
5 #
6 # The symbol assigned to the embedded executable is the basename of the
7 # output file with an _spx appended.  E.g., if the output filename is
8 # my_spe_tricks.lo the symbol name is my_spe_tricks_spx.
9 # ("_spx" stands for SPE executable)
10
11 if [ $# -ne 2 ]; then
12   echo "usage: gcell-embedspu-libtool spu_executable output_file.lo " 1>&2
13   exit 1
14 fi
15
16 spu_executable=$1
17 lo_file=$2
18 symbol_name=${lo_file%%.lo}_spx
19
20 # try to make .libs in case it's not there
21 mkdir .libs >/dev/null 2>/dev/null
22
23 # generate the .o file that wraps the SPU executable
24 ppu-embedspu -m32 -fpic ${symbol_name} ${spu_executable} .libs/${symbol_name}.o
25
26 # generate the .lo libtool file that points at all the right places
27 rm -f $lo_file
28 cat >$lo_file.new <<EOF
29 # $lo_file - a libtool object file
30 # Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365 2005/12/18 22:14:06)
31 #
32 # Please DO NOT delete this file!
33 # It is necessary for linking the library.
34
35 pic_object='.libs/${symbol_name}.o'
36 non_pic_object=none
37 EOF
38
39 mv $lo_file.new $lo_file
40