What is a 'make target'?

后端 未结 4 499
我寻月下人不归
我寻月下人不归 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 02:05

    A 'make target' is basically a file that you want rebuilt.

    Make can't divine what you want built, so you have to tell it, implicitly or explicitly, what it should build. Often, the first target in the file is a name such as 'all' and if you run 'make' without any explicit target, it will build the first target listed in the makefile. However, some makefiles do not specify any target; then you must specify one on the command line. Or, if you don't want the default target built, then you must specify the target that you do want built.

    A target can also be 'phony', in the terms of GNU make. That is, it is a name that does not exist, and the rules do not create it, but it (the phony target) depends on a number of other files that do have rules associated with them. Indeed, the 'all' target is usually a phony target - there isn't a file called 'all' in most directories.

提交回复
热议问题