ID=notepad
DIR=~/roms
ASM=uxncli ${DIR}/drifblim.rom
LIN=uxncli ${DIR}/uxnlin.rom
EMU=uxn11
ROM=bin/${ID}.rom

all: ${ROM} src/assets.tal

lint:
	@ ${LIN} src/${ID}.tal
run: all
	@ ${EMU} ${ROM}
clean:
	@ rm -f ${ROM} ${ROM}.sym
install: ${ROM}
	@ cp ${ROM} ${DIR}
uninstall:
	@ rm -f ${DIR}/${ID}.rom
archive: all
	@ cat src/${ID}.tal src/assets.tal | sed 's/~[^[:space:]]\+//' > bin/res.tal
	@ ${ASM} bin/res.tal bin/res.rom && ${EMU} bin/res.rom
	@ cp bin/res.tal ../../../oscean/etc/${ID}.tal.txt
	@ rm bin/res.tal

.PHONY: all clean lint run install uninstall archive

${ROM}: src/*
	@ mkdir -p bin
	@ ${ASM} src/${ID}.tal ${ROM}