-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
84 lines (77 loc) · 2.56 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
.PHONY: check-git-status
check-git-status:
@echo "Checking if all files are committed to git..."
@if [ -n "$$(git status --porcelain)" ]; then \
echo "The following files are not committed:"; \
git status --short; \
echo "Please commit all changes and try again."; \
git diff --color | cat; \
exit 1; \
else \
echo "All files are committed to git."; \
fi
.PHONY: add-eol
add-eol:
@find $(P) -type f | while read file; do \
if ! tail -c1 "$$file" | grep -q "^$$"; then \
echo >> "$$file"; \
fi \
done
.PHONY: add-eol-root
add-eol-root:
@find . -maxdepth 1 -type f | while read file; do \
if ! tail -c1 "$$file" | grep -q "^$$"; then \
echo >> "$$file"; \
fi \
done
.PHONY: instal-compiler
install-compiler:
@if [ "$(compiler)" = "clang" ]; then \
wget https://apt.llvm.org/llvm.sh; \
chmod +x llvm.sh; \
sudo ./llvm.sh $(version); \
rm llvm.sh;\
elif [ "$(compiler)" = "gcc" ]; then \
sudo apt install -y g++-$(version); \
sudo apt install -y gcc-$(version); \
else \
echo "Unknown compiler" >&2; \
fi
.PHONY: find-cxx-compiler
find-cxx-compiler:
@if [ "$(compiler)" = "clang" ]; then \
echo "/usr/bin/clang++-$(version)"; \
elif [ "$(compiler)" = "gcc" ]; then \
echo "/usr/bin/g++-$(version)"; \
else \
echo "Unknown compiler" >&2; \
fi
.PHONY: find-c-compiler
find-c-compiler:
@if [ "$(compiler)" = "clang" ]; then \
echo "/usr/bin/clang-$(version)"; \
elif [ "$(compiler)" = "gcc" ]; then \
echo "/usr/bin/gcc-$(version)"; \
else \
echo "Unknown compiler" >&2; \
fi
.PHONY: start-example
make start-example:
build_debug/examples/$(service)/example_$(service) --config_vars_override examples/$(service)/configs/config_vars.yaml --config examples/$(service)/configs/static_config.yaml
.PHONY: format
format:
python3.10 scripts/generate_all_headers.py library/uopenapi uopenapi
python3.10 scripts/format_includes.py library boost uopenapi checks userver
python3.10 scripts/format_includes.py examples boost uopenapi checks userver
python3.10 scripts/format_includes.py unit_tests boost uopenapi checks userver
find examples -name '*pp' -type f | xargs clang-format-17 -i
find library -name '*pp' -type f | xargs clang-format-17 -i
find unit_tests -name '*pp' -type f | xargs clang-format-17 -i
make add-eol P=unit_tests
make add-eol P=examples
make add-eol P=library
make add-eol P=CMake
make add-eol P=.github
make add-eol P=.vscode
make add-eol P=scripts
make add-eol-root