forked from robocup-logistics/rcll-rulebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (50 loc) · 1.48 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
pdf:
latexmk -pdf rulebook.tex
check: lint check-filetype check-trailing-whitespace check-line-length
# warning numbers that chktex should ignore
chktex_ignore=24 44
# maximum allowed length of a line
linelength=80
lint:
@chktex -q $(foreach w,$(chktex_ignore),-n $w) rulebook.tex | tee chktex.log
@bash -c '\
if [ -s chktex.log ] ; then \
echo "ERROR(lint): chktex found errors"; \
exit 1; \
else \
echo "lint: chktex passed!"; \
fi'
check-filetype:
@bash -c '\
expected="LaTeX 2e document, UTF-8 Unicode text"; \
actual="$$(file -b rulebook.tex)"; \
if [ "$$actual" != "$$expected" ] ; then \
echo "ERROR: Unexpected filetype"; \
echo "Expected: $$expected"; \
echo "Actual: $$actual"; \
exit 1; \
else \
echo "check: filetype check passed!"; \
fi'
check-trailing-whitespace:
@bash -c '\
trailing=$$(grep -n "\s$$" rulebook.tex); \
if [ $$? -eq 0 ] ; then \
echo "Lines with trailing whitespace:"; \
echo "$$trailing"; \
echo "ERROR: Found trailing whitespace"; \
exit 1; \
else \
echo "check: no trailing whitespaces, check passed!"; \
fi'
check-line-length:
@bash -c '\
longlines=$$(grep -n -e "^..\{${linelength}\}" rulebook.tex | grep -v -e "ignore-long-line"); \
if [ $$? -eq 0 ] ; then \
echo "Lines with length > ${linelength}:"; \
echo "$$longlines"; \
echo "ERROR: Found lines exceeding the max line length ${linelength}:"; \
exit 1; \
else \
echo "check: no overlong lines found, check passed!"; \
fi'