使用Kernel的Makefile生成tags和cscope看代码更方便

2019-03-05 09:57:51 浏览数 (1)

  1. [root@btg ext4]# make help
  2. Cleaning targets:
  3. clean - Remove most generated files but keep the config and
  4. enough build support to build external modules
  5. mrproper - Remove all generated files config various backup files
  6. distclean - mrproper remove editor backup and patch files
  7. Configuration targets:
  8. config - Update current config utilising a line-oriented program
  9. nconfig - Update current config utilising a ncurses menu based program
  10. menuconfig - Update current config utilising a menu based program
  11. xconfig - Update current config utilising a QT based front-end
  12. gconfig - Update current config utilising a GTK based front-end
  13. oldconfig - Update current config utilising a provided .config as base
  14. localmodconfig - Update current config disabling modules not loaded
  15. localyesconfig - Update current config converting local mods to core
  16. silentoldconfig - Same as oldconfig, but quietly, additionally update deps
  17. defconfig - New config with default from ARCH supplied defconfig
  18. savedefconfig - Save current config as ./defconfig (minimal config)
  19. allnoconfig - New config where all options are answered with no
  20. allyesconfig - New config where all options are accepted with yes
  21. allmodconfig - New config selecting modules when possible
  22. alldefconfig - New config with all symbols set to default
  23. randconfig - New config with random answer to all options
  24. listnewconfig - List new options
  25. oldnoconfig - Same as silentoldconfig but set new symbols to n (unset)
  26. Other generic targets:
  27. all - Build all targets marked with [*]
  28. * vmlinux - Build the bare kernel
  29. * modules - Build all modules
  30. modules_install - Install all modules to INSTALL_MOD_PATH (default: /)
  31. firmware_install- Install all firmware to INSTALL_FW_PATH
  32. (default: $(INSTALL_MOD_PATH)/lib/firmware)
  33. dir/ - Build all files in dir and below
  34. dir/file.[oisS] - Build specified target only
  35. dir/file.lst - Build specified mixed source/assembly target only
  36. (requires a recent binutils and recent build (System.map))
  37. dir/file.ko - Build module including final link
  38. modules_prepare - Set up for building external modules
  39. tags/TAGS - Generate tags file for editors
  40. cscope - Generate cscope index
  41. gtags - Generate GNU GLOBAL index
  42. kernelrelease - Output the release version string
  43. kernelversion - Output the version stored in Makefile
  44. headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH
  45. (default: /opt/ext4/usr)
  46. checkstack - Generate a list of stack hogs
  47. namespacecheck - Name space analysis on compiled kernel
  48. versioncheck - Sanity check on version.h usage
  49. includecheck - Check for duplicate included header files
  50. export_report - List the usages of all exported symbols
  51. headers_check - Sanity check on exported headers
  52. headerdep - Detect inclusion cycles in headers
  53. coccicheck - Check with Coccinelle.
  54. Kernel packaging:
  55. rpm-pkg - Build both source and binary RPM kernel packages
  56. binrpm-pkg - Build only the binary kernel package
  57. deb-pkg - Build the kernel as an deb package
  58. tar-pkg - Build the kernel as an uncompressed tarball
  59. targz-pkg - Build the kernel as a gzip compressed tarball
  60. tarbz2-pkg - Build the kernel as a bzip2 compressed tarball
  61. tarxz-pkg - Build the kernel as a xz compressed tarball
  62. perf-tar-src-pkg - Build perf-2.6.39-rc3.tar source tarball
  63. perf-targz-src-pkg - Build perf-2.6.39-rc3.tar.gz source tarball
  64. perf-tarbz2-src-pkg - Build perf-2.6.39-rc3.tar.bz2 source tarball
  65. perf-tarxz-src-pkg - Build perf-2.6.39-rc3.tar.xz source tarball
  66. Documentation targets:
  67. Linux kernel internal documentation in different formats:
  68. htmldocs - HTML
  69. pdfdocs - PDF
  70. psdocs - Postscript
  71. xmldocs - XML DocBook
  72. mandocs - man pages
  73. installmandocs - install man pages generated by mandocs
  74. cleandocs - clean all generated DocBook files
  75. Architecture specific targets (x86):
  76. * bzImage - Compressed kernel image (arch/x86/boot/bzImage)
  77. install - Install kernel using
  78. (your) ~/bin/installkernel or
  79. (distribution) /sbin/installkernel or
  80. install to $(INSTALL_PATH) and run lilo
  81. fdimage - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)
  82. fdimage144 - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)
  83. fdimage288 - Create 2.8MB boot floppy image (arch/x86/boot/fdimage)
  84. isoimage - Create a boot CD-ROM image (arch/x86/boot/image.iso)
  85. bzdisk/fdimage*/isoimage also accept:
  86. FDARGS="..." arguments for the booted kernel
  87. FDINITRD=file initrd for the booted kernel
  88. x86_64_defconfig - Build for x86_64
  89. i386_defconfig - Build for i386
  90. make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build
  91. make V=2 [targets] 2 => give reason for rebuild of target
  92. make O=dir [targets] Locate all output files in "dir", including .config
  93. make C=1 [targets] Check all c source with $CHECK (sparse by default)
  94. make C=2 [targets] Force check of all c source with $CHECK
  95. make W=1 [targets] Enable extra gcc checks
  96. Execute "make" or "make all" to build all targets marked with [*]
  97. For further info see the ./README file
  98. [root@btg ext4]#
  99. [root@btg ext4]# make tags cscope
  100. GEN tags
  101. GEN cscope
  102. [root@btg ext4]#

我自己生成的cscope和tags打开的内容

  1. Cscope tag: start_kernel
  2.    # 行 文件名 / 上下文 / 行
  3.    1 135 arch/alpha/boot/bootp.c <<start_kernel>>
  4.              start_kernel(void )
  5.    2 263 arch/alpha/boot/bootpz.c <<start_kernel>>
  6.              start_kernel(void )
  7.    3 153 arch/alpha/boot/main.c <<start_kernel>>
  8.              void start_kernel(void )
  9.    4 456 init/main.c <<start_kernel>>
  10.              asmlinkage void __init start_kernel(void )
  11. Type number and <Enter> (empty cancels):

如果使用kernel的Makefile里的会直接进入到

  1.    4 456 init/main.c <<start_kernel>>
  2.              asmlinkage void __init start_kernel(void )
  3. 里面

非常方便

0 人点赞