1# $FreeBSD$ 2 3.if !(make(cscope) || make(cscope-clean) || make(cscope-hook) || make(TAGS) || \ 4 make(glimpse) || make(glimpse-clean)) 5.include <src.opts.mk> 6 7# The boot loader 8.if ${MK_BOOT} != "no" 9SUBDIR= boot 10.endif 11.endif 12 13# Directories to include in cscope name file and TAGS. 14CSCOPEDIRS= boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \ 15 geom gnu isa kern libkern modules net net80211 \ 16 netgraph netinet netinet6 netipsec netnatm netpfil \ 17 netsmb nfs nfsclient nfsserver nlm ofed opencrypto \ 18 pci rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR} 19.if !defined(CSCOPE_ARCHDIR) 20.if defined(ALL_ARCH) 21CSCOPE_ARCHDIR = amd64 arm i386 ia64 mips pc98 powerpc sparc64 x86 22.else 23CSCOPE_ARCHDIR = ${MACHINE} 24.if ${MACHINE} != ${MACHINE_CPUARCH} 25CSCOPE_ARCHDIR += ${MACHINE_CPUARCH} 26.endif 27.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" 28CSCOPE_ARCHDIR += x86 29.endif 30.endif 31.endif 32 33# Loadable kernel modules 34 35.if defined(MODULES_WITH_WORLD) 36SUBDIR+=modules 37.endif 38 39HTAGSFLAGS+= -at `awk -F= '/^RELEASE *=/{release=$2}; END {print "FreeBSD", release, "kernel"}' < conf/newvers.sh` 40 41# You need the devel/cscope port for this. 42cscope: cscope.out 43cscope.out: ${.CURDIR}/cscope.files 44 cd ${.CURDIR}; cscope -k -buq -p4 -v 45 46${.CURDIR}/cscope.files: .PHONY 47 cd ${.CURDIR}; \ 48 find ${CSCOPEDIRS} -name "*.[chSsly]" -a -type f > ${.TARGET} 49 50cscope-clean: 51 rm -f cscope.files cscope.out cscope.in.out cscope.po.out 52 53# 54# Installs SCM hooks to update the cscope database every time the source tree 55# is updated. 56# cscope understands incremental updates, so it's considerably faster when only 57# a few files have changed. 58# 59HG_DIR=${.CURDIR}/../.hg 60HG_HOOK=if [ \$$HG_ERROR -eq 0 ]; then cd sys && make -m ../share/mk cscope; fi 61cscope-hook: 62 @if [ -d ${HG_DIR} ]; then \ 63 if [ "`grep hooks ${HG_DIR}/hgrc`" = "" ]; then \ 64 echo "[hooks]" >> ${HG_DIR}/hgrc; \ 65 echo "update = ${HG_HOOK}" >> ${HG_DIR}/hgrc; \ 66 echo "Hook installed in ${HG_DIR}/hgrc"; \ 67 else \ 68 echo "Mercurial update hook already exists."; \ 69 fi; \ 70 fi 71 72# You need the devel/global and one of editor/emacs* ports for that. 73TAGS ${.CURDIR}/TAGS: ${.CURDIR}/cscope.files 74 rm -f ${.CURDIR}/TAGS 75 cd ${.CURDIR}; xargs etags -a < ${.CURDIR}/cscope.files 76 77# You need the textproc/glimpse ports for this. 78glimpse: 79.if !exists(${.CURDIR}/.glimpse_exclude) 80 echo .svn > ${.CURDIR}/.glimpse_exclude 81 echo /compile/ >> ${.CURDIR}/.glimpse_exclude 82.endif 83 cd ${.CURDIR}; glimpseindex -H . -B -f -o . 84 85glimpse-clean: 86 cd ${.CURDIR}; rm -f .glimpse_* 87 88.include <bsd.subdir.mk> 89