summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruvok2025-12-23 19:07:22 +0000
committeruvok2025-12-23 19:07:22 +0000
commite1ab9b20b1df99e87070be0bb5add200f3eda419 (patch)
tree14a84c371a51512720013ea1814f411eb146425e
parente0970b34d629eb765e6e488f6c43caef1620faf3 (diff)
Use pattern
-rw-r--r--Makefile24
1 files changed, 17 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 949996d..bd8a62b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,19 +1,29 @@
+MAKEFLAGS += --no-builtin-rules
+MAKEFLAGS += --no-builtin-variables
+.SUFFIXES:
+
all: led.fs
tangnano9k.cst:
wget https://github.com/YosysHQ/apicula/raw/refs/heads/master/examples/tangnano9k.cst || \
curl -LO https://github.com/YosysHQ/apicula/raw/refs/heads/master/examples/tangnano9k.cst
-led.json: led.v
- yosys -p "read_verilog led.v; synth_gowin -top led -json led.json"
+%.json: %.v
+ yosys -p "read_verilog $<; synth_gowin -top $* -json $@"
-pnrled.json: tangnano9k.cst led.json
- nextpnr-himbaechel --json led.json --write pnrled.json \
+%.pnr.json: %.json tangnano9k.cst
+ nextpnr-himbaechel --json $< --write $@ \
--device GW1NR-LV9QN88PC6/I5 --vopt family=GW1N-9C \
- --vopt cst=tangnano9k.cst
+ --vopt cst=tangnano9k.cst || \
+ nextpnr-gowin --json $< --write $@ \
+ --device GW1NR-LV9QN88PC6/I5 --family GW1N-9C \
+ --cst tangnano9k.cst
-led.fs: pnrled.json
- gowin_pack -d GW1N-9C -o led.fs pnrled.json
+%.fs: %.pnr.json
+ gowin_pack -d GW1N-9C -o $@ $<
flash: led.fs
openFPGALoader -b tangnano9k -f led.fs
+
+clean:
+ rm -rf *.json *.fs