user42768
user42768

Reputation: 1971

gnu make: why called "top-level" target?

In the context of the GNU make tool the term "top-level target" is used. Are there other types of targets? Can there be targets "nested" inside other targets?

I could not find anything searching for "nested target", "inner target" or "enclosing target".

Upvotes: 1

Views: 567

Answers (2)

MadScientist
MadScientist

Reputation: 100781

There is no such thing as a "nested", "inner", or "enclosing" target in a makefile. Of course, you can "collect" targets implicitly by declaring prerequisites: if you build the target it also builds all its prerequisites.

The term top-level target as used in that section of the GNU make manual is your subjective understanding of the final goals that your makefile wants to create. So if your makefile should create a program and a library, those are the "top-level targets" that section refers to.

That page is discussing only a set of common targets that many makefiles implement. None of those are built into make or have any special meaning to make itself.

Upvotes: 1

shawnhcorey
shawnhcorey

Reputation: 3601

The top-level target is the target given to make on the command line. Or it's the default target in the Makefile. Other targets would be intermediate or dependent targets.

Upvotes: 0

Related Questions