我有一个 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/