From 371dd98e3508045bc8346da3ed8225b76ce536f6 Mon Sep 17 00:00:00 2001 From: JP Aumasson Date: Fri, 19 Feb 2021 08:21:37 +0100 Subject: tests --- makefile | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'makefile') diff --git a/makefile b/makefile index af05a9f..4c7d9ad 100644 --- a/makefile +++ b/makefile @@ -1,6 +1,7 @@ CC=gcc CFLAGS=-Wall --std=c99 SRC=siphash.c halfsiphash.c test.c testmain.c +HEADERS=siphash.h halfsiphash.h BIN=test debug vectors ifneq ($(cROUNDS),) @@ -11,21 +12,37 @@ ifneq ($(dROUNDS),) CFLAGS:=$(CFLAGS) -DdROUNDS=$(dROUNDS) endif +.PHONY: analyze sanitize lint format clean + + all: $(BIN) +everything: clean format lint analyze sanitize test vectors + test: $(SRC) - $(CC) $(CFLAGS) $^ -o $@ + $(CC) $(CFLAGS) $^ -o $@ debug: $(SRC) - $(CC) $(CFLAGS) $^ -o $@ -DDEBUG + $(CC) $(CFLAGS) -g $^ -o $@ -DDEBUG vectors: $(SRC) $(CC) $(CFLAGS) $^ -o $@ -DGETVECTORS +analyze: $(SRC) + scan-build $(CC) $(CFLAGS) $^ -o $@ + rm -f $@ -clean: - rm -f *.o $(BIN) +sanitize: $(SRC) + $(CC) -fsanitize=address,undefined $(CFLAGS) $^ -o $@ + ./$@ + rm -f $@ + +lint: $(SRC) $(HEADERS) + cppcheck --std=c99 $^ format: clang-format -style="{BasedOnStyle: llvm, IndentWidth: 4}" \ -i *.c *.h +clean: + rm -f *.o $(BIN) analyze sanitize + -- cgit v1.2.3