What is a 'make target'?

后端 未结 4 498
我寻月下人不归
我寻月下人不归 2021-02-07 01:26

Why do I need to make a make target before being able to build my source code?

More specifically, what is make target exactly?

4条回答
  •  梦如初夏
    2021-02-07 01:52

    make is a common development tool, which checks file dates between source code files and the object code produced from them, and compiles the one where the source is newer. It does this by use a file, called a makefile, which list the files that need to be compared.

    The standard syntax is make /f makefile myprog.exe

    That says to build myprog.exe using the file list in makefile. The makefile defaults to makefile.mak so if you use that name, you don't have to specify it on the command line.

    myprog.exe here is called the target. One trick is that you could put in the makefile a list of build instructions for a non-existant file. If you then say to build that target, it will run those command. Often, you'll see something like make clean, which has temporary file deleted.

提交回复
热议问题