Eric
Eric

Reputation: 97555

Makefile target references Makefile

I just discovered this line in a makefile:

%: Makefile

To me, that says "to make any target, you need this makefile", which strikes me as somewhat obvious.

Is there any situation in which this is not a no-op?

Upvotes: 1

Views: 367

Answers (1)

Charley Moore
Charley Moore

Reputation: 488

As Etan commented, this will cause every target to be rebuilt whenever the Makefile changes. This is necessary so that anytime you make a change in the build configuration parameters the target will be rebuilt. Otherwise make won't know to rebuild with the new configuration.

Upvotes: 2

Related Questions