diff options
| author | uvok | 2025-12-25 10:51:48 +0100 |
|---|---|---|
| committer | uvok | 2025-12-25 10:51:48 +0100 |
| commit | 65ba8e4c07b25f218b905819b989b5d23d92f723 (patch) | |
| tree | 48d89db8067e02a2507682d15782c1ef38deadef | |
| parent | 701c2e09df376ebd1e528d5f204281d448cc4019 (diff) | |
makefile: Try fix dep rule
| -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? |
