#CONFIG=ECHO
M4FLAGS=

SOURCES=xpumain.sl c2a.vhd xpu_header.inc xpu_behavioral.inc Makefile
CHIPDIR=../xc2s200

all: $(CHIPDIR)/c2a.vhd $(CHIPDIR)/c2a.ucf 

$(CHIPDIR)/c2a.vhd: ident c2a.vhd xpu0.inc Makefile xpu_header.inc xpu_behavioral.inc
	gm4 $(M4FLAGS) c2a.vhd > $(CHIPDIR)/c2a.vhd


$(CHIPDIR)/c2a.ucf: ident c2a.ucf xpu0.inc Makefile xpu_header.inc xpu_behavioral.inc
	gm4 $(M4FLAGS) c2a.ucf > $(CHIPDIR)/c2a.ucf

ident: $(SOURCES)
	./id $(SOURCES) | tee ident
	@echo

xpu0.inc: xpumain.sl xpuasm ident
	gm4 xpumain.sl | ./xpuasm

xpuasm: xpuasm.o
	cc -o xpuasm xpuasm.o
