diff options
Diffstat (limited to 'test/Makefile')
-rw-r--r-- | test/Makefile | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..f161386 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,34 @@ +CC ?= gcc +VERICERT ?= vericert +VERICERT_OPTS ?= -fschedule +IVERILOG ?= iverilog +IVERILOG_OPTS ?= + +TESTS := $(patsubst %.c,%.check,$(wildcard *.c)) + +all: $(TESTS) + +%.gcc.out: %.gcc + @./$< ; echo "$$?" >$@ + +%.o: %.c + @$(CC) $(CFLAGS) -c $< -o $@ + +%.gcc: %.o + @$(CC) $(CFLAGS) $< -o $@ + +%.v: %.c + @$(VERICERT) $(VERICERT_OPTS) $< -o $@ + +%.iver: %.v + @$(IVERILOG) $(IVERILOG_OPTS) -o $@ -- $< + +%.veri.out: %.iver + @./$< | tail -n1 | sed -r -e 's/[^0-9]*([0-9]+)/\1/' >$@ + +%.check: %.gcc.out %.veri.out + @diff $^ >$@ + @printf "\033[0;36mOK\033[0m\t$(patsubst %.check,%,$@)\n" + +clean: + rm -f *.check *.gcc *.gcc.out *.o *.v *.iver *.veri.out |