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 93 94
|
#!/bin/bash
BASE=`pwd` # .../src/icmake
# show usage if no arguments were used
if [ "$#" == "0" ] ; then
echo "
Usage: buildlib <any argument>
Before calling this script 'prepare' must have been called.
"
exit 0
fi
cd support
. ../buildscripts/flags
. ../buildscripts/try
# check for the completion of ./prepare
if [ ! -e ../tmp/INSTALL.sh ] ; then
echo tmp/INSTALL.sh does not exist. Execute ./prepare to create it
exit 1
fi
# define the directory names and the std. variables (AUTHOR etc.)
. ../tmp/INSTALL.sh
# now BINDIR, SKELDIR, .... etc have been defined
# the @SKELDIR@ etc. names in icmbuild and icmstart are converted by
# ./install, calling scripts/convert
echo "
Constructed files are located under ./tmp
Final files are installed in the directories specified by tmp/INSTALL.sh
but may be stored elsewhere by ./install
"
compile()
{
echo Compiling in `pwd`
[ "`find ./ -mindepth 1 -maxdepth 1 -type d -name ORG`" != "" ] && return
count=0 # use o-file numbers to avoid name collisions
for subdir in \ `find ./ -mindepth 1 -maxdepth 1 -type d |sort` ; do
[ $subdir == "./xerr" ] && continue
try cd $subdir
srclist=`find -mindepth 1 -maxdepth 1 -type f -name '*.cc' \
-exec basename '{}' ';' | sort`
if [ "$srclist" != "" ]
then
for src in `find -mindepth 1 -maxdepth 1 -type f -name '*.cc' \
-exec basename '{}' ';' | sort`
do
obj=../${count}${src%%.*}.o
if [ $src -nt ${obj} ] ; then
opts=" -o${obj} -c $src"
try ${CXX} "${CXXFLAGS} ${opts}"
fi
done
fi
try cd ..
let count=$count+1 # next directory nr.
done
}
# # in 'support/'
# cp bobcat.tgz ../tmp/usr/share/icmake/
#
# mkdir -p ../tmp/bobcat
mkdir -p ../tmp/build
ln -s ../../xerr ../tmp/build/xerr
#cp -r xerr ../tmp/build
try cd ${BASE}/tmp/build
tar xzf ../../support/bobcat.tgz
tar xzf ../../support/support.tgz
compile
try ar rs ../libicmake.a *.o
echo "
Next: call './build x'
"
|