-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
78 lines (70 loc) · 2.11 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
GENERATE_SQL_QUERIES_FLAGS ?= src/sql src/codegen sql sql
.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: format
format:
python3.10 scripts/format_includes.py library boost uopenapi checks
find checks -name '*pp' -type f | xargs clang-format-17 -i
find library -name '*pp' -type f | xargs clang-format-17 -i
make add-eol P=tests
make add-eol P=src
make add-eol P=.github
make add-eol-root
.PHONY: gen-queries
gen-queries:
@python3 scripts/generate_sql_queries.py $(GENERATE_SQL_QUERIES_FLAGS)