-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (43 loc) · 1.33 KB
/
Copy pathMakefile
File metadata and controls
57 lines (43 loc) · 1.33 KB
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
47
48
49
50
51
52
53
54
55
56
57
# GPUx top-level Makefile.
# Build the reference library and tests on Linux / macOS / WSL with gcc or clang.
#
# make - build all targets
# make smoke - run smoke tests (validates primitives + reference)
# make kat - run full known-answer test (allocates 2 GiB DAG)
# make gen-kat - regenerate spec/test_vectors.h
# make clean
CC ?= gcc
CFLAGS ?= -O3 -std=c11 -Wall -Wextra -mfma -fopenmp
LDFLAGS ?= -lm -fopenmp
# --- Sources ---
SPEC_C := \
spec/gpux.c \
spec/blake2b.c \
spec/chacha20.c \
spec/aes_round.c \
spec/argon2.c
SPEC_O := $(SPEC_C:.c=.o)
# --- Targets ---
ALL_BIN := build/smoke build/kat build/gen_kat
all: $(ALL_BIN)
build:
mkdir -p build
build/smoke: tests/smoke.c $(SPEC_O) | build
$(CC) $(CFLAGS) -o $@ tests/smoke.c $(SPEC_O) $(LDFLAGS)
build/kat: tests/kat.c $(SPEC_O) | build
$(CC) $(CFLAGS) -o $@ tests/kat.c $(SPEC_O) $(LDFLAGS)
build/gen_kat: tests/gen_kat.c $(SPEC_O) | build
$(CC) $(CFLAGS) -o $@ tests/gen_kat.c $(SPEC_O) $(LDFLAGS)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
smoke: build/smoke
@./build/smoke
kat: build/kat
@./build/kat
gen-kat: build/gen_kat
@./build/gen_kat > spec/test_vectors.h.new && mv spec/test_vectors.h.new spec/test_vectors.h
@echo "Regenerated spec/test_vectors.h"
clean:
rm -f $(SPEC_O)
rm -rf build
.PHONY: all smoke kat gen-kat clean