Reputation: 19
I want to caluclate time spent for each recipe in 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
time spent = 2:23
time spent = 10:59
time spent = 5:35
it signify 1 minute 35 sec for first and same for others
or some other alternative for $(shell date)
Upvotes: 1
Views: 618
Reputation: 136256
Just prefix your command lines with time
, e.g.: time $(MAKE) -C $$dir
.
Upvotes: 1