SRC:= $(shell echo *.scm *.pl *.py *.sh) \
	game orders Makefile procmailrc README COPYING \
	user-guide/nulligarchie.texinfo user-guide/Makefile user-guide/html.patch \
	user-guide/keshan.png
SCHEME=guile -s

all: dist

.PHONY: test clean turn install

clean:
	rm -rf reports/*.xml reports/*.txt save tests mail-reports players.html

turn:
	perl null-administration.pl --make-turn

%.xml: %
	guile -s report2xml.scm $<

%.txt: %
	guile -s report2txt.scm $<

distclean: clean
	rm -rf reports turns incoming passwords *.pyc

install:
	chmod 600 game
	chmod 600 orders
	mkdir -p reports
	mkdir -p turns
	cp game turns/game.0

test: dist distclean install
	$(SCHEME) test.scm
	sh test-saving.sh
	perl -w test-cyclops.pl
	perl -w test-null-administration.pl --junk-mail
	sh testrun.sh
	chmod 444 game
	chmod 444 orders

dist: nulligarchy.tar.gz

nulligarchy.tar.gz: $(SRC)
	tar czf $@ $^
