,我可以打印生成開始和完成之前的時間。在生成文件中顯示Makefile生成文件的生成持續時間
myitem: printf 'start time is %s\n' "$$(date --iso-seconds)" #other build command, i.e. g++ xxxx.cpp printf 'end time is %s\n' "$$(data --iso-seconds)"
是否有任何其他方式實現像下面的Make文件?
myitem: starttime = $$(date) #start my build printf "The build took time:" NowTime - startTime
我不認爲有一個內置的方式做到這一點。您必須在Unix中使用外部工具,如「時間」程序。據我所知,沒有本地類似的Windows命令,但必須有可用的PowerShell或Unix端口。 – Tim
相關:http://stackoverflow.com/questions/15171305/adding-time-duration-of-my-build-into-makefile – reinierpost
您可以定義'SHELL = time'或類似的,你有最近的GNU製作, '.ONESHELL'作爲一個整體來執行(和定時)食譜。 – reinierpost