home *** CD-ROM | disk | FTP | other *** search
/ Aminet 10 / aminetcdnumber101996.iso / Aminet / gfx / x11 / Mesa_Amiwin.lha / Mesa-Amiwin / mklib.aix < prev    next >
Text File  |  1995-10-18  |  2KB  |  84 lines

  1. #!/bin/sh
  2.  
  3. # Make an AIX shared library (tricky!!!)
  4.  
  5. # First argument is name of output library
  6. # Rest of arguments are object files
  7.  
  8.  
  9. # Name of the library which clients will link with (ex: libMesaGL.a)
  10. LIBRARY=$1
  11.  
  12. # BASENAME = LIBRARY without .a suffix
  13. BASENAME=`echo ${LIBRARY} | sed "s/\.a//g"`
  14.  
  15. # Name of exports file
  16. EXPFILE=${BASENAME}.exp
  17.  
  18. # Name of temporary shared lib file
  19. OFILE=${BASENAME}.o
  20.  
  21. # List of object files to put into library
  22. shift 1
  23. OBJECTS=$*
  24.  
  25.  
  26. # Remove any old files from previous make
  27. rm -f ${LIBRARY} ${EXPFILE} ${OFILE}
  28.  
  29.  
  30. # Determine how to invoke nm depending on AIX version
  31. AIXVERSION=`uname -v`
  32. case ${AIXVERSION}
  33. {
  34.     3*)
  35.         NM=/usr/ucb/nm
  36.         ;;
  37.     4*)
  38.         NM=/usr/bin/nm -B
  39.         ;;
  40.     *)
  41.         echo "Error in mklib.aix!"
  42.         exit 1
  43.         ;;
  44. }
  45.  
  46.  
  47.  
  48.  
  49. # Other libraries which we may be dependent on.  Since we make the libraries
  50. # in the order libMesaGL.a, libMesaGLU.a, libMesatk.a, libMesaaux.a each
  51. # just depends on its predecessor.
  52. OTHERLIBS=`ls ../lib/lib*.a`
  53.  
  54. ##echo OTHERLIBS are ${OTHERLIBS}
  55.  
  56.  
  57.  
  58.  
  59. # Make exports (.exp) file header
  60. echo "#! ${LIBRARY}" > ${EXPFILE}
  61. echo "noentry" >> ${EXPFILE}
  62.  
  63. # Append list of exported symbols to exports file
  64. ${NM} ${OBJECTS} | awk '/ [BD] /{print $3}' | sort | uniq >> ${EXPFILE}
  65.  
  66.  
  67. # Make the shared lib file
  68. cc -o ${OFILE} ${OBJECTS} -L../lib ${OTHERLIBS} -lX11 -lm -lc -bE:${EXPFILE} -bM:SRE -enoentry
  69.  
  70.  
  71. # Make the .a file
  72. ar ruv ${LIBRARY} ${OFILE}
  73.  
  74. # Put exports file in Mesa lib directory
  75. mv ${EXPFILE} ../lib
  76.  
  77. # Remove OFILE
  78. rm -f ${OFILE}
  79.  
  80.  
  81. #NOTES
  82. # AIX 4.x /usr/bin/nm -B patch from ssclift@mach.me.queensu.ca (Simon Clift)
  83.  
  84.