From de33788bf9b835877edd1511e070adf98549dcd6 Mon Sep 17 00:00:00 2001 From: Piotr Esden-Tempski Date: Mon, 28 Dec 2015 16:53:48 +0100 Subject: [examples] Made the example Makefiles easier to reuse. --- examples/hx8kboard/Makefile | 22 +++++++++++++--------- examples/icestick/Makefile | 22 +++++++++++++--------- 2 files changed, 26 insertions(+), 18 deletions(-) (limited to 'examples') diff --git a/examples/hx8kboard/Makefile b/examples/hx8kboard/Makefile index 551de32..58be467 100644 --- a/examples/hx8kboard/Makefile +++ b/examples/hx8kboard/Makefile @@ -1,18 +1,22 @@ -all: example.bin +PROJ = example +PIN_DEF = hx8kboard.pcf +DEVICE = 8k -example.blif: example.v - yosys -p 'synth_ice40 -top top -blif example.blif' example.v +all: $(PROJ).bin -example.txt: example.blif hx8kboard.pcf - arachne-pnr -d 8k -o example.txt -p hx8kboard.pcf example.blif +%.blif: %.v + yosys -p 'synth_ice40 -top top -blif $@' $< -example.bin: example.txt - icepack example.txt example.bin +%.txt: $(PIN_DEF) %.blif + arachne-pnr -d $(DEVICE) -o $@ -p $^ + +%.bin: %.txt + icepack $< $@ prog: - iceprog example.bin + iceprog $(PROJ).bin clean: - rm -f example.blif example.txt example.bin + rm -f *.blif *.txt *.bin .PHONY: all prog clean diff --git a/examples/icestick/Makefile b/examples/icestick/Makefile index 295642a..4c56295 100644 --- a/examples/icestick/Makefile +++ b/examples/icestick/Makefile @@ -1,18 +1,22 @@ -all: example.bin +PROJ = example +PIN_DEF = icestick.pcf +DEVICE = 1k -example.blif: example.v - yosys -p 'synth_ice40 -top top -blif example.blif' example.v +all: $(PROJ).bin -example.txt: example.blif icestick.pcf - arachne-pnr -d 1k -o example.txt -p icestick.pcf example.blif +%.blif: %.v + yosys -p 'synth_ice40 -top top -blif $@' $< -example.bin: example.txt - icepack example.txt example.bin +%.txt: $(PIN_DEF) %.blif + arachne-pnr -d $(DEVICE) -o $@ -p $^ + +%.bin: %.txt + icepack $< $@ prog: - iceprog example.bin + iceprog $(PROJ).bin clean: - rm -f example.blif example.txt example.bin + rm -f *.blif *.txt *.bin .PHONY: all prog clean -- cgit v1.2.3 From 3ea5dbeb5c4a5ddb9969ecf067972735a5973919 Mon Sep 17 00:00:00 2001 From: Piotr Esden-Tempski Date: Mon, 28 Dec 2015 10:43:02 -0800 Subject: [examples] Added the project bin file to prog dependencies. --- examples/hx8kboard/Makefile | 4 ++-- examples/icestick/Makefile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'examples') diff --git a/examples/hx8kboard/Makefile b/examples/hx8kboard/Makefile index 58be467..bc47cf6 100644 --- a/examples/hx8kboard/Makefile +++ b/examples/hx8kboard/Makefile @@ -13,8 +13,8 @@ all: $(PROJ).bin %.bin: %.txt icepack $< $@ -prog: - iceprog $(PROJ).bin +prog: $(PROJ).bin + iceprog $< clean: rm -f *.blif *.txt *.bin diff --git a/examples/icestick/Makefile b/examples/icestick/Makefile index 4c56295..a9b1d8b 100644 --- a/examples/icestick/Makefile +++ b/examples/icestick/Makefile @@ -13,8 +13,8 @@ all: $(PROJ).bin %.bin: %.txt icepack $< $@ -prog: - iceprog $(PROJ).bin +prog: $(PROJ).bin + iceprog $< clean: rm -f *.blif *.txt *.bin -- cgit v1.2.3 From 3975b0abbcde3500efd54b153d1211833c608d75 Mon Sep 17 00:00:00 2001 From: Piotr Esden-Tempski Date: Wed, 30 Dec 2015 12:40:20 +0100 Subject: [examples] Added sudo prog target to prevent compiling the code as root. And made make clean more conservative. --- examples/hx8kboard/Makefile | 6 +++++- examples/icestick/Makefile | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/hx8kboard/Makefile b/examples/hx8kboard/Makefile index bc47cf6..e9fd789 100644 --- a/examples/hx8kboard/Makefile +++ b/examples/hx8kboard/Makefile @@ -16,7 +16,11 @@ all: $(PROJ).bin prog: $(PROJ).bin iceprog $< +sudo-prog: $(PROJ).bin + @echo 'Executing prog as root!!!' + sudo iceprog $< + clean: - rm -f *.blif *.txt *.bin + rm -f $(PROJ).blif $(PROJ).txt $(PROJ).bin .PHONY: all prog clean diff --git a/examples/icestick/Makefile b/examples/icestick/Makefile index a9b1d8b..eaed6f7 100644 --- a/examples/icestick/Makefile +++ b/examples/icestick/Makefile @@ -16,7 +16,11 @@ all: $(PROJ).bin prog: $(PROJ).bin iceprog $< +sudo-prog: $(PROJ).bin + @echo 'Executing prog as root!!!' + iceprog $< + clean: - rm -f *.blif *.txt *.bin + rm -f $(PROJ).blif $(PROJ).txt $(PROJ).bin .PHONY: all prog clean -- cgit v1.2.3