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?
16 RANLIB=/usr/bin/ranlib
27 if [ ! -f $SYSIO/lib/libsysio.a ]; then
28 echo "ERROR: $SYSIO/lib/libsysio.a dosen't exist"
39 for _lib in $_objs; do
40 ALL_OBJS=$ALL_OBJS"$1/$_lib ";
45 # special treatment for libsysio
47 sysio_tmp=$CWD/sysio_tmp_`date +%s`
49 build_sysio_obj_list() {
55 for _lib in $_objs; do
56 ALL_OBJS=$ALL_OBJS"$sysio_tmp/$_lib ";
60 # lustre components libs
61 build_obj_list . libllite.a
62 build_obj_list ../lov liblov.a
63 build_obj_list ../obdecho libobdecho.a
64 build_obj_list ../osc libosc.a
65 build_obj_list ../lmv liblmv.a
66 build_obj_list ../mdc libmdc.a
67 build_obj_list ../fid libfid.a
68 build_obj_list ../fld libfld.a
69 build_obj_list ../mgc libmgc.a
70 build_obj_list ../ptlrpc libptlrpc.a
71 build_obj_list ../obdclass liblustreclass.a
72 build_obj_list ../lvfs liblvfs.a
74 # lnet components libs
75 build_obj_list ../../lnet/utils libuptlctl.a
76 build_obj_list ../../lnet/libcfs libcfs.a
77 if $(echo "$LND_LIBS" | grep "socklnd" >/dev/null) ; then
78 build_obj_list ../../lnet/ulnds/socklnd libsocklnd.a
80 if $(echo "$LND_LIBS" | grep "ptllnd" >/dev/null) ; then
81 build_obj_list ../../lnet/ulnds/ptllnd libptllnd.a
83 build_obj_list ../../lnet/lnet liblnet.a
85 if [ "x$QUOTA_LIBS" != "x" ]; then
86 build_obj_list ../quota libquota.a
89 # create static lib lsupport
90 rm -f $CWD/liblsupport.a
91 $AR -cru $CWD/liblsupport.a $ALL_OBJS
92 $RANLIB $CWD/liblsupport.a
94 # if libsysio is already in our LIBS we don't need to link against it here
95 if $(echo "$LIBS" | grep -v -- "-lsysio" >/dev/null) ; then
96 build_sysio_obj_list $SYSIO/lib/libsysio.a
99 # create static lib lustre
100 rm -f $CWD/liblustre.a
101 $AR -cru $CWD/liblustre.a $ALL_OBJS
102 $RANLIB $CWD/liblustre.a
104 # create shared lib lustre
105 rm -f $CWD/liblustre.so
107 if test x$OS = xAIX; then
108 gcc -shared -o $CWD/liblustre.so $ALL_OBJS -lpthread -Xlinker -bnoipath ../../libsyscall.so
110 $LD -shared -o $CWD/liblustre.so -init __liblustre_setup_ -fini __liblustre_cleanup_ \
111 $ALL_OBJS $CAP_LIBS $PTHREAD_LIBS