diff options
author | Andy Skinner <Andy.Skinner@mathworks.com> | 2008-02-07 13:20:06 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2008-02-07 13:21:14 -0700 |
commit | 5c0c8831040c2abbe4e1f80cb03a8cc1ffd4219e (patch) | |
tree | 2835be9fc03d43e63e8c49deb5e0ef6bc46321b6 /bin | |
parent | 700a77fb48f364f85e013cf5fb68c04eb83317e7 (diff) |
added -altopts to allow overriding all other opts
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/mklib | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/bin/mklib b/bin/mklib index 7d271de11805..b21658797a01 100755 --- a/bin/mklib +++ b/bin/mklib @@ -71,6 +71,7 @@ do echo ' -install DIR put resulting library file(s) in DIR' echo ' -arch ARCH override using `uname` to determine host system' echo ' -archopt OPT specify an extra achitecture-specific option OPT' + echo ' -altopts OPTS alternate options to override all others' echo " -noprefix don't prefix library name with 'lib' nor add any suffix" echo ' -exports FILE only export the symbols listed in FILE' echo ' -h, --help display this information and exit' @@ -134,6 +135,10 @@ do shift 1; ARCHOPT=$1 ;; + '-altopts') + shift 1; + ALTOPTS=$1 + ;; '-noprefix') NOPREFIX=1 ;; @@ -224,6 +229,10 @@ case $ARCH in OPTS="-m32 ${OPTS}" fi + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + rm -f ${LIBNAME} # make lib ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} @@ -234,6 +243,9 @@ case $ARCH in echo "mklib: Making" $ARCH "static library: " ${LIBNAME} LINK="ar" OPTS="-ru" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi rm -f ${LIBNAME} # make lib ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS} @@ -269,6 +281,9 @@ case $ARCH in if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then OPTS="-m32 ${OPTS}" fi + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi if [ x${PATCH} = "x" ] ; then VERSION="${MAJOR}.${MINOR}" @@ -351,7 +366,9 @@ case $ARCH in if [ "${SPARCV9}" ] ; then OPTS="${OPTS} -xarch=v9" fi - + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi # for debug: #echo "mklib: linker is" ${LINK} ${OPTS} if [ $NOPREFIX = 1 ] ; then @@ -382,6 +399,9 @@ case $ARCH in # No "lib" or ".so" part echo "mklib: Making FreeBSD shared library: " ${LIBNAME} OPTS="-shared" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi rm -f ${LIBNAME} ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} FINAL_LIBS=${LIBNAME} @@ -395,6 +415,9 @@ case $ARCH in else SHLIB="lib${LIBNAME}.so.${MAJOR}" OPTS="-shared -Wl,-soname,${SHLIB}" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi echo "mklib: Making FreeBSD shared library: " ${SHLIB} rm -f ${SHLIB} ${LINK} ${OPTS} ${LDFLAGS} -o ${SHLIB} ${OBJECTS} ${DEPS} @@ -448,6 +471,10 @@ case $ARCH in exit 1 fi + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + if [ $CPLUSPLUS = 1 ] ; then LINK="CC" else @@ -528,6 +555,10 @@ case $ARCH in } }' | sort -u >> ${EXPFILE} + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + # On AIX a shared library is linked differently when # you want to dlopen the file if [ $DLOPEN = "1" ] ; then @@ -579,6 +610,9 @@ case $ARCH in echo "mklib: Making Darwin static library: " ${LIBNAME} LINK="ar" OPTS="-ruvs" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS} FINAL_LIBS=${LIBNAME} else @@ -604,6 +638,10 @@ case $ARCH in OPTS="${OPTS} -arch i386" fi + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + # XXX can we always add -isysroot /Developer/SDKs/MacOSX10.4u.sdk # to OPTS here? @@ -669,6 +707,9 @@ case $ARCH in echo "mklib: Making Intel ICC static library: " ${LIBNAME}.a LINK="ar" OPTS="-ruv" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi # make lib ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS} # finish up @@ -679,6 +720,9 @@ case $ARCH in else OPTS="-shared" fi + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi VERSION="${MAJOR}.${MINOR}.${PATCH}" echo "mklib: Making Intel ICC shared library: " ${LIBNAME}.so.${VERSION} @@ -743,6 +787,9 @@ case $ARCH in echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a LINK="ar" OPTS="-ru" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi # make lib ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS} ranlib ${LIBNAME}.a @@ -750,6 +797,9 @@ case $ARCH in FINAL_LIBS=${LIBNAME}.a else OPTS="-shared -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}-${MAJOR}.dll if [ $CPLUSPLUS = 1 ] ; then |