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