编译时如何更改 makefile 诊断消息 [GNU ARM GCC,Eclipse make.exe]
How to change makefile diagnostic message when compiling [ GNU ARM GCC, Eclipse make.exe]
我正在通过使用 GNU-ARM-Gcc
和 Eclipse_make.exe 构建项目来为 STM32F4 构建程序。一切正常,但编译时终端上显示的诊断消息太长且很难看清。编译每个 *.c 文件时,终端都会给我一条诊断消息(请参阅下面的段落)任何人都可以给我建议只显示一个文件名 [删除 gcc 目录路径、依赖项、头文件路径]。 makefile 由 CubeMX 生成。这是生成文件:https://github.com/loiefy/STM32-makefile/blob/main/Makefile
示例诊断消息:
C:/Program Files (x86)/GNU Arm Embedded Toolchain/9 2020-q2-update/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F407xx -IEngine/Src/website_c -IEngine/Inc -ILWIP/Target -IMiddlewares/Third_Party/LwIP/src/include -IMiddlewares/Third_Party/LwIP/system -IDrivers/STM32F4xx_HAL_Driver/Inc -IDrivers/STM32F4xx_HAL_Driver/Inc/Legacy -IMiddlewares/Third_Party/LwIP/src/include/netif/ppp -IMiddlewares/Third_Party/LwIP/src/apps/httpd -IDrivers/CMSIS/Device/ST/STM32F4xx/Include -IMiddlewares/Third_Party/LwIP/src/include/lwip -IMiddlewares/Third_Party/LwIP/src/include/lwip/apps -IMiddlewares/Third_Party/LwIP/src/include/lwip/priv -IMiddlewares/Third_Party/LwIP/src/include/lwip/prot -IMiddlewares/Third_Party/LwIP/src/include/netif -IMiddlewares/Third_Party/LwIP/src/include/posix -IMiddlewares/Third_Party/LwIP/src/include/posix/sys -IMiddlewares/Third_Party/LwIP/system/arch -IDrivers/CMSIS/Include -IDrivers/CMSIS/Include -IEngine/Inc -ILWIP/Target -Og -Wall -fdata-sections -ffunction-sections -fdiagnostics-show-location=every-line -g -gdwarf-2 -MMD -MP -MF"build/mqtt.d" -Wa,-a,-ad,-alms=build/mqtt.lst Middlewares/Third_Party/LwIP/src/apps/mqtt/mqtt.c -o build/mqtt.o
我要显示的消息:Middlewares/Third_Party/LwIP/src/apps/mqtt/mqtt.c 已编译
我花了一天时间发现 echo 命令或另一个命令具有相同的目的来显示 makefile 中的消息。但我什么也没找到。
感谢您的帮助
所以 make 默认回显它运行的每一行 - makefile 中的编译器行:
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
将输出执行行你可以做的是:
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
@echo "compiling $<"
@$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
注意:make中的@
前缀表示不打印正在执行的命令。因此,即使是回声线也需要 @ 否则你会得到 echo comping...
以及 compiling ...
被打印出来
您可能想也可能不想对所有输出做类似的事情。我有时会根据可以传入的详细标志有条件地做一个或另一个,这样当你真的想看到实际的编译行时,你可以....
我正在通过使用 GNU-ARM-Gcc
和 Eclipse_make.exe 构建项目来为 STM32F4 构建程序。一切正常,但编译时终端上显示的诊断消息太长且很难看清。编译每个 *.c 文件时,终端都会给我一条诊断消息(请参阅下面的段落)任何人都可以给我建议只显示一个文件名 [删除 gcc 目录路径、依赖项、头文件路径]。 makefile 由 CubeMX 生成。这是生成文件:https://github.com/loiefy/STM32-makefile/blob/main/Makefile
示例诊断消息:
C:/Program Files (x86)/GNU Arm Embedded Toolchain/9 2020-q2-update/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F407xx -IEngine/Src/website_c -IEngine/Inc -ILWIP/Target -IMiddlewares/Third_Party/LwIP/src/include -IMiddlewares/Third_Party/LwIP/system -IDrivers/STM32F4xx_HAL_Driver/Inc -IDrivers/STM32F4xx_HAL_Driver/Inc/Legacy -IMiddlewares/Third_Party/LwIP/src/include/netif/ppp -IMiddlewares/Third_Party/LwIP/src/apps/httpd -IDrivers/CMSIS/Device/ST/STM32F4xx/Include -IMiddlewares/Third_Party/LwIP/src/include/lwip -IMiddlewares/Third_Party/LwIP/src/include/lwip/apps -IMiddlewares/Third_Party/LwIP/src/include/lwip/priv -IMiddlewares/Third_Party/LwIP/src/include/lwip/prot -IMiddlewares/Third_Party/LwIP/src/include/netif -IMiddlewares/Third_Party/LwIP/src/include/posix -IMiddlewares/Third_Party/LwIP/src/include/posix/sys -IMiddlewares/Third_Party/LwIP/system/arch -IDrivers/CMSIS/Include -IDrivers/CMSIS/Include -IEngine/Inc -ILWIP/Target -Og -Wall -fdata-sections -ffunction-sections -fdiagnostics-show-location=every-line -g -gdwarf-2 -MMD -MP -MF"build/mqtt.d" -Wa,-a,-ad,-alms=build/mqtt.lst Middlewares/Third_Party/LwIP/src/apps/mqtt/mqtt.c -o build/mqtt.o
我要显示的消息:Middlewares/Third_Party/LwIP/src/apps/mqtt/mqtt.c 已编译
我花了一天时间发现 echo 命令或另一个命令具有相同的目的来显示 makefile 中的消息。但我什么也没找到。
感谢您的帮助
所以 make 默认回显它运行的每一行 - makefile 中的编译器行:
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
将输出执行行你可以做的是:
$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
@echo "compiling $<"
@$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
注意:make中的@
前缀表示不打印正在执行的命令。因此,即使是回声线也需要 @ 否则你会得到 echo comping...
以及 compiling ...
您可能想也可能不想对所有输出做类似的事情。我有时会根据可以传入的详细标志有条件地做一个或另一个,这样当你真的想看到实际的编译行时,你可以....