-
Notifications
You must be signed in to change notification settings - Fork 42
/
Makefile
106 lines (83 loc) · 3.23 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# This is just a convenience Makefile to avoid having to remember
# all the CMake commands and their arguments.
# Set CMAKE_GENERATOR in the environment to select how you build, e.g.:
# CMAKE_GENERATOR=Ninja
BUILD_DIR=build
TEST_DIR=build/test
CLANG_FORMAT=clang-format -i
CLANG_FORMAT_EXCLUDE="test_vectors.cpp"
CLANG_TIDY=OFF
OPENSSL11_MANIFEST=alternatives/openssl_1.1
OPENSSL3_MANIFEST=alternatives/openssl_3
BORINGSSL_MANIFEST=alternatives/boringssl
TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
.PHONY: all dev dev3 test ctest dtest dbtest libs test-libs test-all everything ci ci3 clean cclean format
all: ${BUILD_DIR}
cmake --build ${BUILD_DIR} --target mlspp
${BUILD_DIR}: CMakeLists.txt test/CMakeLists.txt
cmake -B${BUILD_DIR} \
-DVCPKG_MANIFEST_DIR=${OPENSSL11_MANIFEST} \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE}
${TOOLCHAIN_FILE}:
git submodule update --init --recursive
dev: ${TOOLCHAIN_FILE}
# Only enable testing, not clang-tidy/sanitizers; the latter make the build
# too slow, and we can run them in CI
cmake -B${BUILD_DIR} -DTESTING=ON -DCMAKE_BUILD_TYPE=Debug \
-DVCPKG_MANIFEST_DIR=${OPENSSL11_MANIFEST} \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE}
dev3: ${TOOLCHAIN_FILE}
# Like `dev`, but using OpenSSL 3
cmake -B${BUILD_DIR} -DTESTING=ON -DCMAKE_BUILD_TYPE=Debug \
-DVCPKG_MANIFEST_DIR=${OPENSSL3_MANIFEST} \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE}
devB: ${TOOLCHAIN_FILE}
# Like `dev`, but using BoringSSL
cmake -B${BUILD_DIR} -DTESTING=ON -DCMAKE_BUILD_TYPE=Debug \
-DVCPKG_MANIFEST_DIR=${BORINGSSL_MANIFEST} \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE}
test: ${BUILD_DIR} test/*
cmake --build ${BUILD_DIR} --target mlspp_test
dtest: test
${TEST_DIR}/mlspp_test
dbtest: test
lldb ${TEST_DIR}/mlspp_test
ctest: test
cmake --build ${BUILD_DIR} --target test
libs: ${BUILD_DIR}
cmake --build ${BUILD_DIR} --target bytes
cmake --build ${BUILD_DIR} --target hpke
cmake --build ${BUILD_DIR} --target tls_syntax
cmake --build ${BUILD_DIR} --target mls_vectors
test-libs: ${BUILD_DIR}
cmake --build ${BUILD_DIR} --target lib/bytes/test
cmake --build ${BUILD_DIR} --target lib/hpke/test
cmake --build ${BUILD_DIR} --target lib/tls_syntax/test
cmake --build ${BUILD_DIR} --target lib/mls_vectors/test
test-all: test-libs ctest
everything: ${BUILD_DIR}
cmake --build ${BUILD_DIR}
ci: ${TOOLCHAIN_FILE}
cmake -B ${BUILD_DIR} -DTESTING=ON -DCLANG_TIDY=ON -DSANITIZERS=ON -DCMAKE_BUILD_TYPE=Debug \
-DVCPKG_MANIFEST_DIR=${OPENSSL11_MANIFEST} \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE}
ci3: ${TOOLCHAIN_FILE}
# Like `ci`, but using OpenSSL 3
cmake -B ${BUILD_DIR} -DTESTING=ON -DCLANG_TIDY=ON -DSANITIZERS=ON -DCMAKE_BUILD_TYPE=Debug \
-DVCPKG_MANIFEST_DIR=${OPENSSL3_MANIFEST} \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE}
ciB: ${TOOLCHAIN_FILE}
# Like `ci`, but using BoringSSL
cmake -B ${BUILD_DIR} -DTESTING=ON -DCLANG_TIDY=ON -DSANITIZERS=ON -DCMAKE_BUILD_TYPE=Debug \
-DVCPKG_MANIFEST_DIR=${BORINGSSL_MANIFEST} \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE}
clean:
cmake --build ${BUILD_DIR} --target clean
cclean:
rm -rf ${BUILD_DIR}
format:
for dir in include src test lib; \
do \
find $${dir} -iname "*.h" -or -iname "*.cpp" | grep -v ${CLANG_FORMAT_EXCLUDE} \
| xargs ${CLANG_FORMAT}; \
done