n=1,000,000

JAVAC=javac
JFLAGS=

%.class : %.java
	$(JAVAC) $(JFLAGS) $<

go: Sieve.class sieve.exe
	./compare

sieve.exe: sieve
	nuitka3 --recurse-all sieve

go-java: Sieve.class
	java Sieve $n

go-sieve: sieve
	./this-pylint --to-pylint sieve bits_mod.py
	./sieve 10
	time ./sieve $n > /dev/null 2>&1

go-numpy-sieve: numpy-sieve
	# This --ignore-message is needed with pylint 1.4.1, sadly.  However, a fix was checked in
	# August, 2014.  It doesn't appear to have made its way to pypi yet though.  January, 2015.
	./this-pylint \
		--which-2 None \
		--which-3 /usr/local/cpython-3.4/bin/pylint \
		--ignore-message ".*Module 'numpy' has no '.*' member" \
		--to-pylint numpy-sieve
	./numpy-sieve 10
	time ./numpy-sieve $n > /dev/null 2>&1

install-dependencies:
	# Without this, installing openjdk-9-jdk fails:
	# sudo apt-get -o Dpkg::Options::="--force-overwrite" install openjdk-9-jdk
	./install-package --deb-packages openjdk-9-jdk

clean:
	rm -f *.pyc *.class sieve.exe
	rm -rf __pycache__ .ropeproject sieve.build