2644
|
1 #! /bin/sh -e |
|
2 |
|
3 # Create additional links to .oct files that define more than one |
|
4 # function. |
|
5 |
|
6 # If the first arg is -p, only print the links we need to make. |
|
7 |
|
8 # The first non-option arg is taken as the directory where the .oct |
|
9 # files are installed. The remaining arguments should be the list of |
|
10 # source files that were used to create the .oct files. |
|
11 |
|
12 print_only=false |
|
13 if [ $1 = "-p" ]; then |
|
14 print_only=true |
|
15 shift |
|
16 fi |
|
17 |
|
18 links_dir=$1 |
|
19 shift |
|
20 |
|
21 for f in "$@"; do |
|
22 base=`basename $f | sed 's/\.cc$//'` |
|
23 fcns=`grep -h '^ *DEFUN_DLD' $f |\ |
|
24 sed -e 's/DEFUN_DLD *( *//' -e 's/ *,.*$//' |\ |
|
25 sort -u` |
|
26 if [ -n "$fcns" ]; then |
|
27 for n in $fcns; do |
|
28 if [ "$n" = "$base" ]; then |
|
29 true |
|
30 else |
|
31 if $print_only; then |
|
32 echo $base.oct $n.oct |
|
33 else |
|
34 echo "creating link $n.oct -> $base.oct" |
|
35 ( cd $links_dir; rm -f $n.oct; ln $base.oct $n.oct ) |
|
36 fi |
|
37 fi |
|
38 done |
|
39 fi |
|
40 done |
|
41 |
|
42 exit $? |