NASM ?= nasm
PYTHON ?= python

# 'murky' is the rarest target word we'll use
# https://github.com/lynn/hello-wordl/blob/7da40c1f067eb1ec157d4c5b7a9bd8257ed39342/src/Game.tsx#L34
RAREST_WORD = murky

all: dosdl.com

dosdl.com: dosdl.asm dictionary.inc targets.inc license.inc
	$(NASM) -fbin -o $@ $<

dictionary.inc: dictionary.json targets.json compress-dict.py
	$(PYTHON) compress-dict.py $< targets.json $(RAREST_WORD) $@

targets.inc: targets.json compress-targets.py
	$(PYTHON) compress-targets.py $< $(RAREST_WORD) $@

license.inc: LICENSE embed-textfile.py
	$(PYTHON) embed-textfile.py $< license_str $@

clean:
	rm -f *.inc *.com

distclean: clean

run: dosdl.com
	dosbox dosdl.com

.PHONY: all clean distclean run