makefile (1030B)
1 # Interface: 2 # make 3 # make build 4 # make run 5 # make time-linux 6 # make install 7 # make format 8 # make time-linux-simple 9 # make profile-linux 10 11 SRC=samples.lua 12 # INTERPETER=lua# < original 13 INTERPETER=luajit# < faster 14 15 run: $(SRC) 16 $(INTERPETER) $(SRC) 17 18 time-linux: 19 @echo "Requires /bin/time, found on GNU/Linux systems" && echo 20 @echo "Running 100x and taking avg time of: $(INTERPETER) $(SRC)" 21 @t=$$(/usr/bin/time -f "%e" -p bash -c 'for i in {1..100}; do $(INTERPETER) $(SRC); done' 2>&1 >/dev/null | grep real | awk '{print $$2}' ); echo "scale=2; 1000 * $$t / 100" | bc | sed "s|^|Time: |" | sed 's|$$|ms|' && echo 22 23 time-linux-simple: 24 @echo "Requires /bin/time, found on GNU/Linux systems" && echo 25 /bin/time -f "Time: %es" $(INTERPETER) $(SRC) && echo 26 27 profile-linux: 28 @echo "Requires perf, which depends on the kernel version, and might be in linux-tools package or similar" 29 @echo "Must be run as sudo" 30 sudo perf record $(INTERPETER) $(SRC) 31 sudo perf report 32 rm perf.data