-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathmakefile
48 lines (34 loc) · 1.01 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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),)
CFLAGS:=$(CFLAGS) -DcROUNDS=$(cROUNDS)
endif
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 $@
debug: $(SRC)
$(CC) $(CFLAGS) -g $^ -o $@ -DDEBUG_SIPHASH
vectors: $(SRC)
$(CC) $(CFLAGS) $^ -o $@ -DGETVECTORS
analyze: $(SRC)
scan-build $(CC) $(CFLAGS) $^ -o $@
rm -f $@
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