FILES = world.dg systems.dg interface.dg automap.dg plist.dg stdlib.dg
DGDEBUG = ~/Projects/Dialog/src/dgdebug
DIALOGC = ~/Projects/Dialog/src/dialogc
AAMBUNDLE = ~/Projects/Aamachine/src/aambundle

debug: $(FILES)
	$(DGDEBUG) debugger.dg $(FILES)

vvv.log: $(FILES)
	$(DIALOGC) -t aa release.dg $(FILES) -o tmp.aastory -vvv 2>&1 > vvv.log
	rm tmp.aastory

endymion.aastory: $(FILES) hints.html
	$(DIALOGC) -H 2000 -A 1000 -L 1000 -t aa release.dg $(FILES) -o endymion.aastory
# These memory settings are probably overkill, but I have no way to test this on multiple machines, so I'm just doubling the defaults and hoping for the best!

regress: $(FILES)
	$(DGDEBUG) -s 1234 -w 59 debugger.dg $(FILES) <regress.in >regress.out
	meld regress.out regress.gold

web: endymion.aastory modweb/resources/frontend.js modweb/resources/style.css cover.jpg
	rm -rf web
	$(AAMBUNDLE) -o web endymion.aastory
	cp -r modweb/* -t web -v
	cp cover.jpg -t web
	mv web/play.html web/index.html

play: web
	xdg-open web/index.html

# Generate the hints.html file from the hints.clu file
PWD := $(shell pwd)
hints.html: hints.clu
	( cd ~/Projects/Invisiclues && python3 maker.py $(PWD)/hints )

itch.zip: web
	rm -f itch.zip
	( cd web && zip -r ../itch.zip . )
	cp itch.zip itch2.zip
# We need two copies to have a downloadable alongside the web playable

build: quotes regress itch.zip

quotes:
	( grep "[\"']" *.dg | grep -v "(dict " ) && echo "PROBLEM: Straight quotes found!" && exit 1 || echo No straight quotes found! Carry on!
