encrypt = kosaki2.pl
crack = test_chitoge.pl
strip = test_marika.pl

error_util = error_util.exe
crack_util = crack_util.exe

test: test_encode test_strip test_crack

test_crack: $(encrypt) $(crack)
	./test_crack.sh $^

test_strip: $(strip)
	./test_strip.sh $^

test_encode: $(encrypt)
	./test_encode.sh $^

test_chitoge.pl: $(encrypt)
	perl $(encrypt) chitoge $(encrypt) > $@

test_marika.pl: $(encrypt)
	perl $(encrypt) marika $(encrypt) > $@

$(error_util): compute_error.cc
	g++ -Wall -Werror -O3 -ansi -pedantic -std=c++0x $< -o $@

$(crack_util): crack.cc
	g++ -Wall -Werror -O3 -ansi -pedantic -std=c++0x $< -o $@

clean:
	-rm -f test_chitoge.pl test_marika.pl $(error_util) $(crack_util)

backup:
	-rm -f backup.tar.gz
	tar cf backup.tar *.pl *.cc *.sh *.txt *.csv Makefile
	gzip -9 backup.tar
