Whamcloud - gitweb
land b_eq on HEAD
[fs/lustre-release.git] / lustre / liblustre / genlib.sh
1 #!/bin/bash
2 #set -xv
3
4 #
5 # This script is to generate lib lustre library as a whole. It will leave
6 # two files on current directory: liblustre.a and liblustre.so.
7 # Integrate them into Makefile.am later
8 #
9
10 AR=/usr/bin/ar
11 LD=/usr/bin/ld
12 RANLIB=/usr/bin/ranlib
13
14 CWD=`pwd`
15
16 SYSIO=$1
17
18 #if [ ! -f $SYSIO/lib/libsysio.a ]; then
19 #  echo "ERROR: $SYSIO/lib/libsysio.a dosen't exist"
20 #  exit 1
21 #fi
22 #
23 # do cleanup at first
24 #rm -f liblustre.so
25
26 ALL_OBJS=
27
28 build_obj_list() {
29   _objs=`$AR -t $1/$2`
30   for _lib in $_objs; do
31     ALL_OBJS=$ALL_OBJS"$1/$_lib ";
32   done;
33 }
34
35 #
36 # special treatment for libsysio
37 #
38 #sysio_tmp=$CWD/sysio_tmp_`date +%s`
39 #build_sysio_obj_list() {
40 #  _objs=`$AR -t $1`
41 #  mkdir -p $sysio_tmp
42 #  $AR -x $1
43 #  mv $_objs $sysio_tmp
44 #  for _lib in $_objs; do
45 #    ALL_OBJS=$ALL_OBJS"$sysio_tmp/$_lib ";
46 #  done
47 #}
48
49 # lustre components libs
50 build_obj_list . libllite.a
51 build_obj_list ../lov liblov.a
52 build_obj_list ../obdecho libobdecho.a
53 build_obj_list ../osc libosc.a
54 build_obj_list ../mdc libmdc.a
55 build_obj_list ../ptlrpc libptlrpc.a
56 build_obj_list ../obdclass liblustreclass.a
57 build_obj_list ../lvfs liblvfs.a
58
59 # portals components libs
60 build_obj_list ../portals/utils libuptlctl.a
61 build_obj_list ../portals/unals libtcpnal.a
62 build_obj_list ../portals/portals libportals.a
63
64 # create static lib lsupport
65 rm -f $CWD/liblsupport.a
66 $AR -cru $CWD/liblsupport.a $ALL_OBJS
67 $RANLIB $CWD/liblsupport.a
68
69 # libsysio components libs
70 build_obj_list $SYSIO/drivers/native libsysio_native.a
71 build_obj_list $SYSIO/drivers/sockets libsysio_sockets.a
72 build_obj_list $SYSIO/src libsysio.a
73 build_obj_list $SYSIO/dev/stdfd libsysio_stdfd.a
74 #
75 #build_sysio_obj_list $SYSIO/lib/libsysio.a
76 #
77
78 # create static lib lustre
79 rm -f $CWD/liblustre.a
80 $AR -cru $CWD/liblustre.a $ALL_OBJS
81 $RANLIB $CWD/liblustre.a
82
83 # create shared lib lustre
84 rm -f $CWD/liblustre.so
85 $LD -shared -o $CWD/liblustre.so -init __liblustre_setup_ -fini __liblustre_cleanup_ \
86         $ALL_OBJS -lpthread
87
88 #rm -rf $sysio_tmp