VHDL_SOURCE = counter.vhdl second_counter.vhdl tb_second_counter.vhdl
TESTBENCHES = tb_second_counter

VHDL_SOURCE += state_machine.vhdl tb_state_machine.vhdl
TESTBENCHES += tb_state_machine

all: syntax_check run_tbs

clean:
	rm *.o *.cf

# ----- GHDL simulator -----

syntax_check: $(VHDL_SOURCE)
	ghdl -a $(GHDL_ARGS) $^

$(TESTBENCHES): $(VHDL_SOURCE)
	ghdl -a $(GHDL_ARGS) $^
	ghdl -e $(GHDL_ARGS) $@

run_tbs: $(TESTBENCHES)
	$(foreach test, $^, \
	echo $(test) && \
	./$(test) --wave=$(test).ghw && \
	) true

