The use of ctags and makefile in Liunx

Source: Internet
Author: User

    1. Ctags is a tool that can help you read the code under VIM, and it's easy to see the program's source code

      There are two ways to use Ctags: (1). You can create a file in any directory, and then use the Ctags *.c, which means to generate a label file for all the files in the current directory (Vim can be tagged and jump to the tag file) for example:

      Vim Ctag.h

      Vim ctag.c

      Vim MAIN.C


650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/82/0C/wKioL1dJMU-xeOJaAAB06yYOcls396.png-wh_500x0-wm_3 -wmp_4-s_954654545.png "title=" Qq20160528134255.png "alt=" Wkiol1djmu-xeojaaab06yyocls396.png-wh_50 "/>

Move the cursor to the fun function in main.c, press ctrl+[to jump to the place where the fun function is defined, that is, CTAG.C, ctrl+t turn to main.c function

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/82/0D/wKiom1dJL9uhXBbuAABmi4Bz4Tg691.png-wh_500x0-wm_3 -wmp_4-s_3516579004.png "style=" Float:none; "title=" Qq20160528134330.png "alt=" Wkiom1djl9uhxbbuaabmi4bz4tg691.png-wh_50 "/>



(2). Input Ctags-r,-R for recursive creation, in the current directory generated tags file, when the user runs vim in the current directory, will automatically load this tags file, tags file contains a list of these objects, You can use the tags file to find these definitions or tagged objects when running vim.

2.makefile

The source files in a project are not counted, and they are placed in several directories by type, function and module, makefile defines a series of rules to specify which files need to be compiled first, which files need to be compiled, which files need to be recompiled, and even more complex function operations, because Makefile is like a shell script, which can also execute commands for the operating system. Makefile brings the advantage is-"automated compilation", once written, only need a make command, the entire project is automatically compiled, greatly improving the efficiency of software development. Example: Create a t.c file, and then build a makefile file

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/82/0E/wKiom1dJO6GA88LVAAA3ano7GHc868.png-wh_500x0-wm_3 -wmp_4-s_1091701291.png "style=" Float:none; "title=" capture. PNG "alt=" Wkiom1djo6ga88lvaaa3ano7ghc868.png-wh_50 "/>

note:  
After you've defined the dependencies, The subsequent line defines how to generate the operating system commands for the target file, so be sure to start with a TAB key. Remember, make and no matter how the command works, he just executes the defined command.  
clean is not a file, is an action noun, make clean uses it to clear all the target files, so that it can be re-compiled.

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/82/0E/wKiom1dJO6LwOAmuAAA1tIKJjoM938.png-wh_500x0-wm_3 -wmp_4-s_3292998192.png "style=" Float:none; "title=" Captures 1. PNG "alt=" Wkiom1djo6lwoamuaaa1tikjjom938.png-wh_50 "/>


650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/82/4B/wKioL1dQMsWzUx0AAAAWttx1tAY020.png-wh_500x0-wm_3 -wmp_4-s_2907948199.png "title=" Qq20160602211733.png "alt=" Wkiol1dqmswzux0aaaawttx1tay020.png-wh_50 "/>

The working process of make:

    1. Find "makefile" or "makefile" files in the current directory

    2. If you find it, you can find the "T" file as the target file.

    3. If the "T" file is not found, find the t.o file that "T" depends on

    4. Generate T.O files based on dependent files for T.O files

    5. Execute sequentially until the executable file is generated

The use of ctags and makefile in Liunx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.