include $(NOODLYBOX_HOME)/etc/makerule

DIRS=pkg msim msimv ise isev isesim isesimv

.PRECIOUS : $(foreach X, $(DIRS), $(X)/makefile)

all : vhdl

clean :
	-cd c && $(MAKE) clean
	-rm -rf $(DIRS)
	-rm -f rtl/MAINDCM.v rtl/MAINDCM.vhd

vhdl : package-vhdl msimproj-vhdl iseproj-vhdl

verilog : msimproj-verilog iseproj-verilog

testprogram :
	cd c && $(MAKE) depend && $(MAKE)

$(DIRS) :
	mkdir $@

%/makefile : %_makefile %
	cp $< $@

msimv/makefile : msim_makefile
	cp $< $@

isev/makefile : ise_makefile
	cp $< $@

isesimv/makefile : isesim_makefile
	cp $< $@

package-vhdl : pkg pkg/makefile
	cd $< && $(MAKE)

%proj-vhdl : % %/makefile package-vhdl testprogram
	cd $< && $(MAKE)

%proj-verilog : %v %v/makefile testprogram
	cd $< && $(MAKE)
