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