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