Skip to content

Commit

Permalink
Makefile: automatically detect tests
Browse files Browse the repository at this point in the history
don't complain about absent files

Signed-off-by: Jan Vesely <[email protected]>
  • Loading branch information
jvesely committed Feb 26, 2016
1 parent b770790 commit 6c6d99c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
BINS=alu.test.run
TESTS=$(shell find . -maxdepth 1 -name '*.test.v')
BINS=$(TESTS:.v=.run)

VFLAGS=-g 2009 -Wall


all: $(BINS)

%.run: %.v
iverilog -g 2009 -Wall $< -o $@
iverilog $(VFLAGS) $< -o $@

clean:
rm -v *.run Makefile.deps
rm -fv *.run Makefile.deps


.INTERMEDIATE: $(BINS:.run=.v.dep)
%.v.dep: %.v
$(eval TMPF=$(shell mktemp))
iverilog -Minclude=$(TMPF) $< -o /dev/null
iverilog $(VFLAGS) -Minclude=$(TMPF) $< -o /dev/null
sed -i -e "1i $@:" -e 's/\.v\.dep:/.run:/' $(TMPF)
paste -sd ' ' $(TMPF) > $@
paste -sd ' ' $(TMPF) | sed -e 's/\.v\.dep:/.run:/' >> $@
rm -f $(TMPF)

Makefile.deps: $(BINS:.run=.v.dep)
cat $^ > $@
cat $^ /dev/null > $@

ifneq ($(BINS),)
include Makefile.deps
endif

0 comments on commit 6c6d99c

Please sign in to comment.