3 # Make an AIX shared library (tricky!!!)
4 # Based on a script from Athanasios G. Gaitatzes (gaitat@vnet.ibm.com)
5 # Improved by Greg Thompson <gregt@visix.com> -gt
7 #--identification------------------------------------------------------
9 # $Id: mklib.aix,v 1.2 1999/09/15 15:10:20 brianp Exp $
12 # Revision 1.2 1999/09/15 15:10:20 brianp
13 # added third, tiny version number to arguments
15 # Revision 1.1 1999/08/19 13:52:56 brianp
16 # initial check-in (post-crash)
20 #--common--------------------------------------------------------------
36 #--platform------------------------------------------------------------
38 # BASENAME = LIBRARY without .a suffix
39 BASENAME
=`echo ${LIBRARY} | sed "s/\.a//g"`
41 # Name of exports file
42 EXPFILE
=${BASENAME}.exp
44 # Name of temporary shared lib file
46 ####OFILE=${BASENAME}.o
49 # Remove any old files from previous make
50 rm -f ${LIBRARY} ${EXPFILE} ${OFILE}
52 # Pick a way to use nm -gt
55 # Determine which version of AIX this is
58 # Pick a way to tell the linker there's no entrypoint -gt
68 echo "Error in mklib.aix!"
74 # Other libraries which we may be dependent on. Since we make the libraries
75 # in the order libGL.a, libaGLU.a, libglut.a just depends on its predecessor.
76 # modified to make otherlibs in the form of -lfoo -gt
77 OTHERLIBS
=`ls ../lib/*.a | sed "s/..\/lib\/lib/-l/g" | sed "s/\.a//g"`
79 ##echo OTHERLIBS are ${OTHERLIBS}
82 # Make exports (.exp) file header
83 echo "#! ${LIBRARY}" > ${EXPFILE}
85 # Append list of exported symbols to exports file -gt
89 ${NM} ${OBJECTS} |
awk -F'|' '{
90 if ($3 != "extern" || substr($7,1,1) == " ") continue
91 sub (" *", "", $1); sub (" *", "", $7)
92 if ( (($7 == ".text") || ($7 == ".data") || ($7 == ".bss")) \
93 && ( substr($1,1,1) != ".")) {
94 if (substr ($1, 1, 7) != "__sinit" &&
95 substr ($1, 1, 7) != "__sterm") {
96 if (substr ($1, 1, 5) == "__tf1")
97 print (substr ($1, 7))
98 else if (substr ($1, 1, 5) == "__tf9")
99 print (substr ($1, 15))
104 }' |
sort -u >> ${EXPFILE}
108 ${NM} ${OBJECTS} |
awk '{
109 if ((($2 == "T") || ($2 == "D") || ($2 == "B")) \
110 && ( substr($1,1,1) != ".")) {
111 if (substr ($1, 1, 7) != "__sinit" &&
112 substr ($1, 1, 7) != "__sterm") {
113 if (substr ($1, 1, 5) == "__tf1")
114 print (substr ($1, 7))
115 else if (substr ($1, 1, 5) == "__tf9")
116 print (substr ($1, 15))
121 }' |
sort -u >> ${EXPFILE}
126 # This next line is a hack to allow full compatibility with IBM's OpenGL
127 # libraries. IBM mistakenly exports glLoadIdentity from the libGLU.a
128 # library. We have to do the same thing. Problem reported by Yemi Adesanya
129 # (adesanya@afsmail.cern.ch) and Patrick Brown (pbrown@austin.ibm.com)
130 if [ "${BASENAME}" = libGLU
] ; then
131 echo "glLoadIdentity" >> ${EXPFILE}
135 # Make the shared lib file
136 cc
-o ${OFILE} ${OBJECTS} -L../lib ${OTHERLIBS} -lX11 -lXext -lXmu -lXi -lm -lc -bE:${EXPFILE} -bM:SRE ${ENTRY}
140 ar ruv
${LIBRARY} ${OFILE}
142 # Put exports file in Mesa lib directory
150 # AIX 4.x /usr/bin/nm -B patch from ssclift@mach.me.queensu.ca (Simon Clift)
151 # Robustified symbol extraction for AIX 3 and 4
152 # Greg Thompson <gregt@visix.com>