# 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.php
ppc64_CPU=`uname -p`
if [ "x${ppc64_CPU}" = "xppc64" ]; then
- LD="gcc -m64"
+ LD="$CC -m64"
else
- LD="gcc"
+ LD=$CC
fi
-RANLIB=/usr/bin/ranlib
CWD=`pwd`
LND_LIBS=$3
PTHREAD_LIBS=$4
CAP_LIBS=$5
-ZLIB=$6
if [ ! -f $SYSIO/lib/libsysio.a ]; then
echo "ERROR: $SYSIO/lib/libsysio.a dosen't exist"
ALL_OBJS=
build_obj_list() {
- _objs=`$AR -t $1/$2`
+ _objs=`$AR -t $1/$2 | grep -v SYMDEF | grep -v SORTED`
for _lib in $_objs; do
ALL_OBJS=$ALL_OBJS"$1/$_lib ";
done;
sysio_tmp=$CWD/sysio_tmp_`date +%s`
rm -rf $sysio_tmp
build_sysio_obj_list() {
- _objs=`$AR -t $1`
+ _objs=`$AR -t $1 | grep -v SYMDEF | grep -v SORTED`
mkdir -p $sysio_tmp
cd $sysio_tmp
$AR -x $1
build_obj_list ../mgc libmgc.a
build_obj_list ../ptlrpc libptlrpc.a
build_obj_list ../obdclass liblustreclass.a
-build_obj_list ../lvfs liblvfs.a
# lnet components libs
build_obj_list ../../lnet/utils libuptlctl.a
# if libsysio is already in our LIBS we don't need to link against it here
if $(echo "$LIBS" | grep -v -- "-lsysio" >/dev/null) ; then
- build_sysio_obj_list $SYSIO/lib/libsysio.a
+ build_sysio_obj_list $SYSIO/lib/libsysio.a
fi
# create static lib lustre
rm -f $CWD/liblustre.so
OS=`uname`
if test x$OS = xAIX; then
-$LD -shared -o $CWD/liblustre.so $ALL_OBJS -lpthread -Xlinker -bnoipath ../../libsyscall.so
+ $LD $LDFLAGS -shared -o $CWD/liblustre.so $ALL_OBJS -lpthread -Xlinker -bnoipath ../../libsyscall.so
else
# using -nostdlib on Ubuntu causes errors such as:
#./llite_lib.o: In function `liblustre_process_log':
#/home/brian/rpm/BUILD/lustre-1.8.2.50/lustre/liblustre/llite_lib.c:234: undefined reference to `__stack_chk_fail_local'
# due to the use of SSP
-#$LD -shared -nostdlib -o $CWD/liblustre.so $ALL_OBJS $CAP_LIBS $PTHREAD_LIBS $ZLIB
-$LD -shared -o $CWD/liblustre.so $ALL_OBJS $CAP_LIBS $PTHREAD_LIBS $ZLIB
+#$LD -shared -nostdlib -o $CWD/liblustre.so $ALL_OBJS $CAP_LIBS $PTHREAD_LIBS
+ $LD $LDFLAGS -shared -o $CWD/liblustre.so $ALL_OBJS $CAP_LIBS $PTHREAD_LIBS
fi
rm -rf $sysio_tmp