fixed OSF/1 shared lib problem (bug 1065260)
[mesa.git] / bin / mklib
1 #!/bin/sh
2
3 # Make a shared library.
4 # Basically do a switch/case depending on the OS and make a shared (or static)
5 # library conforming to that OS.
6
7
8 # Usage:
9 # mklib [options] objects ...
10 # Options:
11 # -o LIBRARY specifies the name of resulting library
12 # ("-o GL" for example, might result in "libGL.so" being made)
13 # -major N specifies major version number (default is 1)
14 # -minor N specifies minor version number (default is 0)
15 # -patch N specifies patch version number (default is 0)
16 # -lLIBRARY specifies a dependency on LIBRARY
17 # -LDIR search in DIR for library dependencies
18 # -cplusplus link with C++ runtime
19 # -static make a static library (default is dynamic/shared)
20 # -install DIR move resulting library file(s) to DIR
21 # -arch ARCH override using `uname` to determine architecture
22 # -archopt OPT specify an extra achitecture-specific option OPT
23 # -noprefix don't prefix library name with "lib" or any suffix
24 # -exports FILE only export the symbols listed in FILE
25 #
26 # The library name should just be "GL" or "GLU", etc. The 'lib' prefix
27 # will be added here if needed, as well as the ".so" or ".a" suffix,
28 # etc (unless the -noprefix option is used).
29 #
30 # objects should be: foo.o bar.o etc.o
31 #
32 # Environment variables recognized:
33 # CC C compiler command
34 # CXX C++ compiler command
35 #
36
37
38 #
39 # Option defaults
40 #
41 LIBNAME=""
42 MAJOR=1
43 MINOR=0
44 PATCH=""
45 DEPS=""
46 CPLUSPLUS=0
47 STATIC=0
48 INSTALLDIR="."
49 ARCH="auto"
50 ARCHOPT=""
51 NOPREFIX=0
52 EXPORTS=""
53
54
55 #
56 # Parse arguments
57 #
58 while true
59 do
60 case $1 in
61 '-o') shift 1; LIBNAME=$1;;
62 '-major') shift 1; MAJOR=$1;;
63 '-minor') shift 1; MINOR=$1;;
64 '-patch') shift 1; PATCH=$1;;
65 -l*) DEPS="$DEPS $1";;
66 -L*) DEPS="$DEPS $1";;
67 '-cplusplus') CPLUSPLUS=1;;
68 '-static') STATIC=1;;
69 '-install') shift 1; INSTALLDIR=$1;;
70 '-arch') shift 1; ARCH=$1;;
71 '-archopt') shift 1; ARCHOPT=$1;;
72 '-noprefix') NOPREFIX=1;;
73 '-exports') shift 1; EXPORTS=$1;;
74 -*) echo "mklib: Unknown option: " $1 ; exit 1;;
75 *) break
76 esac
77 shift 1
78 done
79 OBJECTS=$@
80
81 if [ ${ARCH} = "auto" ] ; then
82 ARCH=`uname`
83 fi
84
85
86 #
87 # Error checking
88 #
89 if [ "x${LIBNAME}" = "x" ] ; then
90 echo "mklib: Error: no library name specified"
91 exit 1
92 fi
93 if [ "x${OBJECTS}" = "x" ] ; then
94 echo "mklib: Error: no object files specified"
95 exit 1
96 fi
97
98
99 #
100 # Debugging info
101 #
102 if [ ] ; then
103 echo "-----------------"
104 echo ARCH is $ARCH
105 echo LIBNAME is $LIBNAME
106 echo MAJOR is $MAJOR
107 echo MINOR is $MINOR
108 echo PATCH is $PATCH
109 echo DEPS are $DEPS
110 echo "EXPORTS in" $EXPORTS
111 echo "-----------------"
112 fi
113
114
115 #
116 # OK, make the library now
117 #
118 case $ARCH in
119
120 'Linux' | 'OpenBSD')
121 # we assume gcc
122
123 # Set default compilers if env vars not set
124 if [ "x$CXX" = "x" ] ; then
125 CXX=g++
126 fi
127 if [ "x$CC" = "x" ] ; then
128 CC=gcc
129 fi
130
131 if [ $NOPREFIX = 1 ] ; then
132 # No "lib" or ".so" part
133 echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}
134 #OPTS="-shared -Wl,-soname,${LIBNAME}" # soname???
135 OPTS="-shared"
136 if [ $CPLUSPLUS = 1 ] ; then
137 LINK=$CXX
138 else
139 LINK=$CC
140 fi
141 rm -f ${LIBNAME}
142
143 # make lib
144 ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
145 # finish up
146 FINAL_LIBS="${LIBNAME}"
147 elif [ $STATIC = 1 ] ; then
148 LIBNAME="lib${LIBNAME}" # prefix with "lib"
149 echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a
150 LINK="ar"
151 OPTS="-ru"
152 # make lib
153 ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS}
154 ranlib ${LIBNAME}.a
155 # finish up
156 FINAL_LIBS=${LIBNAME}.a
157 else
158 LIBNAME="lib${LIBNAME}" # prefix with "lib"
159 if [ $ARCH = 'Linux' ] ; then
160 OPTS="-Xlinker -Bsymbolic -shared -Wl,-soname,${LIBNAME}.so.${MAJOR}"
161 else
162 OPTS="-shared -Wl,-soname,${LIBNAME}.so.${MAJOR}"
163 fi
164 if [ $EXPORTS ] ; then
165 #OPTS="${OPTS} -Xlinker --retain-symbols-file ${EXPORTS}"
166 # Make the 'exptmp' file for --version-script option
167 echo "VERSION_${MAJOR}.${MINOR} {" > exptmp
168 echo "global:" >> exptmp
169 sed 's/$/;/' ${EXPORTS} >> exptmp
170 echo "local:" >> exptmp
171 echo "*;" >> exptmp
172 echo "};" >> exptmp
173 OPTS="${OPTS} -Xlinker --version-script=exptmp"
174 # exptmp is removed below
175 fi
176 if [ x${PATCH} = "x" ] ; then
177 VERSION="${MAJOR}.${MINOR}"
178 else
179 VERSION="${MAJOR}.${MINOR}.${PATCH}"
180 fi
181
182 echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}.so.${VERSION}
183
184 if [ $CPLUSPLUS = 1 ] ; then
185 LINK=$CXX
186 else
187 LINK=$CC
188 fi
189
190 # rm any old libs
191 rm -f ${LIBNAME}.so.${VERSION}
192 rm -f ${LIBNAME}.so.${MAJOR}
193 rm -f ${LIBNAME}.so
194
195 # make lib
196 ${LINK} ${OPTS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS}
197 # make usual symlinks
198 ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR}
199 ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so
200 # finish up
201 FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so"
202 # rm -f exptmp
203 fi
204 ;;
205
206 'SunOS')
207 if [ $STATIC = 1 ] ; then
208 LIBNAME="lib${LIBNAME}.a"
209 echo "mklib: Making SunOS static library: " ${LIBNAME}
210 rm -f ${LIBNAME}
211 ar -ruv ${LIBNAME} ${OBJECTS}
212 FINAL_LIBS=${LIBNAME}
213 else
214 LIBNAME="lib${LIBNAME}.so"
215 echo "mklib: Making SunOS shared library: " ${LIBNAME}
216 # XXX OPTS for gcc should be -shared, but that doesn't work.
217 # Using -G does work though.
218 if [ $CPLUSPLUS = 1 ] ; then
219 # determine linker and options for C++ code
220 if [ "x${CXX}" = "xg++" ] ; then
221 # use g++
222 LINK="g++"
223 OPTS="-G"
224 elif [ "x${CXX}" = "xCC" ] ; then
225 # use Sun CC
226 LINK="CC"
227 OPTS="-G"
228 elif [ "x${CXX}" = "xc++" ] ; then
229 # use Sun c++
230 LINK="c++"
231 OPTS="-G"
232 elif [ `which c++` ] ; then
233 # use Sun c++
234 LINK="c++"
235 OPTS="-G"
236 elif [ `type g++` ] ; then
237 # use g++
238 LINK="g++"
239 OPTS="-G"
240 else
241 echo "mklib: warning: can't find C++ comiler, trying CC."
242 LINK="CC"
243 OPTS="-G"
244 fi
245 elif [ "x${CC}" = "xgcc" ] ; then
246 # use gcc for linking
247 LINK="gcc"
248 OPTS="-G"
249 else
250 # use native Sun linker
251 LINK="ld"
252 OPTS="-G"
253 fi
254 echo "mklib: linker is" ${LINK} ${OPTS}
255 rm -f ${LIBNAME}.${MAJOR} ${LIBNAME}
256 ${LINK} ${OPTS} -o ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS}
257 ln -s ${LIBNAME}.${MAJOR} ${LIBNAME}
258 FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}"
259 fi
260 ;;
261
262 'FreeBSD')
263 if [ $NOPREFIX = 1 ] ; then
264 # No "lib" or ".so" part
265 echo "mklib: Making FreeBSD shared library: " ${LIBNAME}
266 rm -f ${LIBNAME}
267 ld -Bshareable -o ${LIBNAME} ${OBJECTS}
268 FINAL_LIBS=${LIBNAME}
269 elif [ $STATIC = 1 ] ; then
270 STLIB="lib${LIBNAME}.a"
271 echo "mklib: Making FreeBSD static library: " ${STLIB}
272 rm -f ${STLIB}
273 ar cq ${STLIB} ${OBJECTS}
274 ranlib ${STLIB}
275 FINAL_LIBS=${STLIB}
276 else
277 SHLIB="lib${LIBNAME}.so.${MAJOR}.${MINOR}"
278 echo "mklib: Making FreeBSD shared library: " ${SHLIB}
279 rm -f ${SHLIB}
280 ld -Bshareable -o ${SHLIB} ${OBJECTS}
281 # XXX make lib${LIBNAME}.so.${MAJOR} symlink?
282 FINAL_LIBS=${SHLIB}
283 fi
284 ;;
285
286 'NetBSD')
287 if [ $STATIC = 1 ] ; then
288 LIBNAME="lib${LIBNAME}_pic.a"
289 echo "mklib: Making NetBSD PIC static library: " ${LIBNAME}
290 rm -f ${LIBNAME}
291 ar cq ${LIBNAME} ${OBJECTS}
292 ranlib ${LIBNAME}
293 FINAL_LIBS=${LIBNAME}
294 else
295 LIBNAME="lib${LIBNAME}.so.${MAJOR}.${MINOR}"
296 echo "mklib: Making NetBSD PIC shared library: " ${LIBNAME}
297 rm -f ${LIBNAME}
298 ld -x -Bshareable -Bforcearchive -o ${LIBNAME} ${OBJECTS}
299 FINAL_LIBS=${LIBNAME}
300 fi
301 ;;
302
303 'IRIX' | 'IRIX64')
304 if [ $STATIC = 1 ] ; then
305 LIBNAME="lib${LIBNAME}.a"
306 rm -f ${LIBNAME}
307 ar rc ${LIBNAME} ${OBJECTS}
308 FINAL_LIBS=${LIBNAME}
309 else
310 LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so"
311 if [ $ARCHOPT = "64" ] ; then
312 # 64-bit ABI
313 OPTS="-64 -shared -all"
314 echo "mklib: Making IRIX 64-bit shared library: " ${LIBNAME}
315 elif [ $ARCHOPT = "o32" ] ; then
316 # old 32-bit ABI
317 OPTS="-32 -shared -all"
318 echo "mklib: Making IRIX o32-bit shared library: " ${LIBNAME}
319 else
320 # new 32-bit ABI
321 OPTS="-n32 -shared -all"
322 echo "mklib: Making IRIX n32-bit shared library: " ${LIBNAME}
323 fi
324 if [ $CPLUSPLUS = 1 ] ; then
325 LINK="CC"
326 else
327 LINK="ld"
328 fi
329 ${LINK} ${OPTS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
330 FINAL_LIBS=${LIBNAME}
331 fi
332 ;;
333
334 'linux-cygwin')
335 LIBNAME="lib${LIBNAME}.a"
336 echo "mklib: Making linux-cygwin library: " ${LIBNAME}
337 rm -f ${LIBNAME}
338 gnuwin32ar ruv ${LIBNAME} ${OBJECTS}
339 FINAL_LIBS=${LIBNAME}
340 ;;
341
342 'HP-UX')
343 if [ $STATIC = 1 ] ; then
344 LIBNAME="lib${LIBNAME}.a"
345 echo "mklib: Making HP-UX static library: " ${LIBNAME}
346 rm -f ${LIBNAME}
347 ar -ruv ${LIBNAME} ${OBJECTS}
348 FINAL_LIBS=${LIBNAME}
349 else
350 RUNLIB="lib${LIBNAME}.${MAJOR}"
351 DEVLIB="lib${LIBNAME}.sl"
352 echo "mklib: Making HP-UX shared library: " ${RUNLIB} ${DEVLIB}
353 ld -b -o ${RUNLIB} +b ${RUNLIB} ${OBJECTS} ${DEPS}
354 ln -s ${RUNLIB} ${DEVLIB}
355 FINAL_LIBS="${RUNLIB} ${DEVLIB}"
356 fi
357 ;;
358
359 'AIX' | 'AIX64')
360 if [ $ARCH = "AIX64" ] ; then
361 X64="-X64"
362 fi
363
364 if [ $STATIC = 1 ] ; then
365 LIBNAME="lib${LIBNAME}.a"
366 echo "mklib: Making AIX static library: " ${LIBNAME}
367 ar -ruv ${X64} ${LIBNAME} ${OBJECTS}
368 FINAL_LIBS=${LIBNAME}
369 else
370 EXPFILE="lib${LIBNAME}.exp"
371 OFILE=shr.o #Want to be consistent with the IBM libGL.a
372 LIBNAME="lib${LIBNAME}.a" # shared objects are still stored in the .a libraries
373 if [ $ARCH = "AIX64" ] ; then
374 OPTS="-bE:${EXPFILE} -bM:SRE -bnoentry -q64"
375 else
376 OPTS="-bE:${EXPFILE} -bM:SRE -bnoentry"
377 fi
378 rm -f ${EXPFILE} ${OFILE}
379 NM="/bin/nm -eC ${X64}"
380 echo "#! /usr/lib/${LIBNAME}" > ${EXPFILE}
381 ${NM} ${OBJECTS} | awk '{
382 if ((($2 == "T") || ($2 == "D") || ($2 == "B")) \
383 && ( substr($1,1,1) != ".")) {
384 if (substr ($1, 1, 7) != "__sinit" &&
385 substr ($1, 1, 7) != "__sterm") {
386 if (substr ($1, 1, 5) == "__tf1")
387 print (substr ($1, 7))
388 else if (substr ($1, 1, 5) == "__tf9")
389 print (substr ($1, 15))
390 else
391 print $1
392 }
393 }
394 }' | sort -u >> ${EXPFILE}
395 cc ${OPTS} -o ${OFILE} ${OBJECTS} ${DEPS}
396 ar ${X64} -r ${LIBNAME} ${OFILE}
397 FINAL_LIBS="${LIBNAME}"
398 fi
399 ;;
400
401 'OpenSTEP')
402 LIBNAME="lib${LIBNAME}.a"
403 echo "mklib: Making OpenSTEP static library: " ${LIBNAME}
404 libtool -static -o ${LIBNAME} - ${OBJECTS}
405 FINAL_LIBS=${LIBNAME}
406 ;;
407
408 'OSF1')
409 if [ $STATIC = 1 ] ; then
410 LIBNAME="lib${LIBNAME}.a"
411 echo "mklib: Making OSF/1 static library: " ${LIBNAME}
412 rm -f ${LIBNAME}
413 ar -ruv ${LIBNAME} ${OBJECTS}
414 FINAL_LIBS=${LIBNAME}
415 else
416 VERSION="${MAJOR}.${MINOR}"
417 LIBNAME="lib${LIBNAME}.so"
418 echo "mklib: Making OSF/1 shared library: " ${LIBNAME}
419 if [ $CPLUSPLUS = 1 ] ; then
420 LINK=$CXX
421 else
422 LINK=$CC
423 fi
424 rm -f ${LIBNAME}.${VERSION}
425 ${LINK} -o ${LIBNAME}.${VERSION} -shared -set_version ${VERSION} -soname ${LIBNAME}.${VERSION} -expect_unresolved \* -all ${OBJECTS} ${DEPS}
426 ln -sf ${LIBNAME}.${VERSION} ${LIBNAME}
427 FINAL_LIBS="${LIBNAME} ${LIBNAME}.${VERSION}"
428 fi
429 ;;
430
431 'Darwin')
432 if [ $STATIC = 1 ] ; then
433 LIBNAME="lib${LIBNAME}.a"
434 echo "mklib: Making Darwin static library: " ${LIBNAME}
435 LINK="ar"
436 OPTS="-ruv"
437 ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS}
438 FINAL_LIBS=${LIBNAME}
439 else
440 LIBNAME="${LIBNAME}.dylib"
441 echo "mklib: Making Darwin shared library: " ${LIBNAME}
442 FLAGS="-dynamiclib -multiply_defined suppress"
443 if [ $CPLUSPLUS = 1 ] ; then
444 LINK="g++"
445 else
446 LINK="cc"
447 fi
448 ${LINK} ${FLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
449 FINAL_LIBS=${LIBNAME}
450 fi
451 ;;
452
453 'LynxOS')
454 LIBNAME="lib${LIBNAME}.a"
455 echo "mklib: Making LynxOS static library: " ${LIBNAME}
456 rm -f ${LIBNAME}
457 ar ru ${LIBNAME} ${OBJECTS}
458 FINAL_LIBS=${LIBNAME}
459 ;;
460
461 'BeOS')
462 if [ $STATIC = 1 ] ; then
463 LIBNAME="lib${LIBNAME}.a"
464 echo "mklib: Making BeOS static library: " ${LIBNAME}
465 ar -cru "${LIBNAME}" ${OBJECTS}
466 else
467 LIBNAME="lib${LIBNAME}.so"
468 echo "mklib: Making BeOS shared library: " ${LIBNAME}
469 gcc -nostart -Xlinker "-soname=${LIBNAME}" -L/Be/develop/lib/x86 -lbe ${DEPS} ${OBJECTS} -o "${LIBNAME}"
470 mimeset -f "${LIBNAME}"
471 setversion "${LIBNAME}" -app ${MAJOR} ${MINOR} ${PATCH} -short "Powered by Mesa3D!" -long "Powered by Mesa3D!"
472 fi
473 FINAL_LIBS=${LIBNAME}
474 ;;
475
476 'QNX')
477 LIBNAME="lib${LIBNAME}.a"
478 echo "mklib: Making QNX library: " ${LIBNAME}
479 wlib ${LIBNAME} ${OBJECTS}
480 FINAL_LIBS=${LIBNAME}
481 ;;
482
483 'MorphOS')
484 LIBNAME="lib${LIBNAME}.a"
485 echo "mklib: Making MorphOS library: " ${LIBNAME}
486 ppc-morphos-ar rc ${LIBNAME} ${OBJECTS}
487 FINAL_LIBS="${LIBNAME}"
488 ;;
489
490 'icc')
491 # Intel C compiler
492 LIBNAME="lib${LIBNAME}" # prefix with "lib"
493
494 if [ $STATIC = 1 ] ; then
495 echo "mklib: Making Intel ICC static library: " ${LIBNAME}.a
496 LINK="ar"
497 OPTS="-ruv"
498 # make lib
499 ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS}
500 # finish up
501 FINAL_LIBS="${LIBNAME}.a"
502 else
503 OPTS="-shared"
504 VERSION="${MAJOR}.${MINOR}.${PATCH}"
505 echo "mklib: Making Intel ICC shared library: " ${LIBNAME}.so.${VERSION}
506
507 if [ $CPLUSPLUS = 1 ] ; then
508 LINK="icc"
509 else
510 LINK="icc"
511 fi
512 # rm any old libs
513 rm -f ${LIBNAME}.so.${VERSION}
514 rm -f ${LIBNAME}.so.${MAJOR}
515 rm -f ${LIBNAME}.so
516 # make lib
517 ${LINK} ${OPTS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS}
518 # make usual symlinks
519 ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR}
520 ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so
521 # finish up
522 FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so"
523 fi
524 ;;
525
526 'aix-gcc')
527 # AIX with gcc
528 if [ $STATIC = 1 ] ; then
529 LIBNAME="lib${LIBNAME}.a"
530 echo "mklib: Making AIX GCC static library: " ${LIBNAME}
531 rm -f ${LIBNAME}
532 ar ru ${LIBNAME} ${OBJECTS}
533 FINAL_LIBS=${LIBNAME}
534 else
535 LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so"
536 echo "mklib: Making AIX GCC shared library: " ${LIBNAME}
537 # remove old lib
538 rm -f ${LIBNAME}
539 # make the lib
540 gcc -shared -Wl,-G ${OBJECTS} ${DEPS} -o ${LIBNAME}
541 # NOTE: the application linking with this library must specify
542 # the -Wl,-brtl flags to gcc
543 FINAL_LIBS=${LIBNAME}
544 fi
545 ;;
546
547 'ultrix')
548 # XXX untested
549 if [ $STATIC = 0 ] ; then
550 echo "mklib: Warning shared libs not supported on Ultrix"
551 fi
552 LIBNAME="lib${LIBNAME}.a"
553 echo "mklib: Making static library for Ultrix: " ${LIBNAME}
554 rm -f ${LIBNAME}
555 ar ru ${LIBNAME} ${OBJECTS}
556 FINAL_LIBS="${LIBNAME}"
557 ;;
558
559 CYGWIN*)
560 # GCC-based environment
561 CYGNAME="cyg${LIBNAME}" # prefix with "cyg"
562 LIBNAME="lib${LIBNAME}" # prefix with "lib"
563
564 if [ $STATIC = 1 ] ; then
565 echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a
566 LINK="ar"
567 OPTS="-ru"
568 # make lib
569 ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS}
570 ranlib ${LIBNAME}.a
571 # finish up
572 FINAL_LIBS=${LIBNAME}.a
573 else
574 OPTS="-shared -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a"
575 echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}-${MAJOR}.dll
576
577 if [ $CPLUSPLUS = 1 ] ; then
578 LINK="g++"
579 else
580 LINK="gcc"
581 fi
582
583 # rm any old libs
584 rm -f ${LIBNAME}-${MAJOR}.dll
585 rm -f ${LIBNAME}.dll.a
586 rm -f ${LIBNAME}.a
587
588 # make lib
589 ${LINK} ${OPTS} -o ${CYGNAME}-${MAJOR}.dll ${OBJECTS} ${DEPS}
590 # make usual symlinks
591 ln -s ${LIBNAME}-${MAJOR}.dll.a ${LIBNAME}.dll.a
592 # finish up
593 FINAL_LIBS="${LIBNAME}-${MAJOR}.dll.a ${LIBNAME}.dll.a"
594 # special case for installing in bin
595 FINAL_BINS="${CYGNAME}-${MAJOR}.dll"
596 fi
597 ;;
598
599 'example')
600 # If you're adding support for a new architecture, you can
601 # start with this:
602 if [ $STATIC = 1 ] ; then
603 LIBNAME="lib${LIBNAME}.a"
604 echo "mklib: Making static library for example arch: " ${LIBNAME}
605 rm -f ${LIBNAME}
606 ar rv ${LIBNAME} ${OBJECTS}
607 FINAL_LIBS="${LIBNAME}"
608 else
609 LIBNAME="lib${LIBNAME}.so" # prefix with "lib"
610 echo "mklib: Making shared library for example arch: " ${LIBNAME}
611 ld -o ${LIBNAME} ${OBJECTS} ${DEPS}
612 FINAL_LIBS="${LIBNAME}"
613 fi
614 ;;
615
616 *)
617 echo "mklib: ERROR: Don't know how to make a static/shared library for" ${ARCH}
618 echo "mklib: Please add necessary commands to mklib script."
619 ;;
620 esac
621
622
623 #
624 # Put library files into installation directory if specified.
625 #
626 if [ ${INSTALLDIR} != "." ] ; then
627 echo "mklib: Installing" ${FINAL_LIBS} "in" ${INSTALLDIR}
628 mv ${FINAL_LIBS} ${INSTALLDIR}/
629 fi