#!/bin/sh CC=gcc CXX=g++ CFLAGS="-O -g" CXXFLAGS="-O -g" BUILTOBJS="" # Compile C files for file in `find ./ -name "*.c" -maxdepth 1 -print` do echo -n "${file}..." ${CC} ${CFLAGS} -c ${file} if [ $? = 0 ]; then echo "compiled" BUILTOBJS="${BUILTOBJS} "`echo -n "${file}" | sed 's/.c$/.o/'` else exit 1 fi done # Compile C++ files for file in `find ./ -name "*.cpp" -maxdepth 1 -print` do echo -n "${file}..." ${CXX} ${CXXFLAGS} -c ${file} if [ $? = 0 ]; then echo "compiled" BUILTOBJS="${BUILTOBJS} "`echo -n "${file}" | sed 's/.cpp$/.o/'` else exit 1 fi done echo -n "listcab..." ${CXX} ${CXXFLAGS} -o listcab ${BUILTOBJS} if [ $? = 0 ]; then echo "linked" else exit 1 fi exit 0