X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=run_imp.sh;h=c1df2d16af18fe91ca6b9caee1f894b1a7faf355;hb=cb6623274360357225526abaf285e5b500dbef97;hp=fd049d01764e31fd4661bce80e5eb9e9a5cc10f4;hpb=c378213ad0770e0919916c265999f357a49ad75f;p=ia32rtools.git diff --git a/run_imp.sh b/run_imp.sh index fd049d0..c1df2d1 100755 --- a/run_imp.sh +++ b/run_imp.sh @@ -1,12 +1,13 @@ #!/bin/sh -grep 'extrn ' StarCraft.asm | awk '{print $2}' | awk -F: '{print $1}' > implist +grep 'extrn ' $1 | awk '{print $2}' | awk -F: '{print $1}' > $2_implist +extra_libs=`ls *.lib 2> /dev/null` -echo ".data" > tramp.s -echo ".align 4" >> tramp.s +echo ".data" > $2 +echo ".align 4" >> $2 -cat implist | while read i; do - rm -f tmpsym +cat $2_implist | while read i; do + rm -f $2_tmpsym case $i in __imp_*) si=`echo $i | cut -c 7-` @@ -16,22 +17,22 @@ cat implist | while read i; do ;; esac - grep "\<_$si\>" /usr/i586-mingw32msvc/lib/lib* *.lib | awk '{print $3}' | \ + grep "\<_$si\>" /usr/i586-mingw32msvc/lib/lib* $extra_libs | awk '{print $3}' | \ while read f; do sym=`i586-mingw32msvc-nm $f | grep "\<_$si\>" | grep ' T ' | awk '{print $3}'` if test -n "$sym"; then - echo $sym > tmpsym + echo $sym > $2_tmpsym break fi done - sym=`cat tmpsym` + sym=`cat $2_tmpsym` if test -z "$sym"; then echo "no file/sym for $i, lf $f" exit 1 fi - echo ".globl $i" >> tramp.s - echo "$i:" >> tramp.s - echo " .long $sym" >> tramp.s - echo >> tramp.s + echo ".globl $i" >> $2 + echo "$i:" >> $2 + echo " .long $sym" >> $2 + echo >> $2 done