#Auto generated by Edalize

TARGET   := test_icestorm_0
PCF_FILE := pcf_file.pcf
PNR      ?= next
ARACHNE_PNR_OPTIONS := a few arachne_pnr_options
NEXTPNR_OPTIONS     := multiple nextpnr_options

all: $(TARGET).bin

%.blif: %.ys
	yosys -l yosys.log -q -s $?
%_arachne.asc: $(PCF_FILE) %.blif
	arachne-pnr $(ARACHNE_PNR_OPTIONS) -q -p $? -o $@
%.json: %.ys
	yosys -l yosys.log -q -s $?
%_next.asc: %.json
	nextpnr-ice40 -l next.log -q $(NEXTPNR_OPTIONS) --pcf $(PCF_FILE) --json $? --asc $@
%.bin: %_$(PNR).asc
	icepack $< $@

build-gui: $(TARGET).json
	nextpnr-ice40 -q $(NEXTPNR_OPTIONS) --pcf $(PCF_FILE) --json $? --asc $@ --gui

clean:
	rm -f $(TARGET).blif $(TARGET).json $(TARGET)_arachne.asc $(TARGET)_next.asc $(TARGET).bin
