From 437ffd2f29eaa3a7e93611627f2bc1204d00abe8 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Wed, 10 Feb 2016 09:41:06 +0200
Subject: [PATCH] Corrected my own erros in the Makefile, added a PHP7 test.

---
 Makefile | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index e354966..cc0bb67 100644
--- a/Makefile
+++ b/Makefile
@@ -1,19 +1,27 @@
+.PHONY: all test clean c python3
+ROUNDS = 100000
+
+c: a.out
+
+python3: __pycache__
+
 all: python3 c
 
-python3: prime.py
+__pycache__:
 	py3compile -V 3.0- prime.py
 
-c: prime.c
+a.out:
 	gcc --std=c99 -Wall -lm prime.c
 
 clean:
 	- rm -fr a.out __pycache__
 
 test: all
-	@ time -f "%C : %E seconds" ./a.out 100000 > /dev/null
-	@ time -f "%C : %E seconds" ./prime.py 100000 > /dev/null
-	@ time -f "%C : %E seconds" ./prime.lua 100000 > /dev/null
-	@ time -f "%C : %E seconds" ./prime.php 100000 > /dev/null
-	@ time -f "%C : %E seconds" ./prime.rb 100000 > /dev/null
-	@ time -f "%C : %E seconds" ./prime.js 100000 > /dev/null
-	@ time -f "%C : %E seconds" ./prime.awk 100000 > /dev/null
+	@ time -f "%C : %E seconds" ./a.out $(ROUNDS) > /dev/null
+	@ [ -n "$$(which python3)" ] && time -f "%C : %E seconds" ./prime.py $(ROUNDS) > /dev/null
+	@ [ -n "$$(which lua)" ] && time -f "%C : %E seconds" ./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
-- 
GitLab