-
Notifications
You must be signed in to change notification settings - Fork 39
/
Makefile
55 lines (46 loc) · 1.54 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
.PHONY: all check check-style check-style-show check-style-fix clean generate-code generate-docs
all:
if [ ! -d "builddir" ]; then \
meson setup builddir; \
fi; \
meson compile -C builddir pkcs11
check:
meson test -C builddir
clean:
rm -rf builddir
check-style:
@lines=`git diff -U0 --no-color --relative origin/main -- ':!src/pkcs11.h' | clang-format-diff -p1 |wc -l`; \
if [ "$$lines" != "0" ]; then \
echo "Coding Style issues detected"; \
exit 1; \
else \
echo "Coding Styles checks out"; \
fi
check-style-show:
git diff -U0 --no-color --relative origin/main -- ':!src/pkcs11.h' | clang-format-diff -p1
check-style-fix:
git diff -U0 --no-color --relative origin/main -- ':!src/pkcs11.h' | clang-format-diff -i -p1
generate-code:
for pfile in src/*.pre; do \
gfile=`echo $${pfile} | sed s/\.pre/\.gen\.c/`; \
echo "/* DO NOT EDIT, autogenerated from $${pfile} */" > "$${gfile}"; \
echo "/* Modify $${pfile} then run make generate-code */" >> "$${gfile}"; \
cat $${pfile} | $(CC) -E - | grep -v "^#" > "$${gfile}.tmp"; \
sed -i -n -e '/^BEGIN:$$/,$$p' "$${gfile}.tmp"; \
sed -i 's/^BEGIN:$$//' "$${gfile}.tmp"; \
cat "$${gfile}.tmp" >> $${gfile}; \
clang-format -i --verbose "$${gfile}"; \
rm "$${gfile}.tmp"; \
done
generate-docs:
for mdfile in docs/*.md; do \
echo "Processing $${mdfile}"; \
manfile=`echo $${mdfile} | sed s/\.md//`; \
pandoc --standalone --to man $${mdfile} -o $${manfile}; \
done
dist:
rm -fr distdir
meson setup distdir
meson compile -C distdir pkcs11
meson test -C distdir
meson dist -C distdir