Makefile中加带时间戳的打印

来源:互联网 发布:find命令linux 编辑:程序博客网 时间:2024/05/20 16:00

#实现打印功能的规则#Define Debug String
_str_date = $(shell date --rfc-3339="ns") _str_debug = "[$(_str_date)] sim@debug--- "#Set Rules.PHONY: sim@debugsim@debug:@echo $(_str_debug)#使用说明#use-age:#add sim@debug to your Makefile .PHONY or PHONY += sim@debug#and set sim@debug to be dependency whitch you want debug target. #eg:all: sim@debug _ubootwhen make check target all, it will print sim@debug to terminatefor example:[2017-12-05 10:21:22.4343243+8.00] sim@debug--- KBUILD_DIR=/home/uboot-2014.07

#note: 建议把sim@debug作为第一个依赖,因为make检测依赖是从左往右进行,如果第一个依赖需要执行很多命令,sim@debug将会在这些命令打印完成后才能打印出。

例子:


原创粉丝点击