xref: /freebsd/sys/Makefile (revision 5688843dc9c5fd8d3fe0c0915a6240d680e0b506)
1ff2ad7d6SGreg Lehey# Directories to include in cscope name file and TAGS.
2ca987d46SWarner LoshCSCOPEDIRS=	bsm cam cddl compat conf contrib crypto ddb dev fs gdb \
345c203fcSGleb Smirnoff		geom gnu isa kern libkern modules net net80211 \
4*5688843dSKonrad Witaszczyk		netgraph netinet netinet6 netipsec netlink netpfil \
546c57c8dSJohn Baldwin		netsmb nfs nfsclient nfsserver nlm ofed opencrypto \
65c3babf6SRui Paulo		rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR}
7debfd27fSJohn Baldwin.if !defined(CSCOPE_ARCHDIR)
82efc107aSDavid E. O'Brien.if defined(ALL_ARCH)
9153b6271SMitchell HorneCSCOPE_ARCHDIR = amd64 arm arm64 i386 powerpc riscv x86
102efc107aSDavid E. O'Brien.else
11debfd27fSJohn BaldwinCSCOPE_ARCHDIR = ${MACHINE}
12debfd27fSJohn Baldwin.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
13debfd27fSJohn BaldwinCSCOPE_ARCHDIR += x86
14debfd27fSJohn Baldwin.endif
15debfd27fSJohn Baldwin.endif
162efc107aSDavid E. O'Brien.endif
17ff2ad7d6SGreg Lehey
1817b88064SJordan K. HubbardHTAGSFLAGS+= -at `awk -F= '/^RELEASE *=/{release=$2}; END {print "FreeBSD", release, "kernel"}' < conf/newvers.sh`
1917b88064SJordan K. Hubbard
20f43455fdSBjoern A. Zeeb# You need the devel/cscope port for this.
21aa33f7d2SDavid E. O'Briencscope: cscope.out
22aa33f7d2SDavid E. O'Briencscope.out: ${.CURDIR}/cscope.files
23c960a2adSRui Paulo	cd ${.CURDIR}; cscope -k -buq -p4 -v
24ff2ad7d6SGreg Lehey
25aa33f7d2SDavid E. O'Brien${.CURDIR}/cscope.files: .PHONY
26aa33f7d2SDavid E. O'Brien	cd ${.CURDIR}; \
27d9cf41b6SDavid E. O'Brien		find ${CSCOPEDIRS} -name "*.[chSsly]" -a -type f > ${.TARGET}
28aa33f7d2SDavid E. O'Brien
29aa33f7d2SDavid E. O'Briencscope-clean:
3052f72bfaSEnji Cooper	cd ${.CURDIR}; \
31aa33f7d2SDavid E. O'Brien	    rm -f cscope.files cscope.out cscope.in.out cscope.po.out
32ff2ad7d6SGreg Lehey
33fb256796SRui Paulo#
34fb256796SRui Paulo# Installs SCM hooks to update the cscope database every time the source tree
35fb256796SRui Paulo# is updated.
36fb256796SRui Paulo# cscope understands incremental updates, so it's considerably faster when only
37fb256796SRui Paulo# a few files have changed.
38fb256796SRui Paulo#
39fb256796SRui PauloHG_DIR=${.CURDIR}/../.hg
40fb256796SRui PauloHG_HOOK=if [ \$$HG_ERROR -eq 0 ]; then cd sys && make -m ../share/mk cscope; fi
41fb256796SRui Paulocscope-hook:
42fb256796SRui Paulo	@if [ -d ${HG_DIR} ]; then 					\
43fb256796SRui Paulo		if [ "`grep hooks ${HG_DIR}/hgrc`" = "" ]; then		\
44fb256796SRui Paulo			echo "[hooks]" >> ${HG_DIR}/hgrc;		\
45fb256796SRui Paulo			echo "update = ${HG_HOOK}" >> ${HG_DIR}/hgrc;	\
46fb256796SRui Paulo			echo "Hook installed in ${HG_DIR}/hgrc";	\
47fb256796SRui Paulo		else 							\
48fb256796SRui Paulo			echo "Mercurial update hook already exists.";	\
49fb256796SRui Paulo		fi;							\
50fb256796SRui Paulo	fi
51fb256796SRui Paulo
52f43455fdSBjoern A. Zeeb# You need the devel/global and one of editor/emacs* ports for that.
53aa33f7d2SDavid E. O'BrienTAGS ${.CURDIR}/TAGS: ${.CURDIR}/cscope.files
54ff2ad7d6SGreg Lehey	rm -f ${.CURDIR}/TAGS
55aa33f7d2SDavid E. O'Brien	cd ${.CURDIR}; xargs etags -a < ${.CURDIR}/cscope.files
56ff2ad7d6SGreg Lehey
57e37a8052SEnji Cooper.if !(make(cscope) || make(cscope-clean) || make(cscope-hook) || make(TAGS))
5871e8891aSJohn Baldwin.include <src.opts.mk>
5971e8891aSJohn Baldwin
6071e8891aSJohn Baldwin# Loadable kernel modules
6171e8891aSJohn Baldwin
6271e8891aSJohn Baldwin.if defined(MODULES_WITH_WORLD)
6371e8891aSJohn BaldwinSUBDIR+=modules
6471e8891aSJohn Baldwin.endif
6571e8891aSJohn Baldwin
66303b706cSRodney W. Grimes.include <bsd.subdir.mk>
6771e8891aSJohn Baldwin.endif
68