6 # This script is to generate lib lustre library as a whole. It will leave
7 # two files on current directory: liblustre.a and liblustre.so.
9 # Most concern here is the libraries linking order
11 # FIXME: How to do this cleanly use makefile?
15 # see http://osdir.com/ml/gmane.comp.gnu.binutils.bugs/2006-01/msg00016.php
17 RANLIB=/usr/bin/ranlib
29 if [ ! -f $SYSIO/lib/libsysio.a ]; then
30 echo "ERROR: $SYSIO/lib/libsysio.a dosen't exist"
41 for _lib in $_objs; do
42 ALL_OBJS=$ALL_OBJS"$1/$_lib ";
47 # special treatment for libsysio
49 sysio_tmp=$CWD/sysio_tmp_`date +%s`
51 build_sysio_obj_list() {
57 for _lib in $_objs; do
58 ALL_OBJS=$ALL_OBJS"$sysio_tmp/$_lib ";
62 # lustre components libs
63 build_obj_list . libllite.a
64 build_obj_list ../lov liblov.a
65 build_obj_list ../obdecho libobdecho.a
66 build_obj_list ../osc libosc.a
67 build_obj_list ../lmv liblmv.a
68 build_obj_list ../mdc libmdc.a
69 build_obj_list ../fid libfid.a
70 build_obj_list ../fld libfld.a
71 build_obj_list ../mgc libmgc.a
72 build_obj_list ../ptlrpc libptlrpc.a
73 build_obj_list ../obdclass liblustreclass.a
74 build_obj_list ../lvfs liblvfs.a
76 # lnet components libs
77 build_obj_list ../../lnet/utils libuptlctl.a
78 build_obj_list ../../libcfs/libcfs libcfs.a
79 build_obj_list ../../libcfs/libcfs libcfsutil.a
80 if $(echo "$LND_LIBS" | grep "socklnd" >/dev/null) ; then
81 build_obj_list ../../lnet/ulnds/socklnd libsocklnd.a
83 if $(echo "$LND_LIBS" | grep "ptllnd" >/dev/null) ; then
84 build_obj_list ../../lnet/ulnds/ptllnd libptllnd.a
86 build_obj_list ../../lnet/lnet liblnet.a
88 if [ "x$QUOTA_LIBS" != "x" ]; then
89 build_obj_list ../quota libquota.a
92 # create static lib lsupport
93 rm -f $CWD/liblsupport.a
94 $AR -cru $CWD/liblsupport.a $ALL_OBJS
95 $RANLIB $CWD/liblsupport.a
97 # if libsysio is already in our LIBS we don't need to link against it here
98 if $(echo "$LIBS" | grep -v -- "-lsysio" >/dev/null) ; then
99 build_sysio_obj_list $SYSIO/lib/libsysio.a
102 # create static lib lustre
103 rm -f $CWD/liblustre.a
104 $AR -cru $CWD/liblustre.a $ALL_OBJS
105 $RANLIB $CWD/liblustre.a
107 # create shared lib lustre
108 rm -f $CWD/liblustre.so
110 if test x$OS = xAIX; then
111 $LD -shared -o $CWD/liblustre.so $ALL_OBJS -lpthread -Xlinker -bnoipath ../../libsyscall.so
113 $LD -shared -nostdlib -o $CWD/liblustre.so $ALL_OBJS $CAP_LIBS $PTHREAD_LIBS $ZLIB