check-parser-uptodate-or-warn.sh: improve shell script

master
David Allsopp 2019-09-25 15:44:00 +01:00 committed by Gabriel Scherer
parent 9490f7a89a
commit 7b078dedd8
2 changed files with 5 additions and 8 deletions

View File

@ -1094,9 +1094,9 @@ parsing/camlinternalMenhirLib.mli: boot/menhir/menhirLib.mli
parsing/parser.ml: boot/menhir/parser.ml parsing/parser.mly \
tools/check-parser-uptodate-or-warn.sh
@-tools/check-parser-uptodate-or-warn.sh
cat $< | sed "s/MenhirLib/CamlinternalMenhirLib/g" > $@
sed "s/MenhirLib/CamlinternalMenhirLib/g" $< > $@
parsing/parser.mli: boot/menhir/parser.mli
cat $< | sed "s/MenhirLib/CamlinternalMenhirLib/g" > $@
sed "s/MenhirLib/CamlinternalMenhirLib/g" $< > $@
beforedepend:: parsing/camlinternalMenhirLib.ml \
parsing/camlinternalMenhirLib.mli \

View File

@ -16,10 +16,7 @@
#**************************************************************************
# stop early if we are not on a development version
if test -z "$(cat VERSION | grep '+dev')"
then
exit 0
fi
grep -Fq '+dev' VERSION || exit 0
# We try to warn if the user edits parsing/parser.mly but forgets to
# rebuild the generated parser. Our heuristic is to use the file
@ -39,9 +36,9 @@ fi
stat . 2>/dev/null 1>/dev/null
if test $? != 0
then MTIME=""
elif test -n "$(stat --version 2>/dev/null | grep coreutils)"
elif stat --version 2>/dev/null | grep -Fq 'coreutils'
then MTIME="stat --format %Y"
elif test -n "$(stat 2>&1 | grep busybox)"
elif stat 2>&1 | grep -Fq 'busybox'
then MTIME="stat -c %Y"
else MTIME="stat -f %m" # BSD stat?
fi