简体   繁体   English

bash脚本在循环中使用gcc编译所有

[英]bash script uses gcc in a loop to compile all

I need write bash script that uses gcc in a loop to compile all .c source files in current directory into .o object files, and additionally creates .s assembly listings in Intel format. 我需要编写bash脚本,该脚本在循环中使用gcc将当前目录中的所有.c源文件编译为.o目标文件,并另外以Intel格式创建.s程序集列表。 Then, the .o files are linked into run executable. 然后,.o文件被链接到运行可执行文件中。

    for i in *
do
    gcc -type -f "*.c"
done

i just began that but I'm not sure I began it correctly 我刚刚开始,但是我不确定我是否正确开始了

与其让他们编写bash脚本,不如编写一个专门用于自动执行此类事情的makefile,这绝对是更好的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM