简体   繁体   中英

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. Then, the .o files are linked into run executable.

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

i just began that but I'm not sure I began it correctly

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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