summaryrefslogtreecommitdiffstats
path: root/sys/Makefile
diff options
context:
space:
mode:
authorrpaulo <rpaulo@FreeBSD.org>2014-05-15 03:47:52 +0000
committerrpaulo <rpaulo@FreeBSD.org>2014-05-15 03:47:52 +0000
commitd6a32940d5eca46e8d6f168a8134952f3f9fb3da (patch)
tree2fd68481fe41ce748dc42a908c2aaabc7d2c3152 /sys/Makefile
parentf3c2b7869f794b6235071ce6add38722ecab2c17 (diff)
downloadFreeBSD-src-d6a32940d5eca46e8d6f168a8134952f3f9fb3da.zip
FreeBSD-src-d6a32940d5eca46e8d6f168a8134952f3f9fb3da.tar.gz
Add a new target cscope-hook.
This adds a Mercurial hook to automatically update the cscope data base every time you pull, switch branch, or update.
Diffstat (limited to 'sys/Makefile')
-rw-r--r--sys/Makefile19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/Makefile b/sys/Makefile
index 47fd462..fcb7e0a 100644
--- a/sys/Makefile
+++ b/sys/Makefile
@@ -47,6 +47,25 @@ ${.CURDIR}/cscope.files: .PHONY
cscope-clean:
rm -f cscope.files cscope.out cscope.in.out cscope.po.out
+#
+# Installs SCM hooks to update the cscope database every time the source tree
+# is updated.
+# cscope understands incremental updates, so it's considerably faster when only
+# a few files have changed.
+#
+HG_DIR=${.CURDIR}/../.hg
+HG_HOOK=if [ \$$HG_ERROR -eq 0 ]; then cd sys && make -m ../share/mk cscope; fi
+cscope-hook:
+ @if [ -d ${HG_DIR} ]; then \
+ if [ "`grep hooks ${HG_DIR}/hgrc`" = "" ]; then \
+ echo "[hooks]" >> ${HG_DIR}/hgrc; \
+ echo "update = ${HG_HOOK}" >> ${HG_DIR}/hgrc; \
+ echo "Hook installed in ${HG_DIR}/hgrc"; \
+ else \
+ echo "Mercurial update hook already exists."; \
+ fi; \
+ fi
+
# You need the devel/global and one of editor/emacs* ports for that.
TAGS ${.CURDIR}/TAGS: ${.CURDIR}/cscope.files
rm -f ${.CURDIR}/TAGS
OpenPOWER on IntegriCloud