Tuesday, April 29, 2008

Boolean Difference with object files

if [ -f $OUTPUT_FILE ]; then
rm -i $OUTPUT_FILE
fi

if [ -f $OUTPUT_FILE ]; then
echo "Must remove ${OUTPUT_FILE}"
exit
fi

rm -rf ./$INPUT_LIB_DIR
mkdir $INPUT_LIB_DIR
cd $INPUT_LIB_DIR

ar x $INPUT_LIB

cd ..

rm -rf ./$SUBTRACT_LIB_DIR
mkdir $SUBTRACT_LIB_DIR
cd $SUBTRACT_LIB_DIR

ar x $SUBTRACT_LIB

cd ..

rm -rf ./$OUTPUT_DIR
mkdir $OUTPUT_DIR

cd $INPUT_LIB_DIR

for a in ./*.o
do
if [ -f ../$SUBTRACT_LIB_DIR/${a} ]; then
echo "Skipping " ${a} > /dev/null
else
echo "Including " ${a}
cp ${a} ../$OUTPUT_DIR
fi
done

cd ..

for a in ./$OUTPUT_DIR/*.o
do
ar r ./$OUTPUT_FILE $a
done
ranlib ./$OUTPUT_FILE

rm -rf ./$INPUT_LIB_DIR
rm -rf ./$SUBTRACT_LIB_DIR
rm -rf ./$OUTPUT_DIR



Note: Code Formatting

No comments: