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