Skip to content
Makefile 1.39 KiB
Newer Older
nimrod's avatar
nimrod committed
.PHONY: all test clean c python3 clojure
ROUNDS = 100000

c: a.out

python3: __pycache__

nimrod's avatar
nimrod committed
clojure: target/uberjar
nimrod's avatar
nimrod committed

nimrod's avatar
nimrod committed
target/uberjar:
nimrod's avatar
nimrod committed
	cd prime.clj; lein uberjar

nimrod's avatar
nimrod committed
all: python3 c clojure
nimrod's avatar
nimrod committed

nimrod's avatar
nimrod committed
	py3compile -V 3.0- prime.py
nimrod's avatar
nimrod committed

nimrod's avatar
nimrod committed
	gcc --std=c99 -Wall -lm -O3 prime.c
nimrod's avatar
nimrod committed

clean:
nimrod's avatar
nimrod committed
	cd prime.clj; lein clean
nimrod's avatar
nimrod committed

	@ time -f "%C : %E seconds" ./a.out $(ROUNDS) > /dev/null
nimrod's avatar
nimrod committed
	@ time -f "%C : %E seconds" java -jar prime.clj/target/uberjar/*-standalone.jar $(ROUNDS) > /dev/null
	@ [ -n "$$(which python)" ] && time -f "%C : %E seconds" ./prime.py $(ROUNDS) > /dev/null
	@ [ -n "$$(which python3)" ] && time -f "%C : %E seconds" python3 prime.py $(ROUNDS) > /dev/null
	@ [ -n "$$(which pypy)" ] && time -f "%C : %E seconds" pypy  prime.py $(ROUNDS) > /dev/null
	@ [ -n "$$(which lua)" ] && time -f "%C : %E seconds" ./prime.lua $(ROUNDS) > /dev/null
	@ [ -n "$$(which luajit)" ] && time -f "%C : %E seconds" luajit prime.lua $(ROUNDS) > /dev/null
	@ [ -n "$$(which php)" ] && time -f "%C : %E seconds" ./prime.php $(ROUNDS) > /dev/null
	@ [ -n "$$(which php7.0)" ] && time -f "%C : %E seconds" php7.0 prime.php $(ROUNDS) > /dev/null
	@ [ -n "$$(which ruby)" ] && time -f "%C : %E seconds" ./prime.rb $(ROUNDS) > /dev/null
	@ [ -n "$$(which node)" ] && time -f "%C : %E seconds" ./prime.js $(ROUNDS) > /dev/null
	@ [ -x /usr/bin/awk ] && time -f "%C : %E seconds" ./prime.awk $(ROUNDS) > /dev/null