makedef.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/sh
  2. MMP=$1
  3. if test "$MMP" == ""; then
  4. echo "Usage: makedef.sh FILE.MMP"
  5. echo " or makedef.sh all"
  6. exit 1
  7. fi
  8. if test "$MMP" == "all"; then
  9. . $0 pjlib.mmp
  10. . $0 pjlib_util.mmp
  11. . $0 pjnath.mmp
  12. . $0 pjmedia.mmp
  13. . $0 pjsdp.mmp
  14. . $0 pjsip.mmp
  15. . $0 pjsip_simple.mmp
  16. . $0 pjsip_ua.mmp
  17. . $0 pjsua_lib.mmp
  18. . $0 symbian_audio.mmp
  19. . $0 null_audio.mmp
  20. exit 0
  21. fi
  22. if test -f $MMP; then
  23. true
  24. else
  25. echo "Unable to open $MMP"
  26. exit 1
  27. fi
  28. TARGET=`grep -w '^TARGET' $MMP | awk '{print $2}' | awk -F '.' '{print $1}' | head -1`
  29. DEFFILE="${TARGET}U.def"
  30. SOURCES=`grep -w '^SOURCE' $MMP | awk '{print $2}' | tr '\\\\' '/'`
  31. SOURCEPATH=`grep -w '^SOURCEPATH' $MMP | tr '\\\\' '/' | awk '{print $2}'`
  32. INCPATH=`grep 'INCLUDE' $MMP | awk '{print $2}' | grep pj | tr '\\\\' '/'`
  33. INCLUDE=""
  34. for INC in $INCPATH; do
  35. INCLUDE=`echo $INCLUDE -I$INC`
  36. done
  37. #-- debug --
  38. #echo TARGET=$TARGET
  39. #echo SOURCES=$SOURCES
  40. #echo SOURCEPATH=$SOURCEPATH
  41. #echo INCLUDE=$INCLUDE
  42. #-- end --
  43. echo > tmpnames.def
  44. echo "${TARGET}:"
  45. for file in $SOURCES; do
  46. #SYMBOLS=`grep PJ_DEF ${SOURCEPATH}/$file | awk -F ')' '{print $2}' | awk -F '(' '{print $1}' | awk -F '=' '{print $1}' | tr -d '[:blank:]' | sort | uniq`
  47. SYMBOLS=`
  48. cpp -DPJ_SYMBIAN=1 -DPJ_DLL -DPJ_EXPORTING=1 $INCLUDE ${SOURCEPATH}/$file 2>&1 |
  49. grep EXPORT_C |
  50. sed 's/(/;/' |
  51. sed 's/=/;/' |
  52. awk -F ';' '{print $1}' |
  53. awk '{print $NF}'`
  54. echo Processing ${SOURCEPATH}/$file..
  55. for SYM in $SYMBOLS; do
  56. echo $SYM >> tmpnames.def
  57. done
  58. done
  59. echo "Writing $DEFFILE"
  60. echo EXPORTS > $DEFFILE
  61. i=0
  62. for SYM in `cat tmpnames.def | sort | uniq`; do
  63. echo " $SYM"
  64. i=`expr $i + 1`
  65. printf "\\t%-40s @ $i NONAME\\n" $SYM >> $DEFFILE
  66. done
  67. echo
  68. echo "Done. Total $i symbols exported in $DEFFILE."