time-to-botec/nim/makefile

22 lines
794 B
Makefile
Raw Normal View History

2023-05-21 05:34:02 +00:00
SHELL := /bin/bash ## <= required to use time
VERBOSE=--verbosity:0
2023-05-21 05:22:02 +00:00
fast: samples.nim
nim c $(VERBOSE) -d:danger samples.nim
2023-05-21 02:24:30 +00:00
build: samples.nim
2023-05-21 05:34:02 +00:00
nim c $(VERBOSE) samples.nim
2023-05-21 05:22:02 +00:00
run: samples
2023-05-21 05:34:02 +00:00
./samples $(VERBOSE)
2023-05-21 05:22:02 +00:00
examine: samples
2023-05-21 05:54:03 +00:00
nim c $(VERBOSE) samples.nim && time ./samples $(VERBOSE) && echo
2023-05-21 05:46:45 +00:00
nim c $(VERBOSE) -d:release samples.nim && time ./samples $(VERBOSE) && echo
nim c $(VERBOSE) -d:danger samples.nim && time ./samples $(VERBOSE)
time-linux:
@echo "Requires /bin/time, found on GNU/Linux systems" && echo
@echo "Running 100x and taking avg time of: $(OUTPUT)"
@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