c - GCC 和生成文件 : Only show errors and warnings

标签 c gcc makefile

我有一个 makefile 可以编译我项目中的每个 .c 文件。对于每个文件,我将整个编译命令打印到 shell 中,其中包含所有选项和标志。这是一个文件的示例输出:

arm-none-eabi-gcc -c -mcpu=cortex-m3 -O0 -dM -g -gdwarf-2 -mthumb -fomit-frame-pointer -fverbose-asm -Wa,-ahlms=src/sim/sim_configuration.lst -include ./lib/stm32core/stm32f2xx_conf.h -I . -I./lib/ARMStandardLibrary -I./lib/LwIP -I./lib/LwIP/src/include -I./lib/LwIP/src/include -I./lib/LwIP/src/include/ipv4 -I./lib/LwIP/src/include/ipv6 -I./lib/FatFS -I./lib/stm32core -I./src -I./src/sim -I./src/sd -I./src/tftp src/sim/sim_configuration.c -o src/sim/sim_configuration.o

问题是各种警告在这一团乱七八糟的命令输出中丢失了。有没有办法打印出现的警告和错误(不是原始命令)?

最佳答案

使用-s 选项执行make。来自man page .

-s, --silent, --quiet
    Silent operation; do not print the commands as they are executed.

关于c - GCC 和生成文件 : Only show errors and warnings,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11956518/

相关文章:

Makefile:21: *** 配方在第一个目标之前开始。停止

c++ - 是否可以使用编译时计算将 C/C++ 结构填充到固定大小?

c - 在字符串数组中搜索字符串的函数

c - 减法中 16 位 int 机器和 32 位 int 机器之间的不同结果

linux - 如何在编译器输出中找到实际的 GCC 错误?

gcc - 使用 mingw c++ 链接到 ffmpeg 库 -> 未定义的引用

configuration - 使 : Redo some targets if configuration changes

c - 动态文件格式转换 - C 编程

gcc - Ansible安装-clang : error: unknown argument: '-mno-fused-madd'

c - makefile C 奇怪的 bash 命令行为