📄 genlib.sh
字号:
#!/bin/bash#set -xvset -e## This script is to generate lib lustre library as a whole. It will leave# two files on current directory: liblustre.a and liblustre.so.## Most concern here is the libraries linking order## FIXME: How to do this cleanly use makefile?#AR=/usr/bin/ar# see http://osdir.com/ml/gmane.comp.gnu.binutils.bugs/2006-01/msg00016.phpLD=gccRANLIB=/usr/bin/ranlibCWD=`pwd`SYSIO=$1LIBS=$2LND_LIBS=$3PTHREAD_LIBS=$4QUOTA_LIBS=$5CAP_LIBS=$6ZLIB=$7if [ ! -f $SYSIO/lib/libsysio.a ]; then echo "ERROR: $SYSIO/lib/libsysio.a dosen't exist" exit 1fi# do cleanup at firstrm -f liblustre.soALL_OBJS=build_obj_list() { _objs=`$AR -t $1/$2` for _lib in $_objs; do ALL_OBJS=$ALL_OBJS"$1/$_lib "; done;}## special treatment for libsysio#sysio_tmp=$CWD/sysio_tmp_`date +%s`rm -rf $sysio_tmpbuild_sysio_obj_list() { _objs=`$AR -t $1` mkdir -p $sysio_tmp cd $sysio_tmp $AR -x $1 cd .. for _lib in $_objs; do ALL_OBJS=$ALL_OBJS"$sysio_tmp/$_lib "; done}# lustre components libsbuild_obj_list . libllite.abuild_obj_list ../lov liblov.abuild_obj_list ../obdecho libobdecho.abuild_obj_list ../osc libosc.abuild_obj_list ../mdc libmdc.abuild_obj_list ../mgc libmgc.abuild_obj_list ../ptlrpc libptlrpc.abuild_obj_list ../obdclass liblustreclass.abuild_obj_list ../lvfs liblvfs.a# lnet components libsbuild_obj_list ../../lnet/utils libuptlctl.abuild_obj_list ../../lnet/libcfs libcfs.aif $(echo "$LND_LIBS" | grep "socklnd" >/dev/null) ; then build_obj_list ../../lnet/ulnds/socklnd libsocklnd.afiif $(echo "$LND_LIBS" | grep "ptllnd" >/dev/null) ; then build_obj_list ../../lnet/ulnds/ptllnd libptllnd.afibuild_obj_list ../../lnet/lnet liblnet.aif [ "x$QUOTA_LIBS" != "x" ]; then build_obj_list ../quota libquota.afi# create static lib lsupportrm -f $CWD/liblsupport.a$AR -cru $CWD/liblsupport.a $ALL_OBJS$RANLIB $CWD/liblsupport.a# if libsysio is already in our LIBS we don't need to link against it hereif $(echo "$LIBS" | grep -v -- "-lsysio" >/dev/null) ; then build_sysio_obj_list $SYSIO/lib/libsysio.afi# create static lib lustrerm -f $CWD/liblustre.a$AR -cru $CWD/liblustre.a $ALL_OBJS$RANLIB $CWD/liblustre.a# create shared lib lustrerm -f $CWD/liblustre.soOS=`uname`if test x$OS = xAIX; then$LD -shared -o $CWD/liblustre.so $ALL_OBJS -lpthread -Xlinker -bnoipath ../../libsyscall.soelse$LD -shared -nostdlib -o $CWD/liblustre.so $ALL_OBJS $CAP_LIBS $PTHREAD_LIBS $ZLIBfirm -rf $sysio_tmp
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -