Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # $FreeBSD$
  2. # Directories to include in cscope name file and TAGS.
  3. CSCOPEDIRS= 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)
  10. CSCOPE_ARCHDIR = amd64 arm arm64 i386 mips powerpc riscv x86
  11. .else
  12. CSCOPE_ARCHDIR = ${MACHINE}
  13. .if ${MACHINE} != ${MACHINE_CPUARCH}
  14. CSCOPE_ARCHDIR += ${MACHINE_CPUARCH}
  15. .endif
  16. .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
  17. CSCOPE_ARCHDIR += x86
  18. .endif
  19. .endif
  20. .endif
  21. HTAGSFLAGS+= -at `awk -F= '/^RELEASE *=/{release=$2}; END {print "FreeBSD", release, "kernel"}' < conf/newvers.sh`
  22. # You need the devel/cscope port for this.
  23. cscope: cscope.out
  24. cscope.out: ${.CURDIR}/cscope.files
  25. cd ${.CURDIR}; cscope -k -buq -p4 -v
  26. ${.CURDIR}/cscope.files: .PHONY
  27. cd ${.CURDIR}; \
  28. find ${CSCOPEDIRS} -name "*.[chSsly]" -a -type f > ${.TARGET}
  29. cscope-clean:
  30. cd ${.CURDIR}; \
  31. rm -f cscope.files cscope.out cscope.in.out cscope.po.out
  32. #
  33. # Installs SCM hooks to update the cscope database every time the source tree
  34. # is updated.
  35. # cscope understands incremental updates, so it's considerably faster when only
  36. # a few files have changed.
  37. #
  38. HG_DIR=${.CURDIR}/../.hg
  39. HG_HOOK=if [ \$$HG_ERROR -eq 0 ]; then cd sys && make -m ../share/mk cscope; fi
  40. cscope-hook:
  41. @if [ -d ${HG_DIR} ]; then \
  42. if [ "`grep hooks ${HG_DIR}/hgrc`" = "" ]; then \
  43. echo "[hooks]" >> ${HG_DIR}/hgrc; \
  44. echo "update = ${HG_HOOK}" >> ${HG_DIR}/hgrc; \
  45. echo "Hook installed in ${HG_DIR}/hgrc"; \
  46. else \
  47. echo "Mercurial update hook already exists."; \
  48. fi; \
  49. fi
  50. # You need the devel/global and one of editor/emacs* ports for that.
  51. TAGS ${.CURDIR}/TAGS: ${.CURDIR}/cscope.files
  52. rm -f ${.CURDIR}/TAGS
  53. cd ${.CURDIR}; xargs etags -a < ${.CURDIR}/cscope.files
  54. .if !(make(cscope) || make(cscope-clean) || make(cscope-hook) || make(TAGS))
  55. .include <src.opts.mk>
  56. # Loadable kernel modules
  57. .if defined(MODULES_WITH_WORLD)
  58. SUBDIR+=modules
  59. .endif
  60. .include <bsd.subdir.mk>
  61. .endif