1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
#!/bin/bash
# USAGE:
# mklib <std|deb|opt|all>
#
# FUNCTION
# Creates ".a" files in "$saclib/lib/" depending on the argument:
# - 'std' causes a standard library to be built. The library file will have
# the name "saclib.a" and the corresponding object files are in
# "saclib/lib/obj".
# - 'deb' switches on the '-g' option of the compiler which includes
# debugging information in the object files. The library file will have
# the name "saclibd.a" and the corresponding object files are in
# "saclib/lib/objd".
# - 'opt' switches on the '-O' option which produces optimized code. The
# library file will have the name "saclibo.a" and the corresponding object
# files are in "saclib/lib/objo".
# - 'all' builds all three types of libraries.
if [ $# -lt 1 ]
then
echo "USAGE:"
echo " mklib <deb|opt|all>"
exit
fi
if [ $1 = "clean" ]
then
### remove .o and .a and makefiles
echo "Removing object files, libraries and makefiles ..."
pushd >/dev/null $saclib/lib/objo
'rm' -f *
popd >/dev/null
pushd >/dev/null $saclib/lib/objd
'rm' -f *
popd >/dev/null
pushd >/dev/null $saclib/lib/
'rm' -f *.a
popd >/dev/null
### do sysdep cleanup
echo "Removing system-dependent files ..."
pushd >/dev/null $saclib/sysdep/linuxX86
./cleanup
popd >/dev/null
pushd >/dev/null $saclib/sysdep/linuxX86_64
./cleanup
popd >/dev/null
pushd >/dev/null $saclib/sysdep/solarisSparc
./cleanup
popd >/dev/null
pushd >/dev/null $saclib/sysdep/macosX86
./cleanup
popd >/dev/null
pushd >/dev/null $saclib/sysdep/macosX86_64
./cleanup
popd >/dev/null
exit
fi
if [ ! -n "${CC+1}" ]
then
CC=cc
fi
echo "Compiling with" $CC
if [ $1 = "std" ]
then
echo "This option no longer exists!"
elif [ $1 = "deb" ]; then
pushd >/dev/null $saclib/lib/objd
make CC=$CC "SACFLAG=-g -DNO_SACLIB_MACROS" EXTENSION=d
popd >/dev/null
elif [ $1 = "opt" ]; then
pushd >/dev/null $saclib/lib/objo
make CC=$CC "SACFLAG=" EXTENSION=o
popd >/dev/null
elif [ $1 = "all" ]; then
pushd >/dev/null $saclib/lib/objd
make CC=$CC "SACFLAG=-g -DNO_SACLIB_MACROS" EXTENSION=d
popd >/dev/null
pushd >/dev/null $saclib/lib/objo
make CC=$CC "SACFLAG=" EXTENSION=o
popd >/dev/null
else
echo "USAGE:"
echo " mklib <deb|opt|all>"
exit
fi
echo "mklib done."
|