Skip to content

Commit 47d9c36

Browse files
authored
[Makefile, tools] Add "check" target and provide pre-commit hook for 'make check' (#8021)
As a drive-by fix, add all other phony targets to .PHONY.
1 parent 4f92571 commit 47d9c36

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ std-gram.ext
2121
tools/sections
2222
*.synctex.gz
2323
*.synctex*
24+
.check.stamp

source/Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,12 @@ clean-examples:
3030
rm -f $(EXAMPLES)
3131

3232
examples: $(EXAMPLES)
33+
34+
check: .check.stamp
35+
36+
.check.stamp: ../tools/check-source.sh *.tex
37+
@echo "Running tools/check-source.sh"
38+
@../tools/check-source.sh
39+
@touch $@
40+
41+
.PHONY: default refresh refresh full quiet clean-figures figures clean-examples examples check

tools/gitconfig.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
#!/bin/sh
22
git config diff.orderFile .gitorder
33
git config diff.c++draft.xfuncname '\\rSec[0-9]+(\[.*\])\{'
4+
5+
precommit="$(git rev-parse --git-dir)/hooks/pre-commit"
6+
7+
test -f "${precommit}" && exit
8+
read -p "Install 'make check' pre-commit hook? [Y/n] " hook
9+
if [ -z "${hook}" -o "${hook}" = "y" -o "${hook}" = "Y" ]; then
10+
cat <<EOF > "${precommit}"
11+
#!/bin/sh
12+
cd \$(git rev-parse --show-toplevel)/source
13+
make check
14+
EOF
15+
chmod +x "${precommit}"
16+
fi

0 commit comments

Comments
 (0)