first compiling version
[ia32rtools.git] / runimp.sh
CommitLineData
60f7539b 1#!/bin/sh
2
3grep 'extrn ' StarCraft.asm | awk '{print $2}' | awk -F: '{print $1}' > implist
4
5echo -n "" > tramp.s
6
7cat implist | while read i; do
8 rm -f tmpsym
9 case $i in
10 __imp_*)
11 si=`echo $i | cut -c 7-`
12 ;;
13 *)
14 si=$i
15 ;;
16 esac
17
18 grep "\<_$si\>" /usr/i586-mingw32msvc/lib/lib* | awk '{print $3}' | \
19 while read f; do
20 sym=`i586-mingw32msvc-nm $f | grep "\<_$si\>" | grep ' T ' | awk '{print $3}'`
21 if test -n "$sym"; then
22 echo $sym > tmpsym
23 break
24 fi
25 done
26 sym=`cat tmpsym`
27 if test -z "$sym"; then
28 echo "no file/sym for $i, lf $f"
29 exit 1
30 fi
31
32 echo ".globl $i" >> tramp.s
33 echo "$i:" >> tramp.s
34 echo " jmp $sym" >> tramp.s
35 echo >> tramp.s
36done