This repository has been archived by the owner on Mar 14, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
79 lines (65 loc) · 2.85 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
FILES=`find lib include tests examples -type f -type f \( -iname "*.cpp" -o -iname "*.hpp" \)`
SYNAPSE_IMAGE="avhost/docker-matrix:v0.99.2"
DEPS_BUILD_DIR=.deps
DEPS_SOURCE_DIR=deps
help: ## This help message
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
@# Change the digit following by an 's' to adjust the width of the help text
third-party: ## Build & install third party dependencies
@cmake -GNinja -H${DEPS_SOURCE_DIR} -B${DEPS_BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DUSE_BUNDLED_BOOST=OFF
@cmake --build ${DEPS_BUILD_DIR}
debug: ## Create a debug build
@cmake -GNinja -H. -Bbuild \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \
-DCMAKE_INSTALL_PREFIX=${DEPS_BUILD_DIR}/usr
@cmake --build build
release: ## Create an optimized build
@cmake -GNinja -H. -Bbuild \
-DCMAKE_BUILD_TYPE=Release \
-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \
-DCMAKE_INSTALL_PREFIX=${DEPS_BUILD_DIR}/usr
@cmake --build build
test: ## Run the tests
@cd build/ && GTEST_COLOR=1 ctest --verbose
asan: ## Create a debug build using address sanitizers
@cmake -GNinja -H. -Bbuild \
-DCMAKE_BUILD_TYPE=Debug \
-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \
-DCMAKE_INSTALL_PREFIX=${DEPS_BUILD_DIR}/usr \
-DASAN=1
@cmake --build build
image:
docker build -t mtxclient-dev .
synapse: ## Start a synapse instance on docker
@docker run -v `pwd`/data:/data --rm \
-e SERVER_NAME=localhost -e REPORT_STATS=no ${SYNAPSE_IMAGE} generate
@openssl req \
-newkey rsa:2048 -nodes \
-keyout ./data/localhost.tls.key -x509 -days 365 \
-out ./data/localhost.tls.crt \
-subj "/C=NL/ST=Zuid Holland/L=Rotterdam/O=Sparkling Network/OU=IT Department/CN=ssl.raymii.org"
@cp .ci/homeserver.yaml data/homeserver.yaml
@docker run -d \
--name synapse \
-p 443:8448 \
-p 8448:8448 \
-p 8008:8008 \
-v `pwd`/data:/data ${SYNAPSE_IMAGE} start
@echo Waiting for synapse to start...
@until curl -sfk https://localhost:8448/_matrix/client/versions; do echo "Checking ..."; sleep 2; done
@echo Register alice
@docker exec synapse /bin/bash -c 'register_new_matrix_user --admin -u alice -p secret -c /data/homeserver.yaml http://localhost:8008'
@echo Register bob
@docker exec synapse /bin/bash -c 'register_new_matrix_user --admin -u bob -p secret -c /data/homeserver.yaml http://localhost:8008'
@echo Register carl
@docker exec synapse /bin/bash -c 'register_new_matrix_user --admin -u carl -p secret -c /data/homeserver.yaml http://localhost:8008'
stop-synapse: ## Stop any running instance of synapse
@rm -rf ./data/*
@docker rm -f synapse 2>&1>/dev/null
restart: stop-synapse synapse
lint: ## Run clang-format on the source code
@clang-format -i ${FILES} && git diff --exit-code
clean: ## Delete the build directory
rm -rf build