default: compare

.PHONY: compare
compare: fast-pseudorandom.out lcgrng.out
	cmp fast-pseudorandom.out lcgrng.out || true
	od -x < lcgrng.out | head -2
	od -x < fast-pseudorandom.out | head -2

lcgrng.out: lcgrng
	./lcgrng --seed 1 --bytes `expr 1024 \* 1024 \* 256` > lcgrng.out

fast-pseudorandom.out: fast-pseudorandom
	./fast-pseudorandom --seed 1 --bytes `expr 1024 \* 1024 \* 256` > fast-pseudorandom.out

go3: fast-pseudorandom
	./fast-pseudorandom -s 3 | dd bs=16 count=1 | od -x | head -2
	./lcgrng --bytes 16 --seed 3 | od -x | head -2

go:
	./lcgrng.py --numbers 10 --range 100
	./lcgrng.py --numbers 10 --range 100 --n-up 2
	./lcgrng.py --numbers 10 --range 100 --n-up 3

go2: fast-pseudorandom
	./fast-pseudorandom | od -x
	
fast-pseudorandom: fast-pseudorandom.c
	$(CC) -o fast-pseudorandom -O3 fast-pseudorandom.c
	
install:
	./install-file --file fast-pseudorandom --directory /usr/local/bin/.
	./install-file --file lcgrng --directory /usr/local/bin/.
	./install-link --src ../bin/lcgrng --dest lcgrng.py --cd-dir /usr/local/lib/.

clean:
	rm -f *.o fast-pseudorandom *.pyc *.out