Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mklib 16KB

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