由于MAKEIFLE文件执行失败时会退出编译,当遇到编译错误时,后续的C文件就不能继续执行,即便C文件之间不存在依赖关系,用shell可以简便的实现遇到错误继续执行编译。
#!/usr/bin/bash va1=/home/zhaozl/dir sva1=${va1}"/sdir/src" sva2=${va1}"/sdir/inc" va2=/home/zhaozl/si bva2=${va2}"/lib" bva4=${va2}"/common/inc" va3="-g -ansi -Wall -Wextra -I${sva2} -I${bva2} -I${bva4}" rm 2.log rm -rf /home/zhaozl/dir/sdir/*.o rm -rf ${sva1}"/*.o" touch 2.log for file in ${sva1}"/*.c" do cc -c ${file} ${va3} 2>>2.log done
转载请注明原文地址: https://ju.6miu.com/read-4376.html