makefile (794B)
1 SHELL := /bin/bash ## <= required to use time 2 VERBOSE=--verbosity:0 3 4 fast: samples.nim 5 nim c $(VERBOSE) -d:danger samples.nim 6 7 build: samples.nim 8 nim c $(VERBOSE) samples.nim 9 10 run: samples 11 ./samples $(VERBOSE) 12 13 examine: samples 14 nim c $(VERBOSE) samples.nim && time ./samples $(VERBOSE) && echo 15 nim c $(VERBOSE) -d:release samples.nim && time ./samples $(VERBOSE) && echo 16 nim c $(VERBOSE) -d:danger samples.nim && time ./samples $(VERBOSE) 17 18 time-linux: 19 @echo "Requires /bin/time, found on GNU/Linux systems" && echo 20 @echo "Running 100x and taking avg time of: $(OUTPUT)" 21 @t=$$(/usr/bin/time -f "%e" -p bash -c 'for i in {1..100}; do ./samples; done' 2>&1 >/dev/null | grep real | awk '{print $$2}' ); echo "scale=2; 1000 * $$t / 100" | bc | sed "s|^|Time: |" | sed 's|$$|ms|' && echo