-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (56 loc) · 1.66 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
OS := $(shell uname)
CXX=g++
CXX_STANDARD=-std=c++17
########################## link ##########################
LINK=dynamic
ifeq ($(LINK), dynamic)
LINKER=
else ifeq ($(LINK), static)
LINKER=-static
endif
########################## sanitizer ##########################
ifeq ($(CXX), clang++)
ADDRESS_SANITIZER=-fsanitize=address
THREADS_SANITIZER=-fsanitize=thread
else
ADDRESS_SANITIZER=
THREADS_SANITIZER=
endif
########################## version ##########################
VERSION=portable
ifeq ($(VERSION), portable)
COMPILATION_MSG="compiling portable version"
DFLAGS=
else ifeq ($(VERSION), aesni)
COMPILATION_MSG="compiling AES-NI version"
DFLAGS=-D_USE_INTEL_AESNI -maes
else ifeq ($(VERSION), neon)
COMPILATION_MSG="compiling AES aarch64 neon version"
DFLAGS=-D_USE_ARM_NEON_AES -march=armv8-a+crypto
endif
########################## type ##########################
TYPE=release
ifeq ($(TYPE), release)
CXX_FLAGS=-O3 -Wall -Wextra
else ifeq ($(TYPE), debug)
CXX_FLAGS=-O2 -Wall -Wextra $(ADDRESS_SANITIZER)
endif
########################## CLASSIC MAKEFILE ##########################
default:
@echo "Makefile variables and possible values"
@echo "The the first element are always the default value"
@echo "Recipes : test"
@echo "CXX : g++, clang++"
@echo "TYPE : release, debug"
@echo "VERSION : portable, aesni, neon"
@echo "LINK : dynamic, static"
@echo ""
test:
$(CXX) $(CXX_STANDARD) $(LINKER) tests.cpp -o tests.out $(DFLAGS) $(CXX_FLAGS)
./tests.out
asmcode:
$(CXX) $(CXX_STANDARD) $(LINKER) -S -mllvm -masm=intel tests.cpp -o tests.out $(DFLAGS) -O3
clean:
@rm tests.out
style:
@clang-format -i -style=file *.cpp *.hpp BlockCipherModes/*.hpp