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