[英]Build time for makefile recipe
I want to caluclate time spent for each recipe in makefile 我想计算一下Makefile中每个配方花费的时间
SYS_TIME = $(shell date)
SUBDIRS = a b c d
.PHONY = default
default:
for dir in $(SUBDIRS); \
do \
$(eval ST = $(SYS_TIME)) \
$(MAKE) -C FOLD=$$dir; \
$(eval ET = $(SYS_TIME))
echo "time spent = $(ST) - $(ET) "
done; \
result should look like: 结果应如下所示:
time spent = 1:35
花的时间= 1:35
time spent = 2:23
花的时间= 2:23
time spent = 10:59
花的时间= 10:59
time spent = 5:35
花费时间= 5:35
it signify 1 minute 35 sec for first and same for others 表示第一次1分钟35秒,其他人则相同
or some other alternative for $(shell date) 或$(日期)的其他替代方法
只需在命令行前面加上time
,例如: time $(MAKE) -C $$dir
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.