# This file is part of "Ported tools for HDL".
# This software is distributed under the terms of the zlib License.
# Copyright (c) 2010 molelord
# All rights reserved.

DLX_SRC_Z=dlx.tar.gz

all : sim

clean :
	rm -rf dlx errlog

superclean : clean
	rm $(DLX_SRC_Z)

dlx/mark : $(DLX_SRC_Z)
	tar xf $<
	touch $@

dlx/work/mark :
	mkdir -p dlx/work
	touch $@

dlx/work/work-obj93.cf : dlx/mark dlx/work/mark
	cd dlx && ghdl -i --workdir=work *.vhdl

dlx/dlx_test_behaviour.exe : dlx/work/work-obj93.cf
	cd dlx && ghdl -m --workdir=work dlx_test_behaviour

dlx/dlx.out : dlx/test_loop.out
	cd dlx && cp $(<F) $(@F)

sim : dlx/dlx_test_behaviour.exe dlx/dlx.out
	-cd dlx && ghdl -r dlx_test_behaviour --assert-level=note 2> ../errlog
	diff goldenlog errlog && echo Ok || echo NG

$(DLX_SRC_Z) :
	wget http://ghdl.free.fr/$@
