diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -8,6 +8,10 @@ CST ?= tangnano9k.cst FLASH_OPTS ?= 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 @@ -30,19 +34,22 @@ flash: $(PROGRAM).fs openFPGALoader -b tangnano9k $(FLASH_OPTS) $(PROGRAM).fs clean: - rm -rf *.json *.fs *.svg *.log *.deps + rm -rf *.json *.fs *.svg *.log *.dep synth: $(PROGRAM).json -deps: $(PROGRAM).deps +deps: $(DEPS) ## Patterns # synthesize -%.json: %.v +# re-synth if deps change (and create in the first place) +%.json: %.v %.dep yosys -p "read_verilog $<; synth_gowin -top $* -json $@" $(YOSYS_OPTS) -%.deps: %.v +# 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]}' $< > $@ # place and route? |
