CABAL_FILE = RoRo.cabal
GHC = ghc

build: dist/setup-config Setup
	$(MAKE) -C schemas $@
	./Setup build


#STAGE = ./examples/difficult-story12-stage7.xml
#STAGE = ./examples/yama-aruki--sphynx-na-yama-aruki.xml
#STAGE = ./examples/yama-aruki--ega-joyu-to-chikahi.xml
#STAGE = ./examples/yama-aruki--yoake-ga-sphynx.xml
#STAGE = ./examples/yama-aruki--yoake-ha-hana-no-tane.xml
STAGE = ./examples/yama-aruki--nurse-wo-yattekita.xml
#STAGE = ./examples/simple-flush.xml
#STAGE = ./examples/simple-downy.xml
run: build
	@echo ".:.:. Let's go .:.:."
#	./dist/build/roro/roro +RTS -hr
#	./dist/build/roro/roro ./examples/difficult-story12-stage7.xml +RTS -p
#	./dist/build/roro/roro +RTS -xc
#	zsh -c 'ulimit -v 1048576; time ./dist/build/roro/roro +RTS -N2 -RTS $(STAGE)'
#	./dist/build/roro/roro +RTS -N2 -RTS $(STAGE)
	zsh -c 'ulimit -v 1048576; ./dist/build/roro/roro +RTS -N2 -RTS $(STAGE) -o result.xml'

dist/setup-config: $(CABAL_FILE) Setup
#	./Setup configure --disable-optimization
	./Setup configure

Setup: Setup.hs
	$(GHC) --make Setup

clean:
	$(MAKE) -C schemas $@
	rm -rf dist Setup Setup.o Setup.hi
	find . -name '*~' -exec rm -f {} \;

doc: dist/setup-config Setup
	./Setup haddock --hscolour-css=../../_haskell/hscolour/hscolour.css

install: build
	sudo ./Setup install

sdist: Setup
	./Setup sdist

.PHONY: build run clean install doc sdist
