summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authoruvok2025-12-25 12:21:19 +0100
committeruvok2025-12-25 12:21:19 +0100
commit7b180db48bcce40afba85d39a8ae73a5514854f3 (patch)
treea2b5c6dda320d26bf2d9c915469895ecb0f6bfee /Makefile
parentcfd07649c45036241239668c0e0061e61a5f8440 (diff)
Write my own dep resolve script
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 8 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index de8af58..20b58af 100644
--- a/Makefile
+++ b/Makefile
@@ -6,15 +6,19 @@ MAKEFLAGS += --no-builtin-variables
PROGRAM ?= led
CST ?= tangnano9k.cst
FLASH_OPTS ?=
+# Can't use this for deps:
+# -E $(PROGRAM).deps
+# as yosys needs to have -o specified for this to work
+# but I specify the command manually
+# also, yosys inserts /tmp/ files which makes this useless.
YOSYS_OPTS ?= -Q -q -l $(PROGRAM).yosys.log
DEPS := $(wildcard *.dep)
+
# this is "bad", as it runs the deps target every time
# probably because of the include below
# SOURCES := $(wildcard *.v)
# DEPS := $(SOURCES:.v=.dep)
-# yosys deps-file doesn't work, it writes ": infile depfiles"
-#-E $(PROGRAM).deps
## default target
all: $(PROGRAM).fs
@@ -40,13 +44,13 @@ clean:
# synthesize
%.json: %.v
- gawk 'match($$0, /`include "(.*)"/, ary) {print "$*.json:", ary[1]}' $< > $*.dep
+ sh resolvedeps.sh $<
yosys -p "read_verilog $<; synth_gowin -top $* -json $@" $(YOSYS_OPTS)
# because yosys -E is buggy, or behaves differently than expected,
# use gawk to force-create deps.
%.dep: %.v
- gawk 'match($$0, /`include "(.*)"/, ary) {print "$*.json:", ary[1]}' $< > $@
+ sh resolvedeps.sh $<
# place and route?
%.pnr.json: %.json $(CST)