summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile9
2 files changed, 6 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 9da71de..f4bb047 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,4 @@
*.fs
*.log
*.svg
-
+*.dep
diff --git a/Makefile b/Makefile
index 5f3d026..9f38548 100644
--- a/Makefile
+++ b/Makefile
@@ -38,19 +38,19 @@ clean:
synth: $(PROGRAM).json
-deps: $(DEPS)
+deps: $(PROGRAM).dep
## Patterns
# synthesize
-# re-synth if deps change (and create in the first place)
-%.json: %.v %.dep
+%.json: %.v
+ gawk 'match($$0, /`include "(.*)"/, ary) {print "$*.json:", ary[1]}' $< > $*.dep
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 FILENAME, ":", ary[1]}' $< > $@
+ gawk 'match($$0, /`include "(.*)"/, ary) {print "$*.json:", ary[1]}' $< > $@
# place and route?
%.pnr.json: %.json $(CST)
@@ -74,3 +74,4 @@ deps: $(DEPS)
## inter-file dependencies
-include $(DEPS)
+-include $($(wildcard *.fs:.fs=.dep)